aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2014-05-07 12:06:50 +0000
committerBart Polot <bart@net.in.tum.de>2014-05-07 12:06:50 +0000
commitbe4c79e4cd4a8f118c5577874f0c95e253359595 (patch)
tree7fd74fb0cf6921c4e35a43f2593396bb4805f154 /src
parent15ccd7a167bcce0dde4331092975a6401393610f (diff)
downloadgnunet-be4c79e4cd4a8f118c5577874f0c95e253359595.tar.gz
gnunet-be4c79e4cd4a8f118c5577874f0c95e253359595.zip
Rename mesh->cadet
Diffstat (limited to 'src')
-rw-r--r--src/conversation/conversation.h36
-rw-r--r--src/conversation/conversation_api_call.c2
-rw-r--r--src/conversation/gnunet-service-conversation.c252
-rw-r--r--src/dns/dnsstub.c2
-rw-r--r--src/exit/exit.h18
-rw-r--r--src/exit/gnunet-daemon-exit.c146
-rw-r--r--src/fs/fs_api.c2
-rw-r--r--src/fs/gnunet-service-fs.c16
-rw-r--r--src/fs/gnunet-service-fs_mesh.h40
-rw-r--r--src/fs/gnunet-service-fs_mesh_client.c304
-rw-r--r--src/fs/gnunet-service-fs_mesh_server.c180
-rw-r--r--src/fs/gnunet-service-fs_pr.c66
-rw-r--r--src/fs/gnunet-service-fs_pr.h4
-rw-r--r--src/fs/test_fs_download.c6
-rw-r--r--src/fs/test_gnunet_service_fs_p2p.c6
-rw-r--r--src/include/gnunet_applications.h2
-rw-r--r--src/include/gnunet_block_lib.h6
-rw-r--r--src/include/gnunet_core_service.h4
-rw-r--r--src/include/gnunet_mesh_service.h214
-rw-r--r--src/include/gnunet_protocols.h112
-rw-r--r--src/include/gnunet_signatures.h4
-rw-r--r--src/mesh/gnunet-mesh-profiler.c172
-rw-r--r--src/mesh/gnunet-mesh.c102
-rw-r--r--src/mesh/gnunet-service-mesh.c34
-rw-r--r--src/mesh/gnunet-service-mesh_channel.c476
-rw-r--r--src/mesh/gnunet-service-mesh_channel.h96
-rw-r--r--src/mesh/gnunet-service-mesh_connection.c634
-rw-r--r--src/mesh/gnunet-service-mesh_connection.h116
-rw-r--r--src/mesh/gnunet-service-mesh_dht.c28
-rw-r--r--src/mesh/gnunet-service-mesh_dht.h16
-rw-r--r--src/mesh/gnunet-service-mesh_hello.c12
-rw-r--r--src/mesh/gnunet-service-mesh_hello.h14
-rw-r--r--src/mesh/gnunet-service-mesh_local.c274
-rw-r--r--src/mesh/gnunet-service-mesh_local.h62
-rw-r--r--src/mesh/gnunet-service-mesh_peer.c396
-rw-r--r--src/mesh/gnunet-service-mesh_peer.h94
-rw-r--r--src/mesh/gnunet-service-mesh_tunnel.c612
-rw-r--r--src/mesh/gnunet-service-mesh_tunnel.h140
-rw-r--r--src/mesh/mesh.h66
-rw-r--r--src/mesh/mesh_api.c666
-rw-r--r--src/mesh/mesh_common.c78
-rw-r--r--src/mesh/mesh_path.c38
-rw-r--r--src/mesh/mesh_path.h38
-rw-r--r--src/mesh/mesh_protocol.h112
-rw-r--r--src/mesh/mesh_test_lib.c118
-rw-r--r--src/mesh/mesh_test_lib.h42
-rw-r--r--src/mesh/mesh_tunnel_tree.c276
-rw-r--r--src/mesh/mesh_tunnel_tree.h88
-rw-r--r--src/mesh/test_mesh.c126
-rw-r--r--src/mesh/test_mesh_local.c66
-rw-r--r--src/mesh/test_mesh_single.c62
-rw-r--r--src/pt/gnunet-daemon-pt.c202
-rw-r--r--src/regex/gnunet-daemon-regexprofiler.c8
-rw-r--r--src/regex/gnunet-regex-simulation-profiler.c2
-rw-r--r--src/regex/regex_internal_dht.c8
-rw-r--r--src/regex/regex_test_lib.c2
-rw-r--r--src/set/gnunet-service-set.c70
-rw-r--r--src/set/gnunet-service-set.h4
-rw-r--r--src/set/gnunet-service-set_intersection.c2
-rw-r--r--src/set/gnunet-service-set_union.c4
-rw-r--r--src/topology/gnunet-daemon-topology.c4
-rw-r--r--src/vpn/gnunet-service-vpn.c104
62 files changed, 3443 insertions, 3443 deletions
diff --git a/src/conversation/conversation.h b/src/conversation/conversation.h
index bc78400f1..284d5dc67 100644
--- a/src/conversation/conversation.h
+++ b/src/conversation/conversation.h
@@ -235,12 +235,12 @@ struct ClientPhonePickedupMessage
235 235
236 236
237/** 237/**
238 * Mesh message for phone is ringing. 238 * Cadet message for phone is ringing.
239 */ 239 */
240struct MeshPhoneRingMessage 240struct CadetPhoneRingMessage
241{ 241{
242 /** 242 /**
243 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_RING 243 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RING
244 */ 244 */
245 struct GNUNET_MessageHeader header; 245 struct GNUNET_MessageHeader header;
246 246
@@ -288,12 +288,12 @@ struct MeshPhoneRingMessage
288 288
289 289
290/** 290/**
291 * Mesh message for hanging up. 291 * Cadet message for hanging up.
292 */ 292 */
293struct MeshPhoneHangupMessage 293struct CadetPhoneHangupMessage
294{ 294{
295 /** 295 /**
296 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_HANG_UP 296 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_HANG_UP
297 */ 297 */
298 struct GNUNET_MessageHeader header; 298 struct GNUNET_MessageHeader header;
299 299
@@ -301,12 +301,12 @@ struct MeshPhoneHangupMessage
301 301
302 302
303/** 303/**
304 * Mesh message for picking up. 304 * Cadet message for picking up.
305 */ 305 */
306struct MeshPhonePickupMessage 306struct CadetPhonePickupMessage
307{ 307{
308 /** 308 /**
309 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_PICK_UP 309 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_PICK_UP
310 */ 310 */
311 struct GNUNET_MessageHeader header; 311 struct GNUNET_MessageHeader header;
312 312
@@ -314,12 +314,12 @@ struct MeshPhonePickupMessage
314 314
315 315
316/** 316/**
317 * Mesh message for phone suspended. 317 * Cadet message for phone suspended.
318 */ 318 */
319struct MeshPhoneSuspendMessage 319struct CadetPhoneSuspendMessage
320{ 320{
321 /** 321 /**
322 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_SUSPEND 322 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_SUSPEND
323 */ 323 */
324 struct GNUNET_MessageHeader header; 324 struct GNUNET_MessageHeader header;
325 325
@@ -327,12 +327,12 @@ struct MeshPhoneSuspendMessage
327 327
328 328
329/** 329/**
330 * Mesh message for phone resumed. 330 * Cadet message for phone resumed.
331 */ 331 */
332struct MeshPhoneResumeMessage 332struct CadetPhoneResumeMessage
333{ 333{
334 /** 334 /**
335 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_RESUME 335 * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RESUME
336 */ 336 */
337 struct GNUNET_MessageHeader header; 337 struct GNUNET_MessageHeader header;
338 338
@@ -340,12 +340,12 @@ struct MeshPhoneResumeMessage
340 340
341 341
342/** 342/**
343 * Mesh message to transmit the audio. 343 * Cadet message to transmit the audio.
344 */ 344 */
345struct MeshAudioMessage 345struct CadetAudioMessage
346{ 346{
347 /** 347 /**
348 * Type is #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_AUDIO 348 * Type is #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_AUDIO
349 */ 349 */
350 struct GNUNET_MessageHeader header; 350 struct GNUNET_MessageHeader header;
351 351
diff --git a/src/conversation/conversation_api_call.c b/src/conversation/conversation_api_call.c
index 379947087..f69a6518c 100644
--- a/src/conversation/conversation_api_call.c
+++ b/src/conversation/conversation_api_call.c
@@ -384,7 +384,7 @@ handle_call_audio_message (void *cls,
384 break; 384 break;
385 case CS_SUSPENDED_CALLEE: 385 case CS_SUSPENDED_CALLEE:
386 case CS_SUSPENDED_BOTH: 386 case CS_SUSPENDED_BOTH:
387 /* can (rarely) also happen: other peer suspended, but mesh might 387 /* can (rarely) also happen: other peer suspended, but cadet might
388 have had delayed data on the unreliable channel */ 388 have had delayed data on the unreliable channel */
389 break; 389 break;
390 case CS_ACTIVE: 390 case CS_ACTIVE:
diff --git a/src/conversation/gnunet-service-conversation.c b/src/conversation/gnunet-service-conversation.c
index 0fc19c510..a354c9d01 100644
--- a/src/conversation/gnunet-service-conversation.c
+++ b/src/conversation/gnunet-service-conversation.c
@@ -30,7 +30,7 @@
30#include "gnunet_applications.h" 30#include "gnunet_applications.h"
31#include "gnunet_constants.h" 31#include "gnunet_constants.h"
32#include "gnunet_signatures.h" 32#include "gnunet_signatures.h"
33#include "gnunet_mesh_service.h" 33#include "gnunet_cadet_service.h"
34#include "gnunet_conversation_service.h" 34#include "gnunet_conversation_service.h"
35#include "conversation.h" 35#include "conversation.h"
36 36
@@ -44,8 +44,8 @@
44 44
45 45
46/** 46/**
47 * A line connects a local client with a mesh channel (or, if it is an 47 * A line connects a local client with a cadet channel (or, if it is an
48 * open line, is waiting for a mesh channel). 48 * open line, is waiting for a cadet channel).
49 */ 49 */
50struct Line; 50struct Line;
51 51
@@ -88,7 +88,7 @@ enum ChannelStatus
88 88
89 89
90/** 90/**
91 * A `struct Channel` represents a mesh channel, which is a P2P 91 * A `struct Channel` represents a cadet channel, which is a P2P
92 * connection to another conversation service. Multiple channels can 92 * connection to another conversation service. Multiple channels can
93 * be attached the the same `struct Line`, which represents a local 93 * be attached the the same `struct Line`, which represents a local
94 * client. We keep them in a linked list. 94 * client. We keep them in a linked list.
@@ -114,17 +114,17 @@ struct Channel
114 /** 114 /**
115 * Handle for the reliable channel (contol data) 115 * Handle for the reliable channel (contol data)
116 */ 116 */
117 struct GNUNET_MESH_Channel *channel_reliable; 117 struct GNUNET_CADET_Channel *channel_reliable;
118 118
119 /** 119 /**
120 * Handle for unreliable channel (audio data) 120 * Handle for unreliable channel (audio data)
121 */ 121 */
122 struct GNUNET_MESH_Channel *channel_unreliable; 122 struct GNUNET_CADET_Channel *channel_unreliable;
123 123
124 /** 124 /**
125 * Transmit handle for pending audio messages 125 * Transmit handle for pending audio messages
126 */ 126 */
127 struct GNUNET_MESH_TransmitHandle *unreliable_mth; 127 struct GNUNET_CADET_TransmitHandle *unreliable_mth;
128 128
129 /** 129 /**
130 * Message queue for control messages 130 * Message queue for control messages
@@ -175,7 +175,7 @@ struct Channel
175 175
176 176
177/** 177/**
178 * A `struct Line` connects a local client with mesh channels. 178 * A `struct Line` connects a local client with cadet channels.
179 */ 179 */
180struct Line 180struct Line
181{ 181{
@@ -228,9 +228,9 @@ static const struct GNUNET_CONFIGURATION_Handle *cfg;
228static struct GNUNET_SERVER_NotificationContext *nc; 228static struct GNUNET_SERVER_NotificationContext *nc;
229 229
230/** 230/**
231 * Handle for mesh 231 * Handle for cadet
232 */ 232 */
233static struct GNUNET_MESH_Handle *mesh; 233static struct GNUNET_CADET_Handle *cadet;
234 234
235/** 235/**
236 * Identity of this peer. 236 * Identity of this peer.
@@ -304,7 +304,7 @@ handle_client_pickup_message (void *cls,
304{ 304{
305 const struct ClientPhonePickupMessage *msg; 305 const struct ClientPhonePickupMessage *msg;
306 struct GNUNET_MQ_Envelope *e; 306 struct GNUNET_MQ_Envelope *e;
307 struct MeshPhonePickupMessage *mppm; 307 struct CadetPhonePickupMessage *mppm;
308 struct Line *line; 308 struct Line *line;
309 struct Channel *ch; 309 struct Channel *ch;
310 310
@@ -350,9 +350,9 @@ handle_client_pickup_message (void *cls,
350 } 350 }
351 GNUNET_break (CS_CALLEE_CONNECTED == ch->status); 351 GNUNET_break (CS_CALLEE_CONNECTED == ch->status);
352 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 352 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
353 "Sending PICK_UP message to mesh\n"); 353 "Sending PICK_UP message to cadet\n");
354 e = GNUNET_MQ_msg (mppm, 354 e = GNUNET_MQ_msg (mppm,
355 GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_PICK_UP); 355 GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_PICK_UP);
356 GNUNET_MQ_send (ch->reliable_mq, e); 356 GNUNET_MQ_send (ch->reliable_mq, e);
357 GNUNET_SERVER_receive_done (client, GNUNET_OK); 357 GNUNET_SERVER_receive_done (client, GNUNET_OK);
358} 358}
@@ -364,13 +364,13 @@ handle_client_pickup_message (void *cls,
364 * @param ch channel to destroy. 364 * @param ch channel to destroy.
365 */ 365 */
366static void 366static void
367destroy_line_mesh_channels (struct Channel *ch) 367destroy_line_cadet_channels (struct Channel *ch)
368{ 368{
369 struct Line *line = ch->line; 369 struct Line *line = ch->line;
370 struct GNUNET_MESH_Channel *t; 370 struct GNUNET_CADET_Channel *t;
371 371
372 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 372 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
373 "Destroying mesh channels\n"); 373 "Destroying cadet channels\n");
374 if (NULL != ch->reliable_mq) 374 if (NULL != ch->reliable_mq)
375 { 375 {
376 GNUNET_MQ_destroy (ch->reliable_mq); 376 GNUNET_MQ_destroy (ch->reliable_mq);
@@ -378,18 +378,18 @@ destroy_line_mesh_channels (struct Channel *ch)
378 } 378 }
379 if (NULL != ch->unreliable_mth) 379 if (NULL != ch->unreliable_mth)
380 { 380 {
381 GNUNET_MESH_notify_transmit_ready_cancel (ch->unreliable_mth); 381 GNUNET_CADET_notify_transmit_ready_cancel (ch->unreliable_mth);
382 ch->unreliable_mth = NULL; 382 ch->unreliable_mth = NULL;
383 } 383 }
384 if (NULL != (t = ch->channel_unreliable)) 384 if (NULL != (t = ch->channel_unreliable))
385 { 385 {
386 ch->channel_unreliable = NULL; 386 ch->channel_unreliable = NULL;
387 GNUNET_MESH_channel_destroy (t); 387 GNUNET_CADET_channel_destroy (t);
388 } 388 }
389 if (NULL != (t = ch->channel_reliable)) 389 if (NULL != (t = ch->channel_reliable))
390 { 390 {
391 ch->channel_reliable = NULL; 391 ch->channel_reliable = NULL;
392 GNUNET_MESH_channel_destroy (t); 392 GNUNET_CADET_channel_destroy (t);
393 } 393 }
394 GNUNET_CONTAINER_DLL_remove (line->channel_head, 394 GNUNET_CONTAINER_DLL_remove (line->channel_head,
395 line->channel_tail, 395 line->channel_tail,
@@ -419,7 +419,7 @@ mq_done_finish_caller_shutdown (void *cls)
419 GNUNET_break (0); 419 GNUNET_break (0);
420 break; 420 break;
421 case CS_CALLEE_SHUTDOWN: 421 case CS_CALLEE_SHUTDOWN:
422 destroy_line_mesh_channels (ch); 422 destroy_line_cadet_channels (ch);
423 break; 423 break;
424 case CS_CALLER_CALLING: 424 case CS_CALLER_CALLING:
425 GNUNET_break (0); 425 GNUNET_break (0);
@@ -428,7 +428,7 @@ mq_done_finish_caller_shutdown (void *cls)
428 GNUNET_break (0); 428 GNUNET_break (0);
429 break; 429 break;
430 case CS_CALLER_SHUTDOWN: 430 case CS_CALLER_SHUTDOWN:
431 destroy_line_mesh_channels (ch); 431 destroy_line_cadet_channels (ch);
432 break; 432 break;
433 } 433 }
434} 434}
@@ -448,7 +448,7 @@ handle_client_hangup_message (void *cls,
448{ 448{
449 const struct ClientPhoneHangupMessage *msg; 449 const struct ClientPhoneHangupMessage *msg;
450 struct GNUNET_MQ_Envelope *e; 450 struct GNUNET_MQ_Envelope *e;
451 struct MeshPhoneHangupMessage *mhum; 451 struct CadetPhoneHangupMessage *mhum;
452 struct Line *line; 452 struct Line *line;
453 struct Channel *ch; 453 struct Channel *ch;
454 454
@@ -497,9 +497,9 @@ handle_client_hangup_message (void *cls,
497 return; 497 return;
498 } 498 }
499 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 499 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
500 "Sending HANG_UP message via mesh\n"); 500 "Sending HANG_UP message via cadet\n");
501 e = GNUNET_MQ_msg (mhum, 501 e = GNUNET_MQ_msg (mhum,
502 GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_HANG_UP); 502 GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_HANG_UP);
503 GNUNET_MQ_notify_sent (e, 503 GNUNET_MQ_notify_sent (e,
504 &mq_done_finish_caller_shutdown, 504 &mq_done_finish_caller_shutdown,
505 ch); 505 ch);
@@ -522,7 +522,7 @@ handle_client_suspend_message (void *cls,
522{ 522{
523 const struct ClientPhoneSuspendMessage *msg; 523 const struct ClientPhoneSuspendMessage *msg;
524 struct GNUNET_MQ_Envelope *e; 524 struct GNUNET_MQ_Envelope *e;
525 struct MeshPhoneSuspendMessage *mhum; 525 struct CadetPhoneSuspendMessage *mhum;
526 struct Line *line; 526 struct Line *line;
527 struct Channel *ch; 527 struct Channel *ch;
528 528
@@ -578,9 +578,9 @@ handle_client_suspend_message (void *cls,
578 return; 578 return;
579 } 579 }
580 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 580 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
581 "Sending SUSPEND message via mesh\n"); 581 "Sending SUSPEND message via cadet\n");
582 e = GNUNET_MQ_msg (mhum, 582 e = GNUNET_MQ_msg (mhum,
583 GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_SUSPEND); 583 GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_SUSPEND);
584 GNUNET_MQ_send (ch->reliable_mq, e); 584 GNUNET_MQ_send (ch->reliable_mq, e);
585 GNUNET_SERVER_receive_done (client, GNUNET_OK); 585 GNUNET_SERVER_receive_done (client, GNUNET_OK);
586} 586}
@@ -600,7 +600,7 @@ handle_client_resume_message (void *cls,
600{ 600{
601 const struct ClientPhoneResumeMessage *msg; 601 const struct ClientPhoneResumeMessage *msg;
602 struct GNUNET_MQ_Envelope *e; 602 struct GNUNET_MQ_Envelope *e;
603 struct MeshPhoneResumeMessage *mhum; 603 struct CadetPhoneResumeMessage *mhum;
604 struct Line *line; 604 struct Line *line;
605 struct Channel *ch; 605 struct Channel *ch;
606 606
@@ -656,9 +656,9 @@ handle_client_resume_message (void *cls,
656 return; 656 return;
657 } 657 }
658 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 658 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
659 "Sending RESUME message via mesh\n"); 659 "Sending RESUME message via cadet\n");
660 e = GNUNET_MQ_msg (mhum, 660 e = GNUNET_MQ_msg (mhum,
661 GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_RESUME); 661 GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RESUME);
662 GNUNET_MQ_send (ch->reliable_mq, e); 662 GNUNET_MQ_send (ch->reliable_mq, e);
663 GNUNET_SERVER_receive_done (client, GNUNET_OK); 663 GNUNET_SERVER_receive_done (client, GNUNET_OK);
664} 664}
@@ -680,7 +680,7 @@ handle_client_call_message (void *cls,
680 struct Line *line; 680 struct Line *line;
681 struct Channel *ch; 681 struct Channel *ch;
682 struct GNUNET_MQ_Envelope *e; 682 struct GNUNET_MQ_Envelope *e;
683 struct MeshPhoneRingMessage *ring; 683 struct CadetPhoneRingMessage *ring;
684 684
685 msg = (const struct ClientCallMessage *) message; 685 msg = (const struct ClientCallMessage *) message;
686 line = GNUNET_SERVER_client_get_user_context (client, struct Line); 686 line = GNUNET_SERVER_client_get_user_context (client, struct Line);
@@ -706,13 +706,13 @@ handle_client_call_message (void *cls,
706 ch->target = msg->target; 706 ch->target = msg->target;
707 ch->remote_line = ntohl (msg->line); 707 ch->remote_line = ntohl (msg->line);
708 ch->status = CS_CALLER_CALLING; 708 ch->status = CS_CALLER_CALLING;
709 ch->channel_reliable = GNUNET_MESH_channel_create (mesh, 709 ch->channel_reliable = GNUNET_CADET_channel_create (cadet,
710 ch, 710 ch,
711 &msg->target, 711 &msg->target,
712 GNUNET_APPLICATION_TYPE_CONVERSATION_CONTROL, 712 GNUNET_APPLICATION_TYPE_CONVERSATION_CONTROL,
713 GNUNET_MESH_OPTION_RELIABLE); 713 GNUNET_CADET_OPTION_RELIABLE);
714 ch->reliable_mq = GNUNET_MESH_mq_create (ch->channel_reliable); 714 ch->reliable_mq = GNUNET_CADET_mq_create (ch->channel_reliable);
715 e = GNUNET_MQ_msg (ring, GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_RING); 715 e = GNUNET_MQ_msg (ring, GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RING);
716 ring->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CONVERSATION_RING); 716 ring->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CONVERSATION_RING);
717 ring->purpose.size = htonl (sizeof (struct GNUNET_PeerIdentity) * 2 + 717 ring->purpose.size = htonl (sizeof (struct GNUNET_PeerIdentity) * 2 +
718 sizeof (struct GNUNET_TIME_AbsoluteNBO) + 718 sizeof (struct GNUNET_TIME_AbsoluteNBO) +
@@ -729,14 +729,14 @@ handle_client_call_message (void *cls,
729 &ring->purpose, 729 &ring->purpose,
730 &ring->signature); 730 &ring->signature);
731 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 731 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
732 "Sending RING message via mesh\n"); 732 "Sending RING message via cadet\n");
733 GNUNET_MQ_send (ch->reliable_mq, e); 733 GNUNET_MQ_send (ch->reliable_mq, e);
734 GNUNET_SERVER_receive_done (client, GNUNET_OK); 734 GNUNET_SERVER_receive_done (client, GNUNET_OK);
735} 735}
736 736
737 737
738/** 738/**
739 * Transmit audio data via unreliable mesh channel. 739 * Transmit audio data via unreliable cadet channel.
740 * 740 *
741 * @param cls the `struct Channel` we are transmitting for 741 * @param cls the `struct Channel` we are transmitting for
742 * @param size number of bytes available in @a buf 742 * @param size number of bytes available in @a buf
@@ -749,26 +749,26 @@ transmit_line_audio (void *cls,
749 void *buf) 749 void *buf)
750{ 750{
751 struct Channel *ch = cls; 751 struct Channel *ch = cls;
752 struct MeshAudioMessage *mam = buf; 752 struct CadetAudioMessage *mam = buf;
753 753
754 ch->unreliable_mth = NULL; 754 ch->unreliable_mth = NULL;
755 if ( (NULL == buf) || 755 if ( (NULL == buf) ||
756 (size < sizeof (struct MeshAudioMessage) + ch->audio_size) ) 756 (size < sizeof (struct CadetAudioMessage) + ch->audio_size) )
757 { 757 {
758 /* eh, other error handling? */ 758 /* eh, other error handling? */
759 return 0; 759 return 0;
760 } 760 }
761 mam->header.size = htons (sizeof (struct MeshAudioMessage) + ch->audio_size); 761 mam->header.size = htons (sizeof (struct CadetAudioMessage) + ch->audio_size);
762 mam->header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_AUDIO); 762 mam->header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_AUDIO);
763 mam->remote_line = htonl (ch->remote_line); 763 mam->remote_line = htonl (ch->remote_line);
764 mam->source_line = htonl (ch->line->local_line); 764 mam->source_line = htonl (ch->line->local_line);
765 memcpy (&mam[1], ch->audio_data, ch->audio_size); 765 memcpy (&mam[1], ch->audio_data, ch->audio_size);
766 GNUNET_free (ch->audio_data); 766 GNUNET_free (ch->audio_data);
767 ch->audio_data = NULL; 767 ch->audio_data = NULL;
768 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 768 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
769 "Sending %u bytes of audio data from line %u to remote line %u via mesh\n", 769 "Sending %u bytes of audio data from line %u to remote line %u via cadet\n",
770 ch->audio_size, ch->line->local_line, ch->remote_line); 770 ch->audio_size, ch->line->local_line, ch->remote_line);
771 return sizeof (struct MeshAudioMessage) + ch->audio_size; 771 return sizeof (struct CadetAudioMessage) + ch->audio_size;
772} 772}
773 773
774 774
@@ -825,7 +825,7 @@ handle_client_audio_message (void *cls,
825 case CS_CALLEE_SHUTDOWN: 825 case CS_CALLEE_SHUTDOWN:
826 case CS_CALLER_SHUTDOWN: 826 case CS_CALLER_SHUTDOWN:
827 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, 827 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
828 "Mesh audio channel in shutdown; audio data dropped\n"); 828 "Cadet audio channel in shutdown; audio data dropped\n");
829 GNUNET_SERVER_receive_done (client, GNUNET_OK); 829 GNUNET_SERVER_receive_done (client, GNUNET_OK);
830 return; 830 return;
831 } 831 }
@@ -838,7 +838,7 @@ handle_client_audio_message (void *cls,
838 if (NULL == ch->channel_unreliable) 838 if (NULL == ch->channel_unreliable)
839 { 839 {
840 GNUNET_log (GNUNET_ERROR_TYPE_INFO | GNUNET_ERROR_TYPE_BULK, 840 GNUNET_log (GNUNET_ERROR_TYPE_INFO | GNUNET_ERROR_TYPE_BULK,
841 _("Mesh audio channel not ready; audio data dropped\n")); 841 _("Cadet audio channel not ready; audio data dropped\n"));
842 GNUNET_SERVER_receive_done (client, GNUNET_OK); 842 GNUNET_SERVER_receive_done (client, GNUNET_OK);
843 return; 843 return;
844 } 844 }
@@ -848,7 +848,7 @@ handle_client_audio_message (void *cls,
848 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 848 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
849 "Bandwidth insufficient; dropping previous audio data segment with %u bytes\n", 849 "Bandwidth insufficient; dropping previous audio data segment with %u bytes\n",
850 (unsigned int) ch->audio_size); 850 (unsigned int) ch->audio_size);
851 GNUNET_MESH_notify_transmit_ready_cancel (ch->unreliable_mth); 851 GNUNET_CADET_notify_transmit_ready_cancel (ch->unreliable_mth);
852 ch->unreliable_mth = NULL; 852 ch->unreliable_mth = NULL;
853 GNUNET_free (ch->audio_data); 853 GNUNET_free (ch->audio_data);
854 ch->audio_data = NULL; 854 ch->audio_data = NULL;
@@ -858,10 +858,10 @@ handle_client_audio_message (void *cls,
858 memcpy (ch->audio_data, 858 memcpy (ch->audio_data,
859 &msg[1], 859 &msg[1],
860 size); 860 size);
861 ch->unreliable_mth = GNUNET_MESH_notify_transmit_ready (ch->channel_unreliable, 861 ch->unreliable_mth = GNUNET_CADET_notify_transmit_ready (ch->channel_unreliable,
862 GNUNET_NO, 862 GNUNET_NO,
863 GNUNET_TIME_UNIT_FOREVER_REL, 863 GNUNET_TIME_UNIT_FOREVER_REL,
864 sizeof (struct MeshAudioMessage) 864 sizeof (struct CadetAudioMessage)
865 + ch->audio_size, 865 + ch->audio_size,
866 &transmit_line_audio, 866 &transmit_line_audio,
867 ch); 867 ch);
@@ -873,19 +873,19 @@ handle_client_audio_message (void *cls,
873 * We are done signalling shutdown to the other peer. 873 * We are done signalling shutdown to the other peer.
874 * Destroy the channel. 874 * Destroy the channel.
875 * 875 *
876 * @param cls the `struct GNUNET_MESH_channel` to destroy 876 * @param cls the `struct GNUNET_CADET_channel` to destroy
877 */ 877 */
878static void 878static void
879mq_done_destroy_channel (void *cls) 879mq_done_destroy_channel (void *cls)
880{ 880{
881 struct GNUNET_MESH_Channel *channel = cls; 881 struct GNUNET_CADET_Channel *channel = cls;
882 882
883 GNUNET_MESH_channel_destroy (channel); 883 GNUNET_CADET_channel_destroy (channel);
884} 884}
885 885
886 886
887/** 887/**
888 * Function to handle a ring message incoming over mesh 888 * Function to handle a ring message incoming over cadet
889 * 889 *
890 * @param cls closure, NULL 890 * @param cls closure, NULL
891 * @param channel the channel over which the message arrived 891 * @param channel the channel over which the message arrived
@@ -895,20 +895,20 @@ mq_done_destroy_channel (void *cls)
895 * @return #GNUNET_OK 895 * @return #GNUNET_OK
896 */ 896 */
897static int 897static int
898handle_mesh_ring_message (void *cls, 898handle_cadet_ring_message (void *cls,
899 struct GNUNET_MESH_Channel *channel, 899 struct GNUNET_CADET_Channel *channel,
900 void **channel_ctx, 900 void **channel_ctx,
901 const struct GNUNET_MessageHeader *message) 901 const struct GNUNET_MessageHeader *message)
902{ 902{
903 const struct MeshPhoneRingMessage *msg; 903 const struct CadetPhoneRingMessage *msg;
904 struct Line *line; 904 struct Line *line;
905 struct Channel *ch; 905 struct Channel *ch;
906 struct GNUNET_MQ_Envelope *e; 906 struct GNUNET_MQ_Envelope *e;
907 struct MeshPhoneHangupMessage *hang_up; 907 struct CadetPhoneHangupMessage *hang_up;
908 struct ClientPhoneRingMessage cring; 908 struct ClientPhoneRingMessage cring;
909 struct GNUNET_MQ_Handle *reliable_mq; 909 struct GNUNET_MQ_Handle *reliable_mq;
910 910
911 msg = (const struct MeshPhoneRingMessage *) message; 911 msg = (const struct CadetPhoneRingMessage *) message;
912 if ( (msg->purpose.size != htonl (sizeof (struct GNUNET_PeerIdentity) * 2 + 912 if ( (msg->purpose.size != htonl (sizeof (struct GNUNET_PeerIdentity) * 2 +
913 sizeof (struct GNUNET_TIME_AbsoluteNBO) + 913 sizeof (struct GNUNET_TIME_AbsoluteNBO) +
914 sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + 914 sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) +
@@ -922,7 +922,7 @@ handle_mesh_ring_message (void *cls,
922 GNUNET_break_op (0); 922 GNUNET_break_op (0);
923 return GNUNET_SYSERR; 923 return GNUNET_SYSERR;
924 } 924 }
925 GNUNET_MESH_receive_done (channel); /* needed? */ 925 GNUNET_CADET_receive_done (channel); /* needed? */
926 for (line = lines_head; NULL != line; line = line->next) 926 for (line = lines_head; NULL != line; line = line->next)
927 if (line->local_line == ntohl (msg->remote_line)) 927 if (line->local_line == ntohl (msg->remote_line))
928 break; 928 break;
@@ -932,11 +932,11 @@ handle_mesh_ring_message (void *cls,
932 _("No available phone for incoming call on line %u, sending HANG_UP signal\n"), 932 _("No available phone for incoming call on line %u, sending HANG_UP signal\n"),
933 ntohl (msg->remote_line)); 933 ntohl (msg->remote_line));
934 e = GNUNET_MQ_msg (hang_up, 934 e = GNUNET_MQ_msg (hang_up,
935 GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_HANG_UP); 935 GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_HANG_UP);
936 GNUNET_MQ_notify_sent (e, 936 GNUNET_MQ_notify_sent (e,
937 &mq_done_destroy_channel, 937 &mq_done_destroy_channel,
938 channel); 938 channel);
939 reliable_mq = GNUNET_MESH_mq_create (channel); 939 reliable_mq = GNUNET_CADET_mq_create (channel);
940 GNUNET_MQ_send (reliable_mq, e); 940 GNUNET_MQ_send (reliable_mq, e);
941 /* FIXME: do we need to clean up reliable_mq somehow/somewhere? */ 941 /* FIXME: do we need to clean up reliable_mq somehow/somewhere? */
942 return GNUNET_OK; 942 return GNUNET_OK;
@@ -949,7 +949,7 @@ handle_mesh_ring_message (void *cls,
949 ch->status = CS_CALLEE_RINGING; 949 ch->status = CS_CALLEE_RINGING;
950 ch->remote_line = ntohl (msg->source_line); 950 ch->remote_line = ntohl (msg->source_line);
951 ch->channel_reliable = channel; 951 ch->channel_reliable = channel;
952 ch->reliable_mq = GNUNET_MESH_mq_create (ch->channel_reliable); 952 ch->reliable_mq = GNUNET_CADET_mq_create (ch->channel_reliable);
953 ch->cid = line->cid_gen++; 953 ch->cid = line->cid_gen++;
954 ch->target = msg->source; 954 ch->target = msg->source;
955 *channel_ctx = ch; 955 *channel_ctx = ch;
@@ -969,7 +969,7 @@ handle_mesh_ring_message (void *cls,
969 969
970 970
971/** 971/**
972 * Function to handle a hangup message incoming over mesh 972 * Function to handle a hangup message incoming over cadet
973 * 973 *
974 * @param cls closure, NULL 974 * @param cls closure, NULL
975 * @param channel the channel over which the message arrived 975 * @param channel the channel over which the message arrived
@@ -979,8 +979,8 @@ handle_mesh_ring_message (void *cls,
979 * @return #GNUNET_OK 979 * @return #GNUNET_OK
980 */ 980 */
981static int 981static int
982handle_mesh_hangup_message (void *cls, 982handle_cadet_hangup_message (void *cls,
983 struct GNUNET_MESH_Channel *channel, 983 struct GNUNET_CADET_Channel *channel,
984 void **channel_ctx, 984 void **channel_ctx,
985 const struct GNUNET_MessageHeader *message) 985 const struct GNUNET_MessageHeader *message)
986{ 986{
@@ -1001,8 +1001,8 @@ handle_mesh_hangup_message (void *cls,
1001 hup.header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP); 1001 hup.header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP);
1002 hup.cid = ch->cid; 1002 hup.cid = ch->cid;
1003 status = ch->status; 1003 status = ch->status;
1004 GNUNET_MESH_receive_done (channel); 1004 GNUNET_CADET_receive_done (channel);
1005 destroy_line_mesh_channels (ch); 1005 destroy_line_cadet_channels (ch);
1006 switch (status) 1006 switch (status)
1007 { 1007 {
1008 case CS_CALLEE_RINGING: 1008 case CS_CALLEE_RINGING:
@@ -1027,7 +1027,7 @@ handle_mesh_hangup_message (void *cls,
1027 1027
1028 1028
1029/** 1029/**
1030 * Function to handle a pickup message incoming over mesh 1030 * Function to handle a pickup message incoming over cadet
1031 * 1031 *
1032 * @param cls closure, NULL 1032 * @param cls closure, NULL
1033 * @param channel the channel over which the message arrived 1033 * @param channel the channel over which the message arrived
@@ -1037,8 +1037,8 @@ handle_mesh_hangup_message (void *cls,
1037 * @return #GNUNET_OK 1037 * @return #GNUNET_OK
1038 */ 1038 */
1039static int 1039static int
1040handle_mesh_pickup_message (void *cls, 1040handle_cadet_pickup_message (void *cls,
1041 struct GNUNET_MESH_Channel *channel, 1041 struct GNUNET_CADET_Channel *channel,
1042 void **channel_ctx, 1042 void **channel_ctx,
1043 const struct GNUNET_MessageHeader *message) 1043 const struct GNUNET_MessageHeader *message)
1044{ 1044{
@@ -1053,17 +1053,17 @@ handle_mesh_pickup_message (void *cls,
1053 return GNUNET_SYSERR; 1053 return GNUNET_SYSERR;
1054 } 1054 }
1055 line = ch->line; 1055 line = ch->line;
1056 GNUNET_MESH_receive_done (channel); 1056 GNUNET_CADET_receive_done (channel);
1057 switch (ch->status) 1057 switch (ch->status)
1058 { 1058 {
1059 case CS_CALLEE_RINGING: 1059 case CS_CALLEE_RINGING:
1060 case CS_CALLEE_CONNECTED: 1060 case CS_CALLEE_CONNECTED:
1061 GNUNET_break_op (0); 1061 GNUNET_break_op (0);
1062 destroy_line_mesh_channels (ch); 1062 destroy_line_cadet_channels (ch);
1063 return GNUNET_SYSERR; 1063 return GNUNET_SYSERR;
1064 case CS_CALLEE_SHUTDOWN: 1064 case CS_CALLEE_SHUTDOWN:
1065 GNUNET_break_op (0); 1065 GNUNET_break_op (0);
1066 destroy_line_mesh_channels (ch); 1066 destroy_line_cadet_channels (ch);
1067 break; 1067 break;
1068 case CS_CALLER_CALLING: 1068 case CS_CALLER_CALLING:
1069 ch->status = CS_CALLER_CONNECTED; 1069 ch->status = CS_CALLER_CONNECTED;
@@ -1085,11 +1085,11 @@ handle_mesh_pickup_message (void *cls,
1085 line->client, 1085 line->client,
1086 &pick.header, 1086 &pick.header,
1087 GNUNET_NO); 1087 GNUNET_NO);
1088 ch->channel_unreliable = GNUNET_MESH_channel_create (mesh, 1088 ch->channel_unreliable = GNUNET_CADET_channel_create (cadet,
1089 ch, 1089 ch,
1090 &ch->target, 1090 &ch->target,
1091 GNUNET_APPLICATION_TYPE_CONVERSATION_AUDIO, 1091 GNUNET_APPLICATION_TYPE_CONVERSATION_AUDIO,
1092 GNUNET_MESH_OPTION_DEFAULT); 1092 GNUNET_CADET_OPTION_DEFAULT);
1093 if (NULL == ch->channel_unreliable) 1093 if (NULL == ch->channel_unreliable)
1094 { 1094 {
1095 GNUNET_break (0); 1095 GNUNET_break (0);
@@ -1099,7 +1099,7 @@ handle_mesh_pickup_message (void *cls,
1099 1099
1100 1100
1101/** 1101/**
1102 * Function to handle a suspend message incoming over mesh 1102 * Function to handle a suspend message incoming over cadet
1103 * 1103 *
1104 * @param cls closure, NULL 1104 * @param cls closure, NULL
1105 * @param channel the channel over which the message arrived 1105 * @param channel the channel over which the message arrived
@@ -1109,8 +1109,8 @@ handle_mesh_pickup_message (void *cls,
1109 * @return #GNUNET_OK 1109 * @return #GNUNET_OK
1110 */ 1110 */
1111static int 1111static int
1112handle_mesh_suspend_message (void *cls, 1112handle_cadet_suspend_message (void *cls,
1113 struct GNUNET_MESH_Channel *channel, 1113 struct GNUNET_CADET_Channel *channel,
1114 void **channel_ctx, 1114 void **channel_ctx,
1115 const struct GNUNET_MessageHeader *message) 1115 const struct GNUNET_MessageHeader *message)
1116{ 1116{
@@ -1128,7 +1128,7 @@ handle_mesh_suspend_message (void *cls,
1128 suspend.header.size = htons (sizeof (suspend)); 1128 suspend.header.size = htons (sizeof (suspend));
1129 suspend.header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND); 1129 suspend.header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND);
1130 suspend.cid = ch->cid; 1130 suspend.cid = ch->cid;
1131 GNUNET_MESH_receive_done (channel); 1131 GNUNET_CADET_receive_done (channel);
1132 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1132 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1133 "Suspending channel CID: %u(%u:%u)\n", 1133 "Suspending channel CID: %u(%u:%u)\n",
1134 ch->cid, ch->remote_line, line->local_line); 1134 ch->cid, ch->remote_line, line->local_line);
@@ -1160,7 +1160,7 @@ handle_mesh_suspend_message (void *cls,
1160 1160
1161 1161
1162/** 1162/**
1163 * Function to handle a resume message incoming over mesh 1163 * Function to handle a resume message incoming over cadet
1164 * 1164 *
1165 * @param cls closure, NULL 1165 * @param cls closure, NULL
1166 * @param channel the channel over which the message arrived 1166 * @param channel the channel over which the message arrived
@@ -1170,8 +1170,8 @@ handle_mesh_suspend_message (void *cls,
1170 * @return #GNUNET_OK 1170 * @return #GNUNET_OK
1171 */ 1171 */
1172static int 1172static int
1173handle_mesh_resume_message (void *cls, 1173handle_cadet_resume_message (void *cls,
1174 struct GNUNET_MESH_Channel *channel, 1174 struct GNUNET_CADET_Channel *channel,
1175 void **channel_ctx, 1175 void **channel_ctx,
1176 const struct GNUNET_MessageHeader *message) 1176 const struct GNUNET_MessageHeader *message)
1177{ 1177{
@@ -1189,7 +1189,7 @@ handle_mesh_resume_message (void *cls,
1189 resume.header.size = htons (sizeof (resume)); 1189 resume.header.size = htons (sizeof (resume));
1190 resume.header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME); 1190 resume.header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME);
1191 resume.cid = ch->cid; 1191 resume.cid = ch->cid;
1192 GNUNET_MESH_receive_done (channel); 1192 GNUNET_CADET_receive_done (channel);
1193 if (GNUNET_YES != ch->suspended_remote) 1193 if (GNUNET_YES != ch->suspended_remote)
1194 { 1194 {
1195 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1195 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1224,7 +1224,7 @@ handle_mesh_resume_message (void *cls,
1224 1224
1225 1225
1226/** 1226/**
1227 * Function to handle an audio message incoming over mesh 1227 * Function to handle an audio message incoming over cadet
1228 * 1228 *
1229 * @param cls closure, NULL 1229 * @param cls closure, NULL
1230 * @param channel the channel over which the message arrived 1230 * @param channel the channel over which the message arrived
@@ -1234,25 +1234,25 @@ handle_mesh_resume_message (void *cls,
1234 * @return #GNUNET_OK 1234 * @return #GNUNET_OK
1235 */ 1235 */
1236static int 1236static int
1237handle_mesh_audio_message (void *cls, 1237handle_cadet_audio_message (void *cls,
1238 struct GNUNET_MESH_Channel *channel, 1238 struct GNUNET_CADET_Channel *channel,
1239 void **channel_ctx, 1239 void **channel_ctx,
1240 const struct GNUNET_MessageHeader *message) 1240 const struct GNUNET_MessageHeader *message)
1241{ 1241{
1242 const struct MeshAudioMessage *msg; 1242 const struct CadetAudioMessage *msg;
1243 struct Channel *ch = *channel_ctx; 1243 struct Channel *ch = *channel_ctx;
1244 struct Line *line; 1244 struct Line *line;
1245 struct GNUNET_PeerIdentity sender; 1245 struct GNUNET_PeerIdentity sender;
1246 size_t msize = ntohs (message->size) - sizeof (struct MeshAudioMessage); 1246 size_t msize = ntohs (message->size) - sizeof (struct CadetAudioMessage);
1247 char buf[msize + sizeof (struct ClientAudioMessage)]; 1247 char buf[msize + sizeof (struct ClientAudioMessage)];
1248 struct ClientAudioMessage *cam; 1248 struct ClientAudioMessage *cam;
1249 const union GNUNET_MESH_ChannelInfo *info; 1249 const union GNUNET_CADET_ChannelInfo *info;
1250 1250
1251 msg = (const struct MeshAudioMessage *) message; 1251 msg = (const struct CadetAudioMessage *) message;
1252 if (NULL == ch) 1252 if (NULL == ch)
1253 { 1253 {
1254 info = GNUNET_MESH_channel_get_info (channel, 1254 info = GNUNET_CADET_channel_get_info (channel,
1255 GNUNET_MESH_OPTION_PEER); 1255 GNUNET_CADET_OPTION_PEER);
1256 if (NULL == info) 1256 if (NULL == info)
1257 { 1257 {
1258 GNUNET_break (0); 1258 GNUNET_break (0);
@@ -1293,13 +1293,13 @@ handle_mesh_audio_message (void *cls,
1293 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1293 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1294 "Received %u bytes of AUDIO data on suspended channel CID %u:(%u:%u); dropping\n", 1294 "Received %u bytes of AUDIO data on suspended channel CID %u:(%u:%u); dropping\n",
1295 msize, ch->cid, ch->remote_line, line->local_line); 1295 msize, ch->cid, ch->remote_line, line->local_line);
1296 GNUNET_MESH_receive_done (channel); 1296 GNUNET_CADET_receive_done (channel);
1297 return GNUNET_OK; 1297 return GNUNET_OK;
1298 } 1298 }
1299 ch->channel_unreliable = channel; 1299 ch->channel_unreliable = channel;
1300 *channel_ctx = ch; 1300 *channel_ctx = ch;
1301 } 1301 }
1302 GNUNET_MESH_receive_done (channel); 1302 GNUNET_CADET_receive_done (channel);
1303 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1303 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1304 "Forwarding %u bytes of AUDIO data to client CID %u:(%u:%u)\n", 1304 "Forwarding %u bytes of AUDIO data to client CID %u:(%u:%u)\n",
1305 msize, ch->cid, ch->remote_line, ch->line->local_line); 1305 msize, ch->cid, ch->remote_line, ch->line->local_line);
@@ -1330,9 +1330,9 @@ handle_mesh_audio_message (void *cls,
1330 */ 1330 */
1331static void * 1331static void *
1332inbound_channel (void *cls, 1332inbound_channel (void *cls,
1333 struct GNUNET_MESH_Channel *channel, 1333 struct GNUNET_CADET_Channel *channel,
1334 const struct GNUNET_PeerIdentity *initiator, 1334 const struct GNUNET_PeerIdentity *initiator,
1335 uint32_t port, enum GNUNET_MESH_ChannelOption options) 1335 uint32_t port, enum GNUNET_CADET_ChannelOption options)
1336{ 1336{
1337 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1337 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1338 _("Received incoming channel on port %u\n"), 1338 _("Received incoming channel on port %u\n"),
@@ -1345,7 +1345,7 @@ inbound_channel (void *cls,
1345 * Function called whenever an inbound channel is destroyed. Should clean up 1345 * Function called whenever an inbound channel is destroyed. Should clean up
1346 * any associated state. 1346 * any associated state.
1347 * 1347 *
1348 * @param cls closure (set from #GNUNET_MESH_connect) 1348 * @param cls closure (set from #GNUNET_CADET_connect)
1349 * @param channel connection to the other end (henceforth invalid) 1349 * @param channel connection to the other end (henceforth invalid)
1350 * @param channel_ctx place where local state associated 1350 * @param channel_ctx place where local state associated
1351 * with the channel is stored; 1351 * with the channel is stored;
@@ -1353,7 +1353,7 @@ inbound_channel (void *cls,
1353 */ 1353 */
1354static void 1354static void
1355inbound_end (void *cls, 1355inbound_end (void *cls,
1356 const struct GNUNET_MESH_Channel *channel, 1356 const struct GNUNET_CADET_Channel *channel,
1357 void *channel_ctx) 1357 void *channel_ctx)
1358{ 1358{
1359 struct Channel *ch = channel_ctx; 1359 struct Channel *ch = channel_ctx;
@@ -1363,7 +1363,7 @@ inbound_end (void *cls,
1363 if (NULL == ch) 1363 if (NULL == ch)
1364 { 1364 {
1365 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1365 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1366 "Mesh channel destroyed, but channel is unknown to us\n"); 1366 "Cadet channel destroyed, but channel is unknown to us\n");
1367 return; 1367 return;
1368 } 1368 }
1369 line = ch->line; 1369 line = ch->line;
@@ -1371,7 +1371,7 @@ inbound_end (void *cls,
1371 { 1371 {
1372 if (NULL != ch->unreliable_mth) 1372 if (NULL != ch->unreliable_mth)
1373 { 1373 {
1374 GNUNET_MESH_notify_transmit_ready_cancel (ch->unreliable_mth); 1374 GNUNET_CADET_notify_transmit_ready_cancel (ch->unreliable_mth);
1375 ch->unreliable_mth = NULL; 1375 ch->unreliable_mth = NULL;
1376 } 1376 }
1377 ch->channel_unreliable = NULL; 1377 ch->channel_unreliable = NULL;
@@ -1387,7 +1387,7 @@ inbound_end (void *cls,
1387 ch->channel_reliable = NULL; 1387 ch->channel_reliable = NULL;
1388 1388
1389 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1389 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1390 "Mesh channel destroyed by mesh in state %d\n", 1390 "Cadet channel destroyed by cadet in state %d\n",
1391 ch->status); 1391 ch->status);
1392 hup.header.size = htons (sizeof (hup)); 1392 hup.header.size = htons (sizeof (hup));
1393 hup.header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP); 1393 hup.header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP);
@@ -1413,7 +1413,7 @@ inbound_end (void *cls,
1413 case CS_CALLER_SHUTDOWN: 1413 case CS_CALLER_SHUTDOWN:
1414 break; 1414 break;
1415 } 1415 }
1416 destroy_line_mesh_channels (ch); 1416 destroy_line_cadet_channels (ch);
1417} 1417}
1418 1418
1419 1419
@@ -1441,7 +1441,7 @@ handle_client_disconnect (void *cls,
1441 lines_tail, 1441 lines_tail,
1442 line); 1442 line);
1443 while (NULL != line->channel_head) 1443 while (NULL != line->channel_head)
1444 destroy_line_mesh_channels (line->channel_head); 1444 destroy_line_cadet_channels (line->channel_head);
1445 GNUNET_free (line); 1445 GNUNET_free (line);
1446} 1446}
1447 1447
@@ -1462,17 +1462,17 @@ do_shutdown (void *cls,
1462 while (NULL != (line = lines_head)) 1462 while (NULL != (line = lines_head))
1463 { 1463 {
1464 while (NULL != (ch = line->channel_head)) 1464 while (NULL != (ch = line->channel_head))
1465 destroy_line_mesh_channels (ch); 1465 destroy_line_cadet_channels (ch);
1466 GNUNET_CONTAINER_DLL_remove (lines_head, 1466 GNUNET_CONTAINER_DLL_remove (lines_head,
1467 lines_tail, 1467 lines_tail,
1468 line); 1468 line);
1469 GNUNET_SERVER_client_set_user_context (line->client, (void *) NULL); 1469 GNUNET_SERVER_client_set_user_context (line->client, (void *) NULL);
1470 GNUNET_free (line); 1470 GNUNET_free (line);
1471 } 1471 }
1472 if (NULL != mesh) 1472 if (NULL != cadet)
1473 { 1473 {
1474 GNUNET_MESH_disconnect (mesh); 1474 GNUNET_CADET_disconnect (cadet);
1475 mesh = NULL; 1475 cadet = NULL;
1476 } 1476 }
1477 if (NULL != nc) 1477 if (NULL != nc)
1478 { 1478 {
@@ -1518,23 +1518,23 @@ run (void *cls,
1518 0}, 1518 0},
1519 {NULL, NULL, 0, 0} 1519 {NULL, NULL, 0, 0}
1520 }; 1520 };
1521 static struct GNUNET_MESH_MessageHandler mesh_handlers[] = { 1521 static struct GNUNET_CADET_MessageHandler cadet_handlers[] = {
1522 {&handle_mesh_ring_message, 1522 {&handle_cadet_ring_message,
1523 GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_RING, 1523 GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RING,
1524 sizeof (struct MeshPhoneRingMessage)}, 1524 sizeof (struct CadetPhoneRingMessage)},
1525 {&handle_mesh_hangup_message, 1525 {&handle_cadet_hangup_message,
1526 GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_HANG_UP, 1526 GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_HANG_UP,
1527 sizeof (struct MeshPhoneHangupMessage)}, 1527 sizeof (struct CadetPhoneHangupMessage)},
1528 {&handle_mesh_pickup_message, 1528 {&handle_cadet_pickup_message,
1529 GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_PICK_UP, 1529 GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_PICK_UP,
1530 sizeof (struct MeshPhonePickupMessage)}, 1530 sizeof (struct CadetPhonePickupMessage)},
1531 {&handle_mesh_suspend_message, 1531 {&handle_cadet_suspend_message,
1532 GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_SUSPEND, 1532 GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_SUSPEND,
1533 sizeof (struct MeshPhoneSuspendMessage)}, 1533 sizeof (struct CadetPhoneSuspendMessage)},
1534 {&handle_mesh_resume_message, 1534 {&handle_cadet_resume_message,
1535 GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_RESUME, 1535 GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RESUME,
1536 sizeof (struct MeshPhoneResumeMessage)}, 1536 sizeof (struct CadetPhoneResumeMessage)},
1537 {&handle_mesh_audio_message, GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_AUDIO, 1537 {&handle_cadet_audio_message, GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_AUDIO,
1538 0}, 1538 0},
1539 {NULL, 0, 0} 1539 {NULL, 0, 0}
1540 }; 1540 };
@@ -1548,14 +1548,14 @@ run (void *cls,
1548 GNUNET_assert (GNUNET_OK == 1548 GNUNET_assert (GNUNET_OK ==
1549 GNUNET_CRYPTO_get_peer_identity (cfg, 1549 GNUNET_CRYPTO_get_peer_identity (cfg,
1550 &my_identity)); 1550 &my_identity));
1551 mesh = GNUNET_MESH_connect (cfg, 1551 cadet = GNUNET_CADET_connect (cfg,
1552 NULL, 1552 NULL,
1553 &inbound_channel, 1553 &inbound_channel,
1554 &inbound_end, 1554 &inbound_end,
1555 mesh_handlers, 1555 cadet_handlers,
1556 ports); 1556 ports);
1557 1557
1558 if (NULL == mesh) 1558 if (NULL == cadet)
1559 { 1559 {
1560 GNUNET_break (0); 1560 GNUNET_break (0);
1561 GNUNET_SCHEDULER_shutdown (); 1561 GNUNET_SCHEDULER_shutdown ();
diff --git a/src/dns/dnsstub.c b/src/dns/dnsstub.c
index 51d6c2c21..1c45355a1 100644
--- a/src/dns/dnsstub.c
+++ b/src/dns/dnsstub.c
@@ -100,7 +100,7 @@ struct GNUNET_DNSSTUB_Context
100 100
101 /** 101 /**
102 * IP address to use for the DNS server if we are a DNS exit service 102 * IP address to use for the DNS server if we are a DNS exit service
103 * (for VPN via mesh); otherwise NULL. 103 * (for VPN via cadet); otherwise NULL.
104 */ 104 */
105 char *dns_exit; 105 char *dns_exit;
106}; 106};
diff --git a/src/exit/exit.h b/src/exit/exit.h
index b4cea4c23..b243204a3 100644
--- a/src/exit/exit.h
+++ b/src/exit/exit.h
@@ -20,7 +20,7 @@
20 20
21/** 21/**
22 * @file exit/exit.h 22 * @file exit/exit.h
23 * @brief format for mesh messages exchanged between VPN service and exit daemon 23 * @brief format for cadet messages exchanged between VPN service and exit daemon
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
26#ifndef EXIT_H 26#ifndef EXIT_H
@@ -31,7 +31,7 @@
31GNUNET_NETWORK_STRUCT_BEGIN 31GNUNET_NETWORK_STRUCT_BEGIN
32 32
33/** 33/**
34 * Message send via mesh to an exit daemon to initiate forwarding of 34 * Message send via cadet to an exit daemon to initiate forwarding of
35 * TCP data to a local service. 35 * TCP data to a local service.
36 */ 36 */
37struct GNUNET_EXIT_TcpServiceStartMessage 37struct GNUNET_EXIT_TcpServiceStartMessage
@@ -62,7 +62,7 @@ struct GNUNET_EXIT_TcpServiceStartMessage
62 62
63 63
64/** 64/**
65 * Message send via mesh to an exit daemon to initiate forwarding of 65 * Message send via cadet to an exit daemon to initiate forwarding of
66 * TCP data to the Internet. 66 * TCP data to the Internet.
67 */ 67 */
68struct GNUNET_EXIT_TcpInternetStartMessage 68struct GNUNET_EXIT_TcpInternetStartMessage
@@ -91,7 +91,7 @@ struct GNUNET_EXIT_TcpInternetStartMessage
91 91
92 92
93/** 93/**
94 * Message send via mesh between VPN and entry and an exit daemon to 94 * Message send via cadet between VPN and entry and an exit daemon to
95 * transmit TCP data between the VPN entry and an exit session. This 95 * transmit TCP data between the VPN entry and an exit session. This
96 * format is used for both Internet-exits and service-exits and 96 * format is used for both Internet-exits and service-exits and
97 * in both directions (VPN to exit and exit to VPN). 97 * in both directions (VPN to exit and exit to VPN).
@@ -119,7 +119,7 @@ struct GNUNET_EXIT_TcpDataMessage
119 119
120 120
121/** 121/**
122 * Message send via mesh to an exit daemon to send 122 * Message send via cadet to an exit daemon to send
123 * UDP data to a local service. 123 * UDP data to a local service.
124 */ 124 */
125struct GNUNET_EXIT_UdpServiceMessage 125struct GNUNET_EXIT_UdpServiceMessage
@@ -149,7 +149,7 @@ struct GNUNET_EXIT_UdpServiceMessage
149 149
150 150
151/** 151/**
152 * Message send via mesh to an exit daemon to forward 152 * Message send via cadet to an exit daemon to forward
153 * UDP data to the Internet. 153 * UDP data to the Internet.
154 */ 154 */
155struct GNUNET_EXIT_UdpInternetMessage 155struct GNUNET_EXIT_UdpInternetMessage
@@ -209,7 +209,7 @@ struct GNUNET_EXIT_UdpReplyMessage
209 209
210 210
211/** 211/**
212 * Message send via mesh to an exit daemon to send 212 * Message send via cadet to an exit daemon to send
213 * ICMP data to a local service. 213 * ICMP data to a local service.
214 */ 214 */
215struct GNUNET_EXIT_IcmpServiceMessage 215struct GNUNET_EXIT_IcmpServiceMessage
@@ -245,7 +245,7 @@ struct GNUNET_EXIT_IcmpServiceMessage
245 245
246 246
247/** 247/**
248 * Message send via mesh to an exit daemon to forward 248 * Message send via cadet to an exit daemon to forward
249 * ICMP data to the Internet. 249 * ICMP data to the Internet.
250 */ 250 */
251struct GNUNET_EXIT_IcmpInternetMessage 251struct GNUNET_EXIT_IcmpInternetMessage
@@ -280,7 +280,7 @@ struct GNUNET_EXIT_IcmpInternetMessage
280 280
281 281
282/** 282/**
283 * Message send via mesh to the vpn service to send 283 * Message send via cadet to the vpn service to send
284 * ICMP data to the VPN's TUN interface. 284 * ICMP data to the VPN's TUN interface.
285 */ 285 */
286struct GNUNET_EXIT_IcmpToVPNMessage 286struct GNUNET_EXIT_IcmpToVPNMessage
diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c
index c29638559..882c6a373 100644
--- a/src/exit/gnunet-daemon-exit.c
+++ b/src/exit/gnunet-daemon-exit.c
@@ -20,7 +20,7 @@
20 20
21/** 21/**
22 * @file exit/gnunet-daemon-exit.c 22 * @file exit/gnunet-daemon-exit.c
23 * @brief tool to allow IP traffic exit from the GNUnet mesh to the Internet 23 * @brief tool to allow IP traffic exit from the GNUnet cadet to the Internet
24 * @author Philipp Toelke 24 * @author Philipp Toelke
25 * @author Christian Grothoff 25 * @author Christian Grothoff
26 * 26 *
@@ -39,7 +39,7 @@
39#include "gnunet_protocols.h" 39#include "gnunet_protocols.h"
40#include "gnunet_applications.h" 40#include "gnunet_applications.h"
41#include "gnunet_dht_service.h" 41#include "gnunet_dht_service.h"
42#include "gnunet_mesh_service.h" 42#include "gnunet_cadet_service.h"
43#include "gnunet_dnsparser_lib.h" 43#include "gnunet_dnsparser_lib.h"
44#include "gnunet_dnsstub_lib.h" 44#include "gnunet_dnsstub_lib.h"
45#include "gnunet_statistics_service.h" 45#include "gnunet_statistics_service.h"
@@ -52,13 +52,13 @@
52 52
53 53
54/** 54/**
55 * Maximum path compression length for mesh regex announcing for IPv4 address 55 * Maximum path compression length for cadet regex announcing for IPv4 address
56 * based regex. 56 * based regex.
57 */ 57 */
58#define REGEX_MAX_PATH_LEN_IPV4 4 58#define REGEX_MAX_PATH_LEN_IPV4 4
59 59
60/** 60/**
61 * Maximum path compression length for mesh regex announcing for IPv6 address 61 * Maximum path compression length for cadet regex announcing for IPv6 address
62 * based regex. 62 * based regex.
63 */ 63 */
64#define REGEX_MAX_PATH_LEN_IPV6 8 64#define REGEX_MAX_PATH_LEN_IPV6 8
@@ -219,9 +219,9 @@ struct ChannelMessageQueue
219struct ChannelState 219struct ChannelState
220{ 220{
221 /** 221 /**
222 * Mesh channel that is used for this connection. 222 * Cadet channel that is used for this connection.
223 */ 223 */
224 struct GNUNET_MESH_Channel *channel; 224 struct GNUNET_CADET_Channel *channel;
225 225
226 /** 226 /**
227 * Who is the other end of this channel. 227 * Who is the other end of this channel.
@@ -232,7 +232,7 @@ struct ChannelState
232 /** 232 /**
233 * Active channel transmission request (or NULL). 233 * Active channel transmission request (or NULL).
234 */ 234 */
235 struct GNUNET_MESH_TransmitHandle *th; 235 struct GNUNET_CADET_TransmitHandle *th;
236 236
237 /** 237 /**
238 * #GNUNET_NO if this is a channel for TCP/UDP, 238 * #GNUNET_NO if this is a channel for TCP/UDP,
@@ -369,9 +369,9 @@ static struct in_addr exit_ipv4mask;
369static struct GNUNET_STATISTICS_Handle *stats; 369static struct GNUNET_STATISTICS_Handle *stats;
370 370
371/** 371/**
372 * The handle to mesh 372 * The handle to cadet
373 */ 373 */
374static struct GNUNET_MESH_Handle *mesh_handle; 374static struct GNUNET_CADET_Handle *cadet_handle;
375 375
376/** 376/**
377 * This hashmaps contains the mapping from peer, service-descriptor, 377 * This hashmaps contains the mapping from peer, service-descriptor,
@@ -462,7 +462,7 @@ static int ipv6_enabled;
462 462
463 463
464/** 464/**
465 * We got a reply from DNS for a request of a MESH channel. Send it 465 * We got a reply from DNS for a request of a CADET channel. Send it
466 * via the channel (after changing the request ID back). 466 * via the channel (after changing the request ID back).
467 * 467 *
468 * @param cls the 'struct ChannelState' 468 * @param cls the 'struct ChannelState'
@@ -471,7 +471,7 @@ static int ipv6_enabled;
471 * @return number of bytes written to buf 471 * @return number of bytes written to buf
472 */ 472 */
473static size_t 473static size_t
474transmit_reply_to_mesh (void *cls, 474transmit_reply_to_cadet (void *cls,
475 size_t size, 475 size_t size,
476 void *buf) 476 void *buf)
477{ 477{
@@ -528,31 +528,31 @@ process_dns_result (void *cls,
528 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 528 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
529 "Processing DNS result from stub resolver\n"); 529 "Processing DNS result from stub resolver\n");
530 GNUNET_assert (NULL == cls); 530 GNUNET_assert (NULL == cls);
531 /* Handle case that this is a reply to a request from a MESH DNS channel */ 531 /* Handle case that this is a reply to a request from a CADET DNS channel */
532 ts = channels[dns->id]; 532 ts = channels[dns->id];
533 if ( (NULL == ts) || 533 if ( (NULL == ts) ||
534 (ts->specifics.dns.rs != rs) ) 534 (ts->specifics.dns.rs != rs) )
535 return; 535 return;
536 LOG (GNUNET_ERROR_TYPE_DEBUG, 536 LOG (GNUNET_ERROR_TYPE_DEBUG,
537 "Got a response from the stub resolver for DNS request received via MESH!\n"); 537 "Got a response from the stub resolver for DNS request received via CADET!\n");
538 channels[dns->id] = NULL; 538 channels[dns->id] = NULL;
539 GNUNET_free_non_null (ts->specifics.dns.reply); 539 GNUNET_free_non_null (ts->specifics.dns.reply);
540 ts->specifics.dns.reply = GNUNET_malloc (r); 540 ts->specifics.dns.reply = GNUNET_malloc (r);
541 ts->specifics.dns.reply_length = r; 541 ts->specifics.dns.reply_length = r;
542 memcpy (ts->specifics.dns.reply, dns, r); 542 memcpy (ts->specifics.dns.reply, dns, r);
543 if (NULL != ts->th) 543 if (NULL != ts->th)
544 GNUNET_MESH_notify_transmit_ready_cancel (ts->th); 544 GNUNET_CADET_notify_transmit_ready_cancel (ts->th);
545 ts->th = GNUNET_MESH_notify_transmit_ready (ts->channel, 545 ts->th = GNUNET_CADET_notify_transmit_ready (ts->channel,
546 GNUNET_NO, 546 GNUNET_NO,
547 GNUNET_TIME_UNIT_FOREVER_REL, 547 GNUNET_TIME_UNIT_FOREVER_REL,
548 sizeof (struct GNUNET_MessageHeader) + r, 548 sizeof (struct GNUNET_MessageHeader) + r,
549 &transmit_reply_to_mesh, 549 &transmit_reply_to_cadet,
550 ts); 550 ts);
551} 551}
552 552
553 553
554/** 554/**
555 * Process a request via mesh to perform a DNS query. 555 * Process a request via cadet to perform a DNS query.
556 * 556 *
557 * @param cls closure, NULL 557 * @param cls closure, NULL
558 * @param channel connection to the other end 558 * @param channel connection to the other end
@@ -563,7 +563,7 @@ process_dns_result (void *cls,
563 * #GNUNET_SYSERR to close it (signal serious error) 563 * #GNUNET_SYSERR to close it (signal serious error)
564 */ 564 */
565static int 565static int
566receive_dns_request (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Channel *channel, 566receive_dns_request (void *cls GNUNET_UNUSED, struct GNUNET_CADET_Channel *channel,
567 void **channel_ctx, 567 void **channel_ctx,
568 const struct GNUNET_MessageHeader *message) 568 const struct GNUNET_MessageHeader *message)
569{ 569{
@@ -807,7 +807,7 @@ store_service (struct GNUNET_CONTAINER_MultiHashMap *service_map,
807 807
808 808
809/** 809/**
810 * MESH is ready to receive a message for the channel. Transmit it. 810 * CADET is ready to receive a message for the channel. Transmit it.
811 * 811 *
812 * @param cls the 'struct ChannelState'. 812 * @param cls the 'struct ChannelState'.
813 * @param size number of bytes available in buf 813 * @param size number of bytes available in buf
@@ -818,7 +818,7 @@ static size_t
818send_to_peer_notify_callback (void *cls, size_t size, void *buf) 818send_to_peer_notify_callback (void *cls, size_t size, void *buf)
819{ 819{
820 struct ChannelState *s = cls; 820 struct ChannelState *s = cls;
821 struct GNUNET_MESH_Channel *channel = s->channel; 821 struct GNUNET_CADET_Channel *channel = s->channel;
822 struct ChannelMessageQueue *tnq; 822 struct ChannelMessageQueue *tnq;
823 823
824 s->th = NULL; 824 s->th = NULL;
@@ -827,7 +827,7 @@ send_to_peer_notify_callback (void *cls, size_t size, void *buf)
827 return 0; 827 return 0;
828 if (0 == size) 828 if (0 == size)
829 { 829 {
830 s->th = GNUNET_MESH_notify_transmit_ready (channel, 830 s->th = GNUNET_CADET_notify_transmit_ready (channel,
831 GNUNET_NO /* corking */, 831 GNUNET_NO /* corking */,
832 GNUNET_TIME_UNIT_FOREVER_REL, 832 GNUNET_TIME_UNIT_FOREVER_REL,
833 tnq->len, 833 tnq->len,
@@ -843,36 +843,36 @@ send_to_peer_notify_callback (void *cls, size_t size, void *buf)
843 tnq); 843 tnq);
844 GNUNET_free (tnq); 844 GNUNET_free (tnq);
845 if (NULL != (tnq = s->specifics.tcp_udp.head)) 845 if (NULL != (tnq = s->specifics.tcp_udp.head))
846 s->th = GNUNET_MESH_notify_transmit_ready (channel, 846 s->th = GNUNET_CADET_notify_transmit_ready (channel,
847 GNUNET_NO /* corking */, 847 GNUNET_NO /* corking */,
848 GNUNET_TIME_UNIT_FOREVER_REL, 848 GNUNET_TIME_UNIT_FOREVER_REL,
849 tnq->len, 849 tnq->len,
850 &send_to_peer_notify_callback, 850 &send_to_peer_notify_callback,
851 s); 851 s);
852 GNUNET_STATISTICS_update (stats, 852 GNUNET_STATISTICS_update (stats,
853 gettext_noop ("# Bytes transmitted via mesh channels"), 853 gettext_noop ("# Bytes transmitted via cadet channels"),
854 size, GNUNET_NO); 854 size, GNUNET_NO);
855 return size; 855 return size;
856} 856}
857 857
858 858
859/** 859/**
860 * Send the given packet via the mesh channel. 860 * Send the given packet via the cadet channel.
861 * 861 *
862 * @param s channel destination 862 * @param s channel destination
863 * @param tnq message to queue 863 * @param tnq message to queue
864 */ 864 */
865static void 865static void
866send_packet_to_mesh_channel (struct ChannelState *s, 866send_packet_to_cadet_channel (struct ChannelState *s,
867 struct ChannelMessageQueue *tnq) 867 struct ChannelMessageQueue *tnq)
868{ 868{
869 struct GNUNET_MESH_Channel *mesh_channel; 869 struct GNUNET_CADET_Channel *cadet_channel;
870 870
871 mesh_channel = s->channel; 871 cadet_channel = s->channel;
872 GNUNET_assert (NULL != s); 872 GNUNET_assert (NULL != s);
873 GNUNET_CONTAINER_DLL_insert_tail (s->specifics.tcp_udp.head, s->specifics.tcp_udp.tail, tnq); 873 GNUNET_CONTAINER_DLL_insert_tail (s->specifics.tcp_udp.head, s->specifics.tcp_udp.tail, tnq);
874 if (NULL == s->th) 874 if (NULL == s->th)
875 s->th = GNUNET_MESH_notify_transmit_ready (mesh_channel, 875 s->th = GNUNET_CADET_notify_transmit_ready (cadet_channel,
876 GNUNET_NO /* cork */, 876 GNUNET_NO /* cork */,
877 GNUNET_TIME_UNIT_FOREVER_REL, 877 GNUNET_TIME_UNIT_FOREVER_REL,
878 tnq->len, 878 tnq->len,
@@ -1065,7 +1065,7 @@ icmp_from_helper (const struct GNUNET_TUN_IcmpHeader *icmp,
1065 memcpy (&i2v->icmp_header, 1065 memcpy (&i2v->icmp_header,
1066 icmp, 1066 icmp,
1067 pktlen); 1067 pktlen);
1068 send_packet_to_mesh_channel (state, tnq); 1068 send_packet_to_cadet_channel (state, tnq);
1069} 1069}
1070 1070
1071 1071
@@ -1142,7 +1142,7 @@ udp_from_helper (const struct GNUNET_TUN_UdpHeader *udp,
1142 memcpy (&urm[1], 1142 memcpy (&urm[1],
1143 &udp[1], 1143 &udp[1],
1144 pktlen - sizeof (struct GNUNET_TUN_UdpHeader)); 1144 pktlen - sizeof (struct GNUNET_TUN_UdpHeader));
1145 send_packet_to_mesh_channel (state, tnq); 1145 send_packet_to_cadet_channel (state, tnq);
1146} 1146}
1147 1147
1148 1148
@@ -1230,7 +1230,7 @@ tcp_from_helper (const struct GNUNET_TUN_TcpHeader *tcp,
1230 memcpy (&tdm->tcp_header, 1230 memcpy (&tdm->tcp_header,
1231 buf, 1231 buf,
1232 pktlen); 1232 pktlen);
1233 send_packet_to_mesh_channel (state, tnq); 1233 send_packet_to_cadet_channel (state, tnq);
1234} 1234}
1235 1235
1236 1236
@@ -1486,7 +1486,7 @@ setup_fresh_address (int af,
1486 * We are starting a fresh connection (TCP or UDP) and need 1486 * We are starting a fresh connection (TCP or UDP) and need
1487 * to pick a source port and IP address (within the correct 1487 * to pick a source port and IP address (within the correct
1488 * range and address family) to associate replies with the 1488 * range and address family) to associate replies with the
1489 * connection / correct mesh channel. This function generates 1489 * connection / correct cadet channel. This function generates
1490 * a "fresh" source IP and source port number for a connection 1490 * a "fresh" source IP and source port number for a connection
1491 * After picking a good source address, this function sets up 1491 * After picking a good source address, this function sets up
1492 * the state in the 'connections_map' and 'connections_heap' 1492 * the state in the 'connections_map' and 'connections_heap'
@@ -1549,7 +1549,7 @@ setup_state_record (struct ChannelState *state)
1549 s = GNUNET_CONTAINER_heap_remove_root (connections_heap); 1549 s = GNUNET_CONTAINER_heap_remove_root (connections_heap);
1550 GNUNET_assert (state != s); 1550 GNUNET_assert (state != s);
1551 s->specifics.tcp_udp.heap_node = NULL; 1551 s->specifics.tcp_udp.heap_node = NULL;
1552 GNUNET_MESH_channel_destroy (s->channel); 1552 GNUNET_CADET_channel_destroy (s->channel);
1553 GNUNET_assert (GNUNET_OK == 1553 GNUNET_assert (GNUNET_OK ==
1554 GNUNET_CONTAINER_multihashmap_remove (connections_map, 1554 GNUNET_CONTAINER_multihashmap_remove (connections_map,
1555 &s->specifics.tcp_udp.state_key, 1555 &s->specifics.tcp_udp.state_key,
@@ -1833,7 +1833,7 @@ send_tcp_packet_via_tun (const struct SocketAddress *destination_address,
1833 1833
1834 1834
1835/** 1835/**
1836 * Process a request via mesh to send a request to a TCP service 1836 * Process a request via cadet to send a request to a TCP service
1837 * offered by this system. 1837 * offered by this system.
1838 * 1838 *
1839 * @param cls closure, NULL 1839 * @param cls closure, NULL
@@ -1845,7 +1845,7 @@ send_tcp_packet_via_tun (const struct SocketAddress *destination_address,
1845 */ 1845 */
1846static int 1846static int
1847receive_tcp_service (void *cls, 1847receive_tcp_service (void *cls,
1848 struct GNUNET_MESH_Channel *channel, 1848 struct GNUNET_CADET_Channel *channel,
1849 void **channel_ctx, 1849 void **channel_ctx,
1850 const struct GNUNET_MessageHeader *message) 1850 const struct GNUNET_MessageHeader *message)
1851{ 1851{
@@ -1869,10 +1869,10 @@ receive_tcp_service (void *cls,
1869 state->is_dns = GNUNET_NO; 1869 state->is_dns = GNUNET_NO;
1870 } 1870 }
1871 GNUNET_STATISTICS_update (stats, 1871 GNUNET_STATISTICS_update (stats,
1872 gettext_noop ("# TCP service creation requests received via mesh"), 1872 gettext_noop ("# TCP service creation requests received via cadet"),
1873 1, GNUNET_NO); 1873 1, GNUNET_NO);
1874 GNUNET_STATISTICS_update (stats, 1874 GNUNET_STATISTICS_update (stats,
1875 gettext_noop ("# Bytes received from MESH"), 1875 gettext_noop ("# Bytes received from CADET"),
1876 pkt_len, GNUNET_NO); 1876 pkt_len, GNUNET_NO);
1877 /* check that we got at least a valid header */ 1877 /* check that we got at least a valid header */
1878 if (pkt_len < sizeof (struct GNUNET_EXIT_TcpServiceStartMessage)) 1878 if (pkt_len < sizeof (struct GNUNET_EXIT_TcpServiceStartMessage))
@@ -1937,7 +1937,7 @@ receive_tcp_service (void *cls,
1937 * GNUNET_SYSERR to close it (signal serious error) 1937 * GNUNET_SYSERR to close it (signal serious error)
1938 */ 1938 */
1939static int 1939static int
1940receive_tcp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Channel *channel, 1940receive_tcp_remote (void *cls GNUNET_UNUSED, struct GNUNET_CADET_Channel *channel,
1941 void **channel_ctx GNUNET_UNUSED, 1941 void **channel_ctx GNUNET_UNUSED,
1942 const struct GNUNET_MessageHeader *message) 1942 const struct GNUNET_MessageHeader *message)
1943{ 1943{
@@ -1965,10 +1965,10 @@ receive_tcp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Channel *channel
1965 state->is_dns = GNUNET_NO; 1965 state->is_dns = GNUNET_NO;
1966 } 1966 }
1967 GNUNET_STATISTICS_update (stats, 1967 GNUNET_STATISTICS_update (stats,
1968 gettext_noop ("# Bytes received from MESH"), 1968 gettext_noop ("# Bytes received from CADET"),
1969 pkt_len, GNUNET_NO); 1969 pkt_len, GNUNET_NO);
1970 GNUNET_STATISTICS_update (stats, 1970 GNUNET_STATISTICS_update (stats,
1971 gettext_noop ("# TCP IP-exit creation requests received via mesh"), 1971 gettext_noop ("# TCP IP-exit creation requests received via cadet"),
1972 1, GNUNET_NO); 1972 1, GNUNET_NO);
1973 if (pkt_len < sizeof (struct GNUNET_EXIT_TcpInternetStartMessage)) 1973 if (pkt_len < sizeof (struct GNUNET_EXIT_TcpInternetStartMessage))
1974 { 1974 {
@@ -2061,7 +2061,7 @@ receive_tcp_remote (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Channel *channel
2061 * #GNUNET_SYSERR to close it (signal serious error) 2061 * #GNUNET_SYSERR to close it (signal serious error)
2062 */ 2062 */
2063static int 2063static int
2064receive_tcp_data (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Channel *channel, 2064receive_tcp_data (void *cls GNUNET_UNUSED, struct GNUNET_CADET_Channel *channel,
2065 void **channel_ctx GNUNET_UNUSED, 2065 void **channel_ctx GNUNET_UNUSED,
2066 const struct GNUNET_MessageHeader *message) 2066 const struct GNUNET_MessageHeader *message)
2067{ 2067{
@@ -2070,10 +2070,10 @@ receive_tcp_data (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Channel *channel,
2070 uint16_t pkt_len = ntohs (message->size); 2070 uint16_t pkt_len = ntohs (message->size);
2071 2071
2072 GNUNET_STATISTICS_update (stats, 2072 GNUNET_STATISTICS_update (stats,
2073 gettext_noop ("# Bytes received from MESH"), 2073 gettext_noop ("# Bytes received from CADET"),
2074 pkt_len, GNUNET_NO); 2074 pkt_len, GNUNET_NO);
2075 GNUNET_STATISTICS_update (stats, 2075 GNUNET_STATISTICS_update (stats,
2076 gettext_noop ("# TCP data requests received via mesh"), 2076 gettext_noop ("# TCP data requests received via cadet"),
2077 1, GNUNET_NO); 2077 1, GNUNET_NO);
2078 if (pkt_len < sizeof (struct GNUNET_EXIT_TcpDataMessage)) 2078 if (pkt_len < sizeof (struct GNUNET_EXIT_TcpDataMessage))
2079 { 2079 {
@@ -2294,7 +2294,7 @@ make_up_icmpv6_payload (struct ChannelState *state,
2294 */ 2294 */
2295static int 2295static int
2296receive_icmp_remote (void *cls, 2296receive_icmp_remote (void *cls,
2297 struct GNUNET_MESH_Channel *channel, 2297 struct GNUNET_CADET_Channel *channel,
2298 void **channel_ctx, 2298 void **channel_ctx,
2299 const struct GNUNET_MessageHeader *message) 2299 const struct GNUNET_MessageHeader *message)
2300{ 2300{
@@ -2318,10 +2318,10 @@ receive_icmp_remote (void *cls,
2318 state->is_dns = GNUNET_NO; 2318 state->is_dns = GNUNET_NO;
2319 } 2319 }
2320 GNUNET_STATISTICS_update (stats, 2320 GNUNET_STATISTICS_update (stats,
2321 gettext_noop ("# Bytes received from MESH"), 2321 gettext_noop ("# Bytes received from CADET"),
2322 pkt_len, GNUNET_NO); 2322 pkt_len, GNUNET_NO);
2323 GNUNET_STATISTICS_update (stats, 2323 GNUNET_STATISTICS_update (stats,
2324 gettext_noop ("# ICMP IP-exit requests received via mesh"), 2324 gettext_noop ("# ICMP IP-exit requests received via cadet"),
2325 1, GNUNET_NO); 2325 1, GNUNET_NO);
2326 if (pkt_len < sizeof (struct GNUNET_EXIT_IcmpInternetMessage)) 2326 if (pkt_len < sizeof (struct GNUNET_EXIT_IcmpInternetMessage))
2327 { 2327 {
@@ -2533,7 +2533,7 @@ make_up_icmp_service_payload (struct ChannelState *state,
2533 2533
2534 2534
2535/** 2535/**
2536 * Process a request via mesh to send ICMP data to a service 2536 * Process a request via cadet to send ICMP data to a service
2537 * offered by this system. 2537 * offered by this system.
2538 * 2538 *
2539 * @param cls closure, NULL 2539 * @param cls closure, NULL
@@ -2545,7 +2545,7 @@ make_up_icmp_service_payload (struct ChannelState *state,
2545 */ 2545 */
2546static int 2546static int
2547receive_icmp_service (void *cls, 2547receive_icmp_service (void *cls,
2548 struct GNUNET_MESH_Channel *channel, 2548 struct GNUNET_CADET_Channel *channel,
2549 void **channel_ctx, 2549 void **channel_ctx,
2550 const struct GNUNET_MessageHeader *message) 2550 const struct GNUNET_MessageHeader *message)
2551{ 2551{
@@ -2567,10 +2567,10 @@ receive_icmp_service (void *cls,
2567 state->is_dns = GNUNET_NO; 2567 state->is_dns = GNUNET_NO;
2568 } 2568 }
2569 GNUNET_STATISTICS_update (stats, 2569 GNUNET_STATISTICS_update (stats,
2570 gettext_noop ("# Bytes received from MESH"), 2570 gettext_noop ("# Bytes received from CADET"),
2571 pkt_len, GNUNET_NO); 2571 pkt_len, GNUNET_NO);
2572 GNUNET_STATISTICS_update (stats, 2572 GNUNET_STATISTICS_update (stats,
2573 gettext_noop ("# ICMP service requests received via mesh"), 2573 gettext_noop ("# ICMP service requests received via cadet"),
2574 1, GNUNET_NO); 2574 1, GNUNET_NO);
2575 /* check that we got at least a valid header */ 2575 /* check that we got at least a valid header */
2576 if (pkt_len < sizeof (struct GNUNET_EXIT_IcmpServiceMessage)) 2576 if (pkt_len < sizeof (struct GNUNET_EXIT_IcmpServiceMessage))
@@ -2833,7 +2833,7 @@ send_udp_packet_via_tun (const struct SocketAddress *destination_address,
2833 */ 2833 */
2834static int 2834static int
2835receive_udp_remote (void *cls, 2835receive_udp_remote (void *cls,
2836 struct GNUNET_MESH_Channel *channel, 2836 struct GNUNET_CADET_Channel *channel,
2837 void **channel_ctx, 2837 void **channel_ctx,
2838 const struct GNUNET_MessageHeader *message) 2838 const struct GNUNET_MessageHeader *message)
2839{ 2839{
@@ -2856,10 +2856,10 @@ receive_udp_remote (void *cls,
2856 state->is_dns = GNUNET_NO; 2856 state->is_dns = GNUNET_NO;
2857 } 2857 }
2858 GNUNET_STATISTICS_update (stats, 2858 GNUNET_STATISTICS_update (stats,
2859 gettext_noop ("# Bytes received from MESH"), 2859 gettext_noop ("# Bytes received from CADET"),
2860 pkt_len, GNUNET_NO); 2860 pkt_len, GNUNET_NO);
2861 GNUNET_STATISTICS_update (stats, 2861 GNUNET_STATISTICS_update (stats,
2862 gettext_noop ("# UDP IP-exit requests received via mesh"), 2862 gettext_noop ("# UDP IP-exit requests received via cadet"),
2863 1, GNUNET_NO); 2863 1, GNUNET_NO);
2864 if (pkt_len < sizeof (struct GNUNET_EXIT_UdpInternetMessage)) 2864 if (pkt_len < sizeof (struct GNUNET_EXIT_UdpInternetMessage))
2865 { 2865 {
@@ -2932,7 +2932,7 @@ receive_udp_remote (void *cls,
2932 2932
2933 2933
2934/** 2934/**
2935 * Process a request via mesh to send a request to a UDP service 2935 * Process a request via cadet to send a request to a UDP service
2936 * offered by this system. 2936 * offered by this system.
2937 * 2937 *
2938 * @param cls closure, NULL 2938 * @param cls closure, NULL
@@ -2944,7 +2944,7 @@ receive_udp_remote (void *cls,
2944 */ 2944 */
2945static int 2945static int
2946receive_udp_service (void *cls, 2946receive_udp_service (void *cls,
2947 struct GNUNET_MESH_Channel *channel, 2947 struct GNUNET_CADET_Channel *channel,
2948 void **channel_ctx, 2948 void **channel_ctx,
2949 const struct GNUNET_MessageHeader *message) 2949 const struct GNUNET_MessageHeader *message)
2950{ 2950{
@@ -2963,10 +2963,10 @@ receive_udp_service (void *cls,
2963 state->is_dns = GNUNET_NO; 2963 state->is_dns = GNUNET_NO;
2964 } 2964 }
2965 GNUNET_STATISTICS_update (stats, 2965 GNUNET_STATISTICS_update (stats,
2966 gettext_noop ("# Bytes received from MESH"), 2966 gettext_noop ("# Bytes received from CADET"),
2967 pkt_len, GNUNET_NO); 2967 pkt_len, GNUNET_NO);
2968 GNUNET_STATISTICS_update (stats, 2968 GNUNET_STATISTICS_update (stats,
2969 gettext_noop ("# UDP service requests received via mesh"), 2969 gettext_noop ("# UDP service requests received via cadet"),
2970 1, GNUNET_NO); 2970 1, GNUNET_NO);
2971 /* check that we got at least a valid header */ 2971 /* check that we got at least a valid header */
2972 if (pkt_len < sizeof (struct GNUNET_EXIT_UdpServiceMessage)) 2972 if (pkt_len < sizeof (struct GNUNET_EXIT_UdpServiceMessage))
@@ -3008,7 +3008,7 @@ receive_udp_service (void *cls,
3008 3008
3009 3009
3010/** 3010/**
3011 * Callback from GNUNET_MESH for new channels. 3011 * Callback from GNUNET_CADET for new channels.
3012 * 3012 *
3013 * @param cls closure 3013 * @param cls closure
3014 * @param channel new handle to the channel 3014 * @param channel new handle to the channel
@@ -3019,16 +3019,16 @@ receive_udp_service (void *cls,
3019 */ 3019 */
3020static void * 3020static void *
3021new_channel (void *cls, 3021new_channel (void *cls,
3022 struct GNUNET_MESH_Channel *channel, 3022 struct GNUNET_CADET_Channel *channel,
3023 const struct GNUNET_PeerIdentity *initiator, 3023 const struct GNUNET_PeerIdentity *initiator,
3024 uint32_t port, enum GNUNET_MESH_ChannelOption options) 3024 uint32_t port, enum GNUNET_CADET_ChannelOption options)
3025{ 3025{
3026 struct ChannelState *s = GNUNET_new (struct ChannelState); 3026 struct ChannelState *s = GNUNET_new (struct ChannelState);
3027 3027
3028 s->is_dns = GNUNET_SYSERR; 3028 s->is_dns = GNUNET_SYSERR;
3029 s->peer = *initiator; 3029 s->peer = *initiator;
3030 GNUNET_STATISTICS_update (stats, 3030 GNUNET_STATISTICS_update (stats,
3031 gettext_noop ("# Inbound MESH channels created"), 3031 gettext_noop ("# Inbound CADET channels created"),
3032 1, GNUNET_NO); 3032 1, GNUNET_NO);
3033 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3033 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3034 "Received inbound channel from `%s'\n", 3034 "Received inbound channel from `%s'\n",
@@ -3039,17 +3039,17 @@ new_channel (void *cls,
3039 3039
3040 3040
3041/** 3041/**
3042 * Function called by mesh whenever an inbound channel is destroyed. 3042 * Function called by cadet whenever an inbound channel is destroyed.
3043 * Should clean up any associated state. 3043 * Should clean up any associated state.
3044 * 3044 *
3045 * @param cls closure (set from #GNUNET_MESH_connect) 3045 * @param cls closure (set from #GNUNET_CADET_connect)
3046 * @param channel connection to the other end (henceforth invalid) 3046 * @param channel connection to the other end (henceforth invalid)
3047 * @param channel_ctx place where local state associated 3047 * @param channel_ctx place where local state associated
3048 * with the channel is stored 3048 * with the channel is stored
3049 */ 3049 */
3050static void 3050static void
3051clean_channel (void *cls, 3051clean_channel (void *cls,
3052 const struct GNUNET_MESH_Channel *channel, 3052 const struct GNUNET_CADET_Channel *channel,
3053 void *channel_ctx) 3053 void *channel_ctx)
3054{ 3054{
3055 struct ChannelState *s = channel_ctx; 3055 struct ChannelState *s = channel_ctx;
@@ -3089,7 +3089,7 @@ clean_channel (void *cls,
3089 } 3089 }
3090 if (NULL != s->th) 3090 if (NULL != s->th)
3091 { 3091 {
3092 GNUNET_MESH_notify_transmit_ready_cancel (s->th); 3092 GNUNET_CADET_notify_transmit_ready_cancel (s->th);
3093 s->th = NULL; 3093 s->th = NULL;
3094 } 3094 }
3095 GNUNET_free (s); 3095 GNUNET_free (s);
@@ -3140,10 +3140,10 @@ cleanup (void *cls,
3140 GNUNET_REGEX_announce_cancel (regex6); 3140 GNUNET_REGEX_announce_cancel (regex6);
3141 regex6 = NULL; 3141 regex6 = NULL;
3142 } 3142 }
3143 if (NULL != mesh_handle) 3143 if (NULL != cadet_handle)
3144 { 3144 {
3145 GNUNET_MESH_disconnect (mesh_handle); 3145 GNUNET_CADET_disconnect (cadet_handle);
3146 mesh_handle = NULL; 3146 cadet_handle = NULL;
3147 } 3147 }
3148 if (NULL != connections_map) 3148 if (NULL != connections_map)
3149 { 3149 {
@@ -3465,7 +3465,7 @@ run (void *cls,
3465 const char *cfgfile, 3465 const char *cfgfile,
3466 const struct GNUNET_CONFIGURATION_Handle *cfg_) 3466 const struct GNUNET_CONFIGURATION_Handle *cfg_)
3467{ 3467{
3468 static struct GNUNET_MESH_MessageHandler handlers[] = { 3468 static struct GNUNET_CADET_MessageHandler handlers[] = {
3469 {&receive_icmp_service, GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_SERVICE, 0}, 3469 {&receive_icmp_service, GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_SERVICE, 0},
3470 {&receive_icmp_remote, GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_INTERNET, 0}, 3470 {&receive_icmp_remote, GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_INTERNET, 0},
3471 {&receive_udp_service, GNUNET_MESSAGE_TYPE_VPN_UDP_TO_SERVICE, 0}, 3471 {&receive_udp_service, GNUNET_MESSAGE_TYPE_VPN_UDP_TO_SERVICE, 0},
@@ -3718,18 +3718,18 @@ run (void *cls,
3718 GNUNET_SCHEDULER_shutdown (); 3718 GNUNET_SCHEDULER_shutdown ();
3719 return; 3719 return;
3720 } 3720 }
3721 mesh_handle 3721 cadet_handle
3722 = GNUNET_MESH_connect (cfg, NULL, 3722 = GNUNET_CADET_connect (cfg, NULL,
3723 &new_channel, 3723 &new_channel,
3724 &clean_channel, handlers, 3724 &clean_channel, handlers,
3725 apptypes); 3725 apptypes);
3726 if (NULL == mesh_handle) 3726 if (NULL == cadet_handle)
3727 { 3727 {
3728 GNUNET_SCHEDULER_shutdown (); 3728 GNUNET_SCHEDULER_shutdown ();
3729 return; 3729 return;
3730 } 3730 }
3731 3731
3732 /* Mesh handle acquired, now announce regular expressions matching our exit */ 3732 /* Cadet handle acquired, now announce regular expressions matching our exit */
3733 if ( (GNUNET_YES == ipv4_enabled) && (GNUNET_YES == ipv4_exit) ) 3733 if ( (GNUNET_YES == ipv4_enabled) && (GNUNET_YES == ipv4_exit) )
3734 { 3734 {
3735 policy = NULL; 3735 policy = NULL;
diff --git a/src/fs/fs_api.c b/src/fs/fs_api.c
index 148ec4bb9..43a1235f6 100644
--- a/src/fs/fs_api.c
+++ b/src/fs/fs_api.c
@@ -1762,7 +1762,7 @@ write_download_request (struct GNUNET_BIO_WriteHandle *wh,
1762/** 1762/**
1763 * Read a download request tree. 1763 * Read a download request tree.
1764 * 1764 *
1765 * @param rh mesh to read from 1765 * @param rh cadet to read from
1766 * @return value the download request read from disk, NULL on error 1766 * @return value the download request read from disk, NULL on error
1767 */ 1767 */
1768static struct DownloadRequest * 1768static struct DownloadRequest *
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c
index 0e38d0dc9..59786bae8 100644
--- a/src/fs/gnunet-service-fs.c
+++ b/src/fs/gnunet-service-fs.c
@@ -43,7 +43,7 @@
43#include "gnunet-service-fs_pr.h" 43#include "gnunet-service-fs_pr.h"
44#include "gnunet-service-fs_push.h" 44#include "gnunet-service-fs_push.h"
45#include "gnunet-service-fs_put.h" 45#include "gnunet-service-fs_put.h"
46#include "gnunet-service-fs_mesh.h" 46#include "gnunet-service-fs_cadet.h"
47#include "fs.h" 47#include "fs.h"
48 48
49/** 49/**
@@ -412,10 +412,10 @@ start_p2p_processing (void *cls, struct GSF_PendingRequest *pr,
412 { 412 {
413 case GNUNET_BLOCK_TYPE_FS_DBLOCK: 413 case GNUNET_BLOCK_TYPE_FS_DBLOCK:
414 case GNUNET_BLOCK_TYPE_FS_IBLOCK: 414 case GNUNET_BLOCK_TYPE_FS_IBLOCK:
415 /* the above block types MAY be available via 'mesh' */ 415 /* the above block types MAY be available via 'cadet' */
416 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 416 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
417 "Considering mesh-based download for block\n"); 417 "Considering cadet-based download for block\n");
418 GSF_mesh_lookup_ (pr); 418 GSF_cadet_lookup_ (pr);
419 break; 419 break;
420 case GNUNET_BLOCK_TYPE_FS_UBLOCK: 420 case GNUNET_BLOCK_TYPE_FS_UBLOCK:
421 /* the above block types are in the DHT */ 421 /* the above block types are in the DHT */
@@ -475,8 +475,8 @@ handle_start_search (void *cls, struct GNUNET_SERVER_Client *client,
475static void 475static void
476shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 476shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
477{ 477{
478 GSF_mesh_stop_client (); 478 GSF_cadet_stop_client ();
479 GSF_mesh_stop_server (); 479 GSF_cadet_stop_server ();
480 if (NULL != GSF_core) 480 if (NULL != GSF_core)
481 { 481 {
482 GNUNET_CORE_disconnect (GSF_core); 482 GNUNET_CORE_disconnect (GSF_core);
@@ -646,8 +646,8 @@ main_init (struct GNUNET_SERVER_Handle *server,
646 GNUNET_SCHEDULER_add_delayed (COVER_AGE_FREQUENCY, &age_cover_counters, 646 GNUNET_SCHEDULER_add_delayed (COVER_AGE_FREQUENCY, &age_cover_counters,
647 NULL); 647 NULL);
648 datastore_get_load = GNUNET_LOAD_value_init (DATASTORE_LOAD_AUTODECLINE); 648 datastore_get_load = GNUNET_LOAD_value_init (DATASTORE_LOAD_AUTODECLINE);
649 GSF_mesh_start_server (); 649 GSF_cadet_start_server ();
650 GSF_mesh_start_client (); 650 GSF_cadet_start_client ();
651 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, 651 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
652 NULL); 652 NULL);
653 return GNUNET_OK; 653 return GNUNET_OK;
diff --git a/src/fs/gnunet-service-fs_mesh.h b/src/fs/gnunet-service-fs_mesh.h
index 5decb242a..ddf367668 100644
--- a/src/fs/gnunet-service-fs_mesh.h
+++ b/src/fs/gnunet-service-fs_mesh.h
@@ -19,21 +19,21 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file fs/gnunet-service-fs_mesh.h 22 * @file fs/gnunet-service-fs_cadet.h
23 * @brief non-anonymous file-transfer 23 * @brief non-anonymous file-transfer
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
26#ifndef GNUNET_SERVICE_FS_MESH_H 26#ifndef GNUNET_SERVICE_FS_CADET_H
27#define GNUNET_SERVICE_FS_MESH_H 27#define GNUNET_SERVICE_FS_CADET_H
28 28
29/** 29/**
30 * Handle for a request that is going out via mesh API. 30 * Handle for a request that is going out via cadet API.
31 */ 31 */
32struct GSF_MeshRequest; 32struct GSF_CadetRequest;
33 33
34 34
35/** 35/**
36 * Function called with a reply from the mesh. 36 * Function called with a reply from the cadet.
37 * 37 *
38 * @param cls closure 38 * @param cls closure
39 * @param type type of the block, ANY on error 39 * @param type type of the block, ANY on error
@@ -41,7 +41,7 @@ struct GSF_MeshRequest;
41 * @param data_size number of bytes in 'data', 0 on error 41 * @param data_size number of bytes in 'data', 0 on error
42 * @param data reply block data, NULL on error 42 * @param data reply block data, NULL on error
43 */ 43 */
44typedef void (*GSF_MeshReplyProcessor)(void *cls, 44typedef void (*GSF_CadetReplyProcessor)(void *cls,
45 enum GNUNET_BLOCK_Type type, 45 enum GNUNET_BLOCK_Type type,
46 struct GNUNET_TIME_Absolute expiration, 46 struct GNUNET_TIME_Absolute expiration,
47 size_t data_size, 47 size_t data_size,
@@ -58,11 +58,11 @@ typedef void (*GSF_MeshReplyProcessor)(void *cls,
58 * @param proc_cls closure for 'proc' 58 * @param proc_cls closure for 'proc'
59 * @return handle to cancel the operation 59 * @return handle to cancel the operation
60 */ 60 */
61struct GSF_MeshRequest * 61struct GSF_CadetRequest *
62GSF_mesh_query (const struct GNUNET_PeerIdentity *target, 62GSF_cadet_query (const struct GNUNET_PeerIdentity *target,
63 const struct GNUNET_HashCode *query, 63 const struct GNUNET_HashCode *query,
64 enum GNUNET_BLOCK_Type type, 64 enum GNUNET_BLOCK_Type type,
65 GSF_MeshReplyProcessor proc, void *proc_cls); 65 GSF_CadetReplyProcessor proc, void *proc_cls);
66 66
67 67
68/** 68/**
@@ -72,34 +72,34 @@ GSF_mesh_query (const struct GNUNET_PeerIdentity *target,
72 * @param sr request to cancel 72 * @param sr request to cancel
73 */ 73 */
74void 74void
75GSF_mesh_query_cancel (struct GSF_MeshRequest *sr); 75GSF_cadet_query_cancel (struct GSF_CadetRequest *sr);
76 76
77 77
78/** 78/**
79 * Initialize subsystem for non-anonymous file-sharing. 79 * Initialize subsystem for non-anonymous file-sharing.
80 */ 80 */
81void 81void
82GSF_mesh_start_server (void); 82GSF_cadet_start_server (void);
83 83
84 84
85/** 85/**
86 * Shutdown subsystem for non-anonymous file-sharing. 86 * Shutdown subsystem for non-anonymous file-sharing.
87 */ 87 */
88void 88void
89GSF_mesh_stop_server (void); 89GSF_cadet_stop_server (void);
90 90
91/** 91/**
92 * Initialize subsystem for non-anonymous file-sharing. 92 * Initialize subsystem for non-anonymous file-sharing.
93 */ 93 */
94void 94void
95GSF_mesh_start_client (void); 95GSF_cadet_start_client (void);
96 96
97 97
98/** 98/**
99 * Shutdown subsystem for non-anonymous file-sharing. 99 * Shutdown subsystem for non-anonymous file-sharing.
100 */ 100 */
101void 101void
102GSF_mesh_stop_client (void); 102GSF_cadet_stop_client (void);
103 103
104 104
105GNUNET_NETWORK_STRUCT_BEGIN 105GNUNET_NETWORK_STRUCT_BEGIN
@@ -107,11 +107,11 @@ GNUNET_NETWORK_STRUCT_BEGIN
107/** 107/**
108 * Query from one peer, asking the other for CHK-data. 108 * Query from one peer, asking the other for CHK-data.
109 */ 109 */
110struct MeshQueryMessage 110struct CadetQueryMessage
111{ 111{
112 112
113 /** 113 /**
114 * Type is GNUNET_MESSAGE_TYPE_FS_MESH_QUERY. 114 * Type is GNUNET_MESSAGE_TYPE_FS_CADET_QUERY.
115 */ 115 */
116 struct GNUNET_MessageHeader header; 116 struct GNUNET_MessageHeader header;
117 117
@@ -129,13 +129,13 @@ struct MeshQueryMessage
129 129
130 130
131/** 131/**
132 * Reply to a MeshQueryMessage. 132 * Reply to a CadetQueryMessage.
133 */ 133 */
134struct MeshReplyMessage 134struct CadetReplyMessage
135{ 135{
136 136
137 /** 137 /**
138 * Type is GNUNET_MESSAGE_TYPE_FS_MESH_REPLY. 138 * Type is GNUNET_MESSAGE_TYPE_FS_CADET_REPLY.
139 */ 139 */
140 struct GNUNET_MessageHeader header; 140 struct GNUNET_MessageHeader header;
141 141
diff --git a/src/fs/gnunet-service-fs_mesh_client.c b/src/fs/gnunet-service-fs_mesh_client.c
index 95e370274..dde7aba48 100644
--- a/src/fs/gnunet-service-fs_mesh_client.c
+++ b/src/fs/gnunet-service-fs_mesh_client.c
@@ -19,7 +19,7 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file fs/gnunet-service-fs_mesh_client.c 22 * @file fs/gnunet-service-fs_cadet_client.c
23 * @brief non-anonymous file-transfer 23 * @brief non-anonymous file-transfer
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 * 25 *
@@ -30,12 +30,12 @@
30#include "platform.h" 30#include "platform.h"
31#include "gnunet_constants.h" 31#include "gnunet_constants.h"
32#include "gnunet_util_lib.h" 32#include "gnunet_util_lib.h"
33#include "gnunet_mesh_service.h" 33#include "gnunet_cadet_service.h"
34#include "gnunet_protocols.h" 34#include "gnunet_protocols.h"
35#include "gnunet_applications.h" 35#include "gnunet_applications.h"
36#include "gnunet-service-fs.h" 36#include "gnunet-service-fs.h"
37#include "gnunet-service-fs_indexing.h" 37#include "gnunet-service-fs_indexing.h"
38#include "gnunet-service-fs_mesh.h" 38#include "gnunet-service-fs_cadet.h"
39 39
40 40
41/** 41/**
@@ -45,36 +45,36 @@
45 45
46 46
47/** 47/**
48 * Handle for a mesh to another peer. 48 * Handle for a cadet to another peer.
49 */ 49 */
50struct MeshHandle; 50struct CadetHandle;
51 51
52 52
53/** 53/**
54 * Handle for a request that is going out via mesh API. 54 * Handle for a request that is going out via cadet API.
55 */ 55 */
56struct GSF_MeshRequest 56struct GSF_CadetRequest
57{ 57{
58 58
59 /** 59 /**
60 * DLL. 60 * DLL.
61 */ 61 */
62 struct GSF_MeshRequest *next; 62 struct GSF_CadetRequest *next;
63 63
64 /** 64 /**
65 * DLL. 65 * DLL.
66 */ 66 */
67 struct GSF_MeshRequest *prev; 67 struct GSF_CadetRequest *prev;
68 68
69 /** 69 /**
70 * Which mesh is this request associated with? 70 * Which cadet is this request associated with?
71 */ 71 */
72 struct MeshHandle *mh; 72 struct CadetHandle *mh;
73 73
74 /** 74 /**
75 * Function to call with the result. 75 * Function to call with the result.
76 */ 76 */
77 GSF_MeshReplyProcessor proc; 77 GSF_CadetReplyProcessor proc;
78 78
79 /** 79 /**
80 * Closure for 'proc' 80 * Closure for 'proc'
@@ -100,22 +100,22 @@ struct GSF_MeshRequest
100 100
101 101
102/** 102/**
103 * Handle for a mesh to another peer. 103 * Handle for a cadet to another peer.
104 */ 104 */
105struct MeshHandle 105struct CadetHandle
106{ 106{
107 /** 107 /**
108 * Head of DLL of pending requests on this mesh. 108 * Head of DLL of pending requests on this cadet.
109 */ 109 */
110 struct GSF_MeshRequest *pending_head; 110 struct GSF_CadetRequest *pending_head;
111 111
112 /** 112 /**
113 * Tail of DLL of pending requests on this mesh. 113 * Tail of DLL of pending requests on this cadet.
114 */ 114 */
115 struct GSF_MeshRequest *pending_tail; 115 struct GSF_CadetRequest *pending_tail;
116 116
117 /** 117 /**
118 * Map from query to `struct GSF_MeshRequest`s waiting for 118 * Map from query to `struct GSF_CadetRequest`s waiting for
119 * a reply. 119 * a reply.
120 */ 120 */
121 struct GNUNET_CONTAINER_MultiHashMap *waiting_map; 121 struct GNUNET_CONTAINER_MultiHashMap *waiting_map;
@@ -123,29 +123,29 @@ struct MeshHandle
123 /** 123 /**
124 * Channel to the other peer. 124 * Channel to the other peer.
125 */ 125 */
126 struct GNUNET_MESH_Channel *channel; 126 struct GNUNET_CADET_Channel *channel;
127 127
128 /** 128 /**
129 * Handle for active write operation, or NULL. 129 * Handle for active write operation, or NULL.
130 */ 130 */
131 struct GNUNET_MESH_TransmitHandle *wh; 131 struct GNUNET_CADET_TransmitHandle *wh;
132 132
133 /** 133 /**
134 * Which peer does this mesh go to? 134 * Which peer does this cadet go to?
135 */ 135 */
136 struct GNUNET_PeerIdentity target; 136 struct GNUNET_PeerIdentity target;
137 137
138 /** 138 /**
139 * Task to kill inactive meshs (we keep them around for 139 * Task to kill inactive cadets (we keep them around for
140 * a few seconds to give the application a chance to give 140 * a few seconds to give the application a chance to give
141 * us another query). 141 * us another query).
142 */ 142 */
143 GNUNET_SCHEDULER_TaskIdentifier timeout_task; 143 GNUNET_SCHEDULER_TaskIdentifier timeout_task;
144 144
145 /** 145 /**
146 * Task to reset meshs that had errors (asynchronously, 146 * Task to reset cadets that had errors (asynchronously,
147 * as we may not be able to do it immediately during a 147 * as we may not be able to do it immediately during a
148 * callback from the mesh API). 148 * callback from the cadet API).
149 */ 149 */
150 GNUNET_SCHEDULER_TaskIdentifier reset_task; 150 GNUNET_SCHEDULER_TaskIdentifier reset_task;
151 151
@@ -153,36 +153,36 @@ struct MeshHandle
153 153
154 154
155/** 155/**
156 * Mesh channel for creating outbound channels. 156 * Cadet channel for creating outbound channels.
157 */ 157 */
158static struct GNUNET_MESH_Handle *mesh_handle; 158static struct GNUNET_CADET_Handle *cadet_handle;
159 159
160/** 160/**
161 * Map from peer identities to 'struct MeshHandles' with mesh 161 * Map from peer identities to 'struct CadetHandles' with cadet
162 * channels to those peers. 162 * channels to those peers.
163 */ 163 */
164static struct GNUNET_CONTAINER_MultiPeerMap *mesh_map; 164static struct GNUNET_CONTAINER_MultiPeerMap *cadet_map;
165 165
166 166
167/* ********************* client-side code ************************* */ 167/* ********************* client-side code ************************* */
168 168
169 169
170/** 170/**
171 * Transmit pending requests via the mesh. 171 * Transmit pending requests via the cadet.
172 * 172 *
173 * @param mh mesh to process 173 * @param mh cadet to process
174 */ 174 */
175static void 175static void
176transmit_pending (struct MeshHandle *mh); 176transmit_pending (struct CadetHandle *mh);
177 177
178 178
179/** 179/**
180 * Iterator called on each entry in a waiting map to 180 * Iterator called on each entry in a waiting map to
181 * move it back to the pending list. 181 * move it back to the pending list.
182 * 182 *
183 * @param cls the `struct MeshHandle` 183 * @param cls the `struct CadetHandle`
184 * @param key the key of the entry in the map (the query) 184 * @param key the key of the entry in the map (the query)
185 * @param value the `struct GSF_MeshRequest` to move to pending 185 * @param value the `struct GSF_CadetRequest` to move to pending
186 * @return #GNUNET_YES (continue to iterate) 186 * @return #GNUNET_YES (continue to iterate)
187 */ 187 */
188static int 188static int
@@ -190,8 +190,8 @@ move_to_pending (void *cls,
190 const struct GNUNET_HashCode *key, 190 const struct GNUNET_HashCode *key,
191 void *value) 191 void *value)
192{ 192{
193 struct MeshHandle *mh = cls; 193 struct CadetHandle *mh = cls;
194 struct GSF_MeshRequest *sr = value; 194 struct GSF_CadetRequest *sr = value;
195 195
196 GNUNET_assert (GNUNET_YES == 196 GNUNET_assert (GNUNET_YES ==
197 GNUNET_CONTAINER_multihashmap_remove (mh->waiting_map, 197 GNUNET_CONTAINER_multihashmap_remove (mh->waiting_map,
@@ -206,94 +206,94 @@ move_to_pending (void *cls,
206 206
207 207
208/** 208/**
209 * We had a serious error, tear down and re-create mesh from scratch. 209 * We had a serious error, tear down and re-create cadet from scratch.
210 * 210 *
211 * @param mh mesh to reset 211 * @param mh cadet to reset
212 */ 212 */
213static void 213static void
214reset_mesh (struct MeshHandle *mh) 214reset_cadet (struct CadetHandle *mh)
215{ 215{
216 struct GNUNET_MESH_Channel *channel = mh->channel; 216 struct GNUNET_CADET_Channel *channel = mh->channel;
217 217
218 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 218 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
219 "Resetting mesh channel to %s\n", 219 "Resetting cadet channel to %s\n",
220 GNUNET_i2s (&mh->target)); 220 GNUNET_i2s (&mh->target));
221 mh->channel = NULL; 221 mh->channel = NULL;
222 if (NULL != channel) 222 if (NULL != channel)
223 GNUNET_MESH_channel_destroy (channel); 223 GNUNET_CADET_channel_destroy (channel);
224 GNUNET_CONTAINER_multihashmap_iterate (mh->waiting_map, 224 GNUNET_CONTAINER_multihashmap_iterate (mh->waiting_map,
225 &move_to_pending, 225 &move_to_pending,
226 mh); 226 mh);
227 mh->channel = GNUNET_MESH_channel_create (mesh_handle, 227 mh->channel = GNUNET_CADET_channel_create (cadet_handle,
228 mh, 228 mh,
229 &mh->target, 229 &mh->target,
230 GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER, 230 GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER,
231 GNUNET_MESH_OPTION_RELIABLE); 231 GNUNET_CADET_OPTION_RELIABLE);
232 transmit_pending (mh); 232 transmit_pending (mh);
233} 233}
234 234
235 235
236/** 236/**
237 * Task called when it is time to destroy an inactive mesh channel. 237 * Task called when it is time to destroy an inactive cadet channel.
238 * 238 *
239 * @param cls the `struct MeshHandle` to tear down 239 * @param cls the `struct CadetHandle` to tear down
240 * @param tc scheduler context, unused 240 * @param tc scheduler context, unused
241 */ 241 */
242static void 242static void
243mesh_timeout (void *cls, 243cadet_timeout (void *cls,
244 const struct GNUNET_SCHEDULER_TaskContext *tc) 244 const struct GNUNET_SCHEDULER_TaskContext *tc)
245{ 245{
246 struct MeshHandle *mh = cls; 246 struct CadetHandle *mh = cls;
247 struct GNUNET_MESH_Channel *tun; 247 struct GNUNET_CADET_Channel *tun;
248 248
249 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 249 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
250 "Timeout on mesh channel to %s\n", 250 "Timeout on cadet channel to %s\n",
251 GNUNET_i2s (&mh->target)); 251 GNUNET_i2s (&mh->target));
252 mh->timeout_task = GNUNET_SCHEDULER_NO_TASK; 252 mh->timeout_task = GNUNET_SCHEDULER_NO_TASK;
253 tun = mh->channel; 253 tun = mh->channel;
254 mh->channel = NULL; 254 mh->channel = NULL;
255 GNUNET_MESH_channel_destroy (tun); 255 GNUNET_CADET_channel_destroy (tun);
256} 256}
257 257
258 258
259/** 259/**
260 * Task called when it is time to reset an mesh. 260 * Task called when it is time to reset an cadet.
261 * 261 *
262 * @param cls the `struct MeshHandle` to tear down 262 * @param cls the `struct CadetHandle` to tear down
263 * @param tc scheduler context, unused 263 * @param tc scheduler context, unused
264 */ 264 */
265static void 265static void
266reset_mesh_task (void *cls, 266reset_cadet_task (void *cls,
267 const struct GNUNET_SCHEDULER_TaskContext *tc) 267 const struct GNUNET_SCHEDULER_TaskContext *tc)
268{ 268{
269 struct MeshHandle *mh = cls; 269 struct CadetHandle *mh = cls;
270 270
271 mh->reset_task = GNUNET_SCHEDULER_NO_TASK; 271 mh->reset_task = GNUNET_SCHEDULER_NO_TASK;
272 reset_mesh (mh); 272 reset_cadet (mh);
273} 273}
274 274
275 275
276/** 276/**
277 * We had a serious error, tear down and re-create mesh from scratch, 277 * We had a serious error, tear down and re-create cadet from scratch,
278 * but do so asynchronously. 278 * but do so asynchronously.
279 * 279 *
280 * @param mh mesh to reset 280 * @param mh cadet to reset
281 */ 281 */
282static void 282static void
283reset_mesh_async (struct MeshHandle *mh) 283reset_cadet_async (struct CadetHandle *mh)
284{ 284{
285 if (GNUNET_SCHEDULER_NO_TASK != mh->reset_task) 285 if (GNUNET_SCHEDULER_NO_TASK != mh->reset_task)
286 GNUNET_SCHEDULER_cancel (mh->reset_task); 286 GNUNET_SCHEDULER_cancel (mh->reset_task);
287 mh->reset_task = GNUNET_SCHEDULER_add_now (&reset_mesh_task, 287 mh->reset_task = GNUNET_SCHEDULER_add_now (&reset_cadet_task,
288 mh); 288 mh);
289} 289}
290 290
291 291
292/** 292/**
293 * Functions of this signature are called whenever we are ready to transmit 293 * Functions of this signature are called whenever we are ready to transmit
294 * query via a mesh. 294 * query via a cadet.
295 * 295 *
296 * @param cls the struct MeshHandle for which we did the write call 296 * @param cls the struct CadetHandle for which we did the write call
297 * @param size the number of bytes that can be written to @a buf 297 * @param size the number of bytes that can be written to @a buf
298 * @param buf where to write the message 298 * @param buf where to write the message
299 * @return number of bytes written to @a buf 299 * @return number of bytes written to @a buf
@@ -303,23 +303,23 @@ transmit_sqm (void *cls,
303 size_t size, 303 size_t size,
304 void *buf) 304 void *buf)
305{ 305{
306 struct MeshHandle *mh = cls; 306 struct CadetHandle *mh = cls;
307 struct MeshQueryMessage sqm; 307 struct CadetQueryMessage sqm;
308 struct GSF_MeshRequest *sr; 308 struct GSF_CadetRequest *sr;
309 309
310 mh->wh = NULL; 310 mh->wh = NULL;
311 if (NULL == buf) 311 if (NULL == buf)
312 { 312 {
313 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 313 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
314 "Mesh channel to %s failed during transmission attempt, rebuilding\n", 314 "Cadet channel to %s failed during transmission attempt, rebuilding\n",
315 GNUNET_i2s (&mh->target)); 315 GNUNET_i2s (&mh->target));
316 reset_mesh_async (mh); 316 reset_cadet_async (mh);
317 return 0; 317 return 0;
318 } 318 }
319 sr = mh->pending_head; 319 sr = mh->pending_head;
320 if (NULL == sr) 320 if (NULL == sr)
321 return 0; 321 return 0;
322 GNUNET_assert (size >= sizeof (struct MeshQueryMessage)); 322 GNUNET_assert (size >= sizeof (struct CadetQueryMessage));
323 GNUNET_CONTAINER_DLL_remove (mh->pending_head, 323 GNUNET_CONTAINER_DLL_remove (mh->pending_head,
324 mh->pending_tail, 324 mh->pending_tail,
325 sr); 325 sr);
@@ -330,16 +330,16 @@ transmit_sqm (void *cls,
330 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); 330 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE));
331 sr->was_transmitted = GNUNET_YES; 331 sr->was_transmitted = GNUNET_YES;
332 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 332 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
333 "Sending query for %s via mesh to %s\n", 333 "Sending query for %s via cadet to %s\n",
334 GNUNET_h2s (&sr->query), 334 GNUNET_h2s (&sr->query),
335 GNUNET_i2s (&mh->target)); 335 GNUNET_i2s (&mh->target));
336 sqm.header.size = htons (sizeof (sqm)); 336 sqm.header.size = htons (sizeof (sqm));
337 sqm.header.type = htons (GNUNET_MESSAGE_TYPE_FS_MESH_QUERY); 337 sqm.header.type = htons (GNUNET_MESSAGE_TYPE_FS_CADET_QUERY);
338 sqm.type = htonl (sr->type); 338 sqm.type = htonl (sr->type);
339 sqm.query = sr->query; 339 sqm.query = sr->query;
340 memcpy (buf, &sqm, sizeof (sqm)); 340 memcpy (buf, &sqm, sizeof (sqm));
341 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 341 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
342 "Successfully transmitted %u bytes via mesh to %s\n", 342 "Successfully transmitted %u bytes via cadet to %s\n",
343 (unsigned int) size, 343 (unsigned int) size,
344 GNUNET_i2s (&mh->target)); 344 GNUNET_i2s (&mh->target));
345 transmit_pending (mh); 345 transmit_pending (mh);
@@ -348,20 +348,20 @@ transmit_sqm (void *cls,
348 348
349 349
350/** 350/**
351 * Transmit pending requests via the mesh. 351 * Transmit pending requests via the cadet.
352 * 352 *
353 * @param mh mesh to process 353 * @param mh cadet to process
354 */ 354 */
355static void 355static void
356transmit_pending (struct MeshHandle *mh) 356transmit_pending (struct CadetHandle *mh)
357{ 357{
358 if (NULL == mh->channel) 358 if (NULL == mh->channel)
359 return; 359 return;
360 if (NULL != mh->wh) 360 if (NULL != mh->wh)
361 return; 361 return;
362 mh->wh = GNUNET_MESH_notify_transmit_ready (mh->channel, GNUNET_YES /* allow cork */, 362 mh->wh = GNUNET_CADET_notify_transmit_ready (mh->channel, GNUNET_YES /* allow cork */,
363 GNUNET_TIME_UNIT_FOREVER_REL, 363 GNUNET_TIME_UNIT_FOREVER_REL,
364 sizeof (struct MeshQueryMessage), 364 sizeof (struct CadetQueryMessage),
365 &transmit_sqm, mh); 365 &transmit_sqm, mh);
366} 366}
367 367
@@ -405,7 +405,7 @@ struct HandleReplyClosure
405 * 405 *
406 * @param cls the `struct HandleReplyClosure` 406 * @param cls the `struct HandleReplyClosure`
407 * @param key the key of the entry in the map (the query) 407 * @param key the key of the entry in the map (the query)
408 * @param value the `struct GSF_MeshRequest` to handle result for 408 * @param value the `struct GSF_CadetRequest` to handle result for
409 * @return #GNUNET_YES (continue to iterate) 409 * @return #GNUNET_YES (continue to iterate)
410 */ 410 */
411static int 411static int
@@ -414,7 +414,7 @@ handle_reply (void *cls,
414 void *value) 414 void *value)
415{ 415{
416 struct HandleReplyClosure *hrc = cls; 416 struct HandleReplyClosure *hrc = cls;
417 struct GSF_MeshRequest *sr = value; 417 struct GSF_CadetRequest *sr = value;
418 418
419 sr->proc (sr->proc_cls, 419 sr->proc (sr->proc_cls,
420 hrc->type, 420 hrc->type,
@@ -422,7 +422,7 @@ handle_reply (void *cls,
422 hrc->data_size, 422 hrc->data_size,
423 hrc->data); 423 hrc->data);
424 sr->proc = NULL; 424 sr->proc = NULL;
425 GSF_mesh_query_cancel (sr); 425 GSF_cadet_query_cancel (sr);
426 hrc->found = GNUNET_YES; 426 hrc->found = GNUNET_YES;
427 return GNUNET_YES; 427 return GNUNET_YES;
428} 428}
@@ -432,7 +432,7 @@ handle_reply (void *cls,
432 * Functions with this signature are called whenever a complete reply 432 * Functions with this signature are called whenever a complete reply
433 * is received. 433 * is received.
434 * 434 *
435 * @param cls closure with the `struct MeshHandle` 435 * @param cls closure with the `struct CadetHandle`
436 * @param channel channel handle 436 * @param channel channel handle
437 * @param channel_ctx channel context 437 * @param channel_ctx channel context
438 * @param message the actual message 438 * @param message the actual message
@@ -440,26 +440,26 @@ handle_reply (void *cls,
440 */ 440 */
441static int 441static int
442reply_cb (void *cls, 442reply_cb (void *cls,
443 struct GNUNET_MESH_Channel *channel, 443 struct GNUNET_CADET_Channel *channel,
444 void **channel_ctx, 444 void **channel_ctx,
445 const struct GNUNET_MessageHeader *message) 445 const struct GNUNET_MessageHeader *message)
446{ 446{
447 struct MeshHandle *mh = *channel_ctx; 447 struct CadetHandle *mh = *channel_ctx;
448 const struct MeshReplyMessage *srm; 448 const struct CadetReplyMessage *srm;
449 struct HandleReplyClosure hrc; 449 struct HandleReplyClosure hrc;
450 uint16_t msize; 450 uint16_t msize;
451 enum GNUNET_BLOCK_Type type; 451 enum GNUNET_BLOCK_Type type;
452 struct GNUNET_HashCode query; 452 struct GNUNET_HashCode query;
453 453
454 msize = ntohs (message->size); 454 msize = ntohs (message->size);
455 if (sizeof (struct MeshReplyMessage) > msize) 455 if (sizeof (struct CadetReplyMessage) > msize)
456 { 456 {
457 GNUNET_break_op (0); 457 GNUNET_break_op (0);
458 reset_mesh_async (mh); 458 reset_cadet_async (mh);
459 return GNUNET_SYSERR; 459 return GNUNET_SYSERR;
460 } 460 }
461 srm = (const struct MeshReplyMessage *) message; 461 srm = (const struct CadetReplyMessage *) message;
462 msize -= sizeof (struct MeshReplyMessage); 462 msize -= sizeof (struct CadetReplyMessage);
463 type = (enum GNUNET_BLOCK_Type) ntohl (srm->type); 463 type = (enum GNUNET_BLOCK_Type) ntohl (srm->type);
464 if (GNUNET_YES != 464 if (GNUNET_YES !=
465 GNUNET_BLOCK_get_key (GSF_block_ctx, 465 GNUNET_BLOCK_get_key (GSF_block_ctx,
@@ -468,20 +468,20 @@ reply_cb (void *cls,
468 { 468 {
469 GNUNET_break_op (0); 469 GNUNET_break_op (0);
470 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 470 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
471 "Received bogus reply of type %u with %u bytes via mesh from peer %s\n", 471 "Received bogus reply of type %u with %u bytes via cadet from peer %s\n",
472 type, 472 type,
473 msize, 473 msize,
474 GNUNET_i2s (&mh->target)); 474 GNUNET_i2s (&mh->target));
475 reset_mesh_async (mh); 475 reset_cadet_async (mh);
476 return GNUNET_SYSERR; 476 return GNUNET_SYSERR;
477 } 477 }
478 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 478 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
479 "Received reply `%s' via mesh from peer %s\n", 479 "Received reply `%s' via cadet from peer %s\n",
480 GNUNET_h2s (&query), 480 GNUNET_h2s (&query),
481 GNUNET_i2s (&mh->target)); 481 GNUNET_i2s (&mh->target));
482 GNUNET_MESH_receive_done (channel); 482 GNUNET_CADET_receive_done (channel);
483 GNUNET_STATISTICS_update (GSF_stats, 483 GNUNET_STATISTICS_update (GSF_stats,
484 gettext_noop ("# replies received via mesh"), 1, 484 gettext_noop ("# replies received via cadet"), 1,
485 GNUNET_NO); 485 GNUNET_NO);
486 hrc.data = &srm[1]; 486 hrc.data = &srm[1];
487 hrc.data_size = msize; 487 hrc.data_size = msize;
@@ -495,7 +495,7 @@ reply_cb (void *cls,
495 if (GNUNET_NO == hrc.found) 495 if (GNUNET_NO == hrc.found)
496 { 496 {
497 GNUNET_STATISTICS_update (GSF_stats, 497 GNUNET_STATISTICS_update (GSF_stats,
498 gettext_noop ("# replies received via mesh dropped"), 1, 498 gettext_noop ("# replies received via cadet dropped"), 1,
499 GNUNET_NO); 499 GNUNET_NO);
500 return GNUNET_OK; 500 return GNUNET_OK;
501 } 501 }
@@ -504,16 +504,16 @@ reply_cb (void *cls,
504 504
505 505
506/** 506/**
507 * Get (or create) a mesh to talk to the given peer. 507 * Get (or create) a cadet to talk to the given peer.
508 * 508 *
509 * @param target peer we want to communicate with 509 * @param target peer we want to communicate with
510 */ 510 */
511static struct MeshHandle * 511static struct CadetHandle *
512get_mesh (const struct GNUNET_PeerIdentity *target) 512get_cadet (const struct GNUNET_PeerIdentity *target)
513{ 513{
514 struct MeshHandle *mh; 514 struct CadetHandle *mh;
515 515
516 mh = GNUNET_CONTAINER_multipeermap_get (mesh_map, 516 mh = GNUNET_CONTAINER_multipeermap_get (cadet_map,
517 target); 517 target);
518 if (NULL != mh) 518 if (NULL != mh)
519 { 519 {
@@ -525,26 +525,26 @@ get_mesh (const struct GNUNET_PeerIdentity *target)
525 return mh; 525 return mh;
526 } 526 }
527 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 527 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
528 "Creating mesh channel to %s\n", 528 "Creating cadet channel to %s\n",
529 GNUNET_i2s (target)); 529 GNUNET_i2s (target));
530 mh = GNUNET_new (struct MeshHandle); 530 mh = GNUNET_new (struct CadetHandle);
531 mh->reset_task = GNUNET_SCHEDULER_add_delayed (CLIENT_RETRY_TIMEOUT, 531 mh->reset_task = GNUNET_SCHEDULER_add_delayed (CLIENT_RETRY_TIMEOUT,
532 &reset_mesh_task, 532 &reset_cadet_task,
533 mh); 533 mh);
534 mh->waiting_map = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_YES); 534 mh->waiting_map = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_YES);
535 mh->target = *target; 535 mh->target = *target;
536 GNUNET_assert (GNUNET_OK == 536 GNUNET_assert (GNUNET_OK ==
537 GNUNET_CONTAINER_multipeermap_put (mesh_map, 537 GNUNET_CONTAINER_multipeermap_put (cadet_map,
538 &mh->target, 538 &mh->target,
539 mh, 539 mh,
540 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); 540 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
541 mh->channel = GNUNET_MESH_channel_create (mesh_handle, 541 mh->channel = GNUNET_CADET_channel_create (cadet_handle,
542 mh, 542 mh,
543 &mh->target, 543 &mh->target,
544 GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER, 544 GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER,
545 GNUNET_MESH_OPTION_RELIABLE); 545 GNUNET_CADET_OPTION_RELIABLE);
546 GNUNET_assert (mh == 546 GNUNET_assert (mh ==
547 GNUNET_CONTAINER_multipeermap_get (mesh_map, 547 GNUNET_CONTAINER_multipeermap_get (cadet_map,
548 target)); 548 target));
549 return mh; 549 return mh;
550} 550}
@@ -560,21 +560,21 @@ get_mesh (const struct GNUNET_PeerIdentity *target)
560 * @param proc_cls closure for @a proc 560 * @param proc_cls closure for @a proc
561 * @return handle to cancel the operation 561 * @return handle to cancel the operation
562 */ 562 */
563struct GSF_MeshRequest * 563struct GSF_CadetRequest *
564GSF_mesh_query (const struct GNUNET_PeerIdentity *target, 564GSF_cadet_query (const struct GNUNET_PeerIdentity *target,
565 const struct GNUNET_HashCode *query, 565 const struct GNUNET_HashCode *query,
566 enum GNUNET_BLOCK_Type type, 566 enum GNUNET_BLOCK_Type type,
567 GSF_MeshReplyProcessor proc, void *proc_cls) 567 GSF_CadetReplyProcessor proc, void *proc_cls)
568{ 568{
569 struct MeshHandle *mh; 569 struct CadetHandle *mh;
570 struct GSF_MeshRequest *sr; 570 struct GSF_CadetRequest *sr;
571 571
572 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 572 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
573 "Preparing to send query for %s via mesh to %s\n", 573 "Preparing to send query for %s via cadet to %s\n",
574 GNUNET_h2s (query), 574 GNUNET_h2s (query),
575 GNUNET_i2s (target)); 575 GNUNET_i2s (target));
576 mh = get_mesh (target); 576 mh = get_cadet (target);
577 sr = GNUNET_new (struct GSF_MeshRequest); 577 sr = GNUNET_new (struct GSF_CadetRequest);
578 sr->mh = mh; 578 sr->mh = mh;
579 sr->proc = proc; 579 sr->proc = proc;
580 sr->proc_cls = proc_cls; 580 sr->proc_cls = proc_cls;
@@ -595,10 +595,10 @@ GSF_mesh_query (const struct GNUNET_PeerIdentity *target,
595 * @param sr request to cancel 595 * @param sr request to cancel
596 */ 596 */
597void 597void
598GSF_mesh_query_cancel (struct GSF_MeshRequest *sr) 598GSF_cadet_query_cancel (struct GSF_CadetRequest *sr)
599{ 599{
600 struct MeshHandle *mh = sr->mh; 600 struct CadetHandle *mh = sr->mh;
601 GSF_MeshReplyProcessor p; 601 GSF_CadetReplyProcessor p;
602 602
603 p = sr->proc; 603 p = sr->proc;
604 sr->proc = NULL; 604 sr->proc = NULL;
@@ -610,7 +610,7 @@ GSF_mesh_query_cancel (struct GSF_MeshRequest *sr)
610 0, NULL); 610 0, NULL);
611 } 611 }
612 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 612 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
613 "Cancelled query for %s via mesh to %s\n", 613 "Cancelled query for %s via cadet to %s\n",
614 GNUNET_h2s (&sr->query), 614 GNUNET_h2s (&sr->query),
615 GNUNET_i2s (&sr->mh->target)); 615 GNUNET_i2s (&sr->mh->target));
616 if (GNUNET_YES == sr->was_transmitted) 616 if (GNUNET_YES == sr->was_transmitted)
@@ -626,7 +626,7 @@ GSF_mesh_query_cancel (struct GSF_MeshRequest *sr)
626 if ( (0 == GNUNET_CONTAINER_multihashmap_size (mh->waiting_map)) && 626 if ( (0 == GNUNET_CONTAINER_multihashmap_size (mh->waiting_map)) &&
627 (NULL == mh->pending_head) ) 627 (NULL == mh->pending_head) )
628 mh->timeout_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, 628 mh->timeout_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
629 &mesh_timeout, 629 &cadet_timeout,
630 mh); 630 mh);
631} 631}
632 632
@@ -636,9 +636,9 @@ GSF_mesh_query_cancel (struct GSF_MeshRequest *sr)
636 * call the 'proc' continuation and release associated 636 * call the 'proc' continuation and release associated
637 * resources. 637 * resources.
638 * 638 *
639 * @param cls the `struct MeshHandle` 639 * @param cls the `struct CadetHandle`
640 * @param key the key of the entry in the map (the query) 640 * @param key the key of the entry in the map (the query)
641 * @param value the `struct GSF_MeshRequest` to clean up 641 * @param value the `struct GSF_CadetRequest` to clean up
642 * @return #GNUNET_YES (continue to iterate) 642 * @return #GNUNET_YES (continue to iterate)
643 */ 643 */
644static int 644static int
@@ -646,48 +646,48 @@ free_waiting_entry (void *cls,
646 const struct GNUNET_HashCode *key, 646 const struct GNUNET_HashCode *key,
647 void *value) 647 void *value)
648{ 648{
649 struct GSF_MeshRequest *sr = value; 649 struct GSF_CadetRequest *sr = value;
650 650
651 GSF_mesh_query_cancel (sr); 651 GSF_cadet_query_cancel (sr);
652 return GNUNET_YES; 652 return GNUNET_YES;
653} 653}
654 654
655 655
656/** 656/**
657 * Function called by mesh when a client disconnects. 657 * Function called by cadet when a client disconnects.
658 * Cleans up our `struct MeshClient` of that channel. 658 * Cleans up our `struct CadetClient` of that channel.
659 * 659 *
660 * @param cls NULL 660 * @param cls NULL
661 * @param channel channel of the disconnecting client 661 * @param channel channel of the disconnecting client
662 * @param channel_ctx our `struct MeshClient` 662 * @param channel_ctx our `struct CadetClient`
663 */ 663 */
664static void 664static void
665cleaner_cb (void *cls, 665cleaner_cb (void *cls,
666 const struct GNUNET_MESH_Channel *channel, 666 const struct GNUNET_CADET_Channel *channel,
667 void *channel_ctx) 667 void *channel_ctx)
668{ 668{
669 struct MeshHandle *mh = channel_ctx; 669 struct CadetHandle *mh = channel_ctx;
670 struct GSF_MeshRequest *sr; 670 struct GSF_CadetRequest *sr;
671 671
672 if (NULL == mh->channel) 672 if (NULL == mh->channel)
673 return; /* being destroyed elsewhere */ 673 return; /* being destroyed elsewhere */
674 GNUNET_assert (channel == mh->channel); 674 GNUNET_assert (channel == mh->channel);
675 mh->channel = NULL; 675 mh->channel = NULL;
676 while (NULL != (sr = mh->pending_head)) 676 while (NULL != (sr = mh->pending_head))
677 GSF_mesh_query_cancel (sr); 677 GSF_cadet_query_cancel (sr);
678 /* first remove `mh` from the `mesh_map`, so that if the 678 /* first remove `mh` from the `cadet_map`, so that if the
679 callback from `free_waiting_entry()` happens to re-issue 679 callback from `free_waiting_entry()` happens to re-issue
680 the request, we don't immediately have it back in the 680 the request, we don't immediately have it back in the
681 `waiting_map`. */ 681 `waiting_map`. */
682 GNUNET_assert (GNUNET_OK == 682 GNUNET_assert (GNUNET_OK ==
683 GNUNET_CONTAINER_multipeermap_remove (mesh_map, 683 GNUNET_CONTAINER_multipeermap_remove (cadet_map,
684 &mh->target, 684 &mh->target,
685 mh)); 685 mh));
686 GNUNET_CONTAINER_multihashmap_iterate (mh->waiting_map, 686 GNUNET_CONTAINER_multihashmap_iterate (mh->waiting_map,
687 &free_waiting_entry, 687 &free_waiting_entry,
688 mh); 688 mh);
689 if (NULL != mh->wh) 689 if (NULL != mh->wh)
690 GNUNET_MESH_notify_transmit_ready_cancel (mh->wh); 690 GNUNET_CADET_notify_transmit_ready_cancel (mh->wh);
691 if (GNUNET_SCHEDULER_NO_TASK != mh->timeout_task) 691 if (GNUNET_SCHEDULER_NO_TASK != mh->timeout_task)
692 GNUNET_SCHEDULER_cancel (mh->timeout_task); 692 GNUNET_SCHEDULER_cancel (mh->timeout_task);
693 if (GNUNET_SCHEDULER_NO_TASK != mh->reset_task) 693 if (GNUNET_SCHEDULER_NO_TASK != mh->reset_task)
@@ -703,15 +703,15 @@ cleaner_cb (void *cls,
703 * Initialize subsystem for non-anonymous file-sharing. 703 * Initialize subsystem for non-anonymous file-sharing.
704 */ 704 */
705void 705void
706GSF_mesh_start_client () 706GSF_cadet_start_client ()
707{ 707{
708 static const struct GNUNET_MESH_MessageHandler handlers[] = { 708 static const struct GNUNET_CADET_MessageHandler handlers[] = {
709 { &reply_cb, GNUNET_MESSAGE_TYPE_FS_MESH_REPLY, 0 }, 709 { &reply_cb, GNUNET_MESSAGE_TYPE_FS_CADET_REPLY, 0 },
710 { NULL, 0, 0 } 710 { NULL, 0, 0 }
711 }; 711 };
712 712
713 mesh_map = GNUNET_CONTAINER_multipeermap_create (16, GNUNET_YES); 713 cadet_map = GNUNET_CONTAINER_multipeermap_create (16, GNUNET_YES);
714 mesh_handle = GNUNET_MESH_connect (GSF_cfg, 714 cadet_handle = GNUNET_CADET_connect (GSF_cfg,
715 NULL, 715 NULL,
716 NULL, 716 NULL,
717 &cleaner_cb, 717 &cleaner_cb,
@@ -721,25 +721,25 @@ GSF_mesh_start_client ()
721 721
722 722
723/** 723/**
724 * Function called on each active meshs to shut them down. 724 * Function called on each active cadets to shut them down.
725 * 725 *
726 * @param cls NULL 726 * @param cls NULL
727 * @param key target peer, unused 727 * @param key target peer, unused
728 * @param value the `struct MeshHandle` to destroy 728 * @param value the `struct CadetHandle` to destroy
729 * @return #GNUNET_YES (continue to iterate) 729 * @return #GNUNET_YES (continue to iterate)
730 */ 730 */
731static int 731static int
732release_meshs (void *cls, 732release_cadets (void *cls,
733 const struct GNUNET_PeerIdentity *key, 733 const struct GNUNET_PeerIdentity *key,
734 void *value) 734 void *value)
735{ 735{
736 struct MeshHandle *mh = value; 736 struct CadetHandle *mh = value;
737 737
738 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 738 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
739 "Timeout on mesh channel to %s\n", 739 "Timeout on cadet channel to %s\n",
740 GNUNET_i2s (&mh->target)); 740 GNUNET_i2s (&mh->target));
741 if (NULL != mh->channel) 741 if (NULL != mh->channel)
742 GNUNET_MESH_channel_destroy (mh->channel); 742 GNUNET_CADET_channel_destroy (mh->channel);
743 return GNUNET_YES; 743 return GNUNET_YES;
744} 744}
745 745
@@ -748,19 +748,19 @@ release_meshs (void *cls,
748 * Shutdown subsystem for non-anonymous file-sharing. 748 * Shutdown subsystem for non-anonymous file-sharing.
749 */ 749 */
750void 750void
751GSF_mesh_stop_client () 751GSF_cadet_stop_client ()
752{ 752{
753 GNUNET_CONTAINER_multipeermap_iterate (mesh_map, 753 GNUNET_CONTAINER_multipeermap_iterate (cadet_map,
754 &release_meshs, 754 &release_cadets,
755 NULL); 755 NULL);
756 GNUNET_CONTAINER_multipeermap_destroy (mesh_map); 756 GNUNET_CONTAINER_multipeermap_destroy (cadet_map);
757 mesh_map = NULL; 757 cadet_map = NULL;
758 if (NULL != mesh_handle) 758 if (NULL != cadet_handle)
759 { 759 {
760 GNUNET_MESH_disconnect (mesh_handle); 760 GNUNET_CADET_disconnect (cadet_handle);
761 mesh_handle = NULL; 761 cadet_handle = NULL;
762 } 762 }
763} 763}
764 764
765 765
766/* end of gnunet-service-fs_mesh_client.c */ 766/* end of gnunet-service-fs_cadet_client.c */
diff --git a/src/fs/gnunet-service-fs_mesh_server.c b/src/fs/gnunet-service-fs_mesh_server.c
index e157c40e6..77add757d 100644
--- a/src/fs/gnunet-service-fs_mesh_server.c
+++ b/src/fs/gnunet-service-fs_mesh_server.c
@@ -19,7 +19,7 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file fs/gnunet-service-fs_mesh_server.c 22 * @file fs/gnunet-service-fs_cadet_server.c
23 * @brief non-anonymous file-transfer 23 * @brief non-anonymous file-transfer
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 * 25 *
@@ -30,12 +30,12 @@
30#include "platform.h" 30#include "platform.h"
31#include "gnunet_constants.h" 31#include "gnunet_constants.h"
32#include "gnunet_util_lib.h" 32#include "gnunet_util_lib.h"
33#include "gnunet_mesh_service.h" 33#include "gnunet_cadet_service.h"
34#include "gnunet_protocols.h" 34#include "gnunet_protocols.h"
35#include "gnunet_applications.h" 35#include "gnunet_applications.h"
36#include "gnunet-service-fs.h" 36#include "gnunet-service-fs.h"
37#include "gnunet-service-fs_indexing.h" 37#include "gnunet-service-fs_indexing.h"
38#include "gnunet-service-fs_mesh.h" 38#include "gnunet-service-fs_cadet.h"
39 39
40/** 40/**
41 * After how long do we termiante idle connections? 41 * After how long do we termiante idle connections?
@@ -44,7 +44,7 @@
44 44
45 45
46/** 46/**
47 * A message in the queue to be written to the mesh. 47 * A message in the queue to be written to the cadet.
48 */ 48 */
49struct WriteQueueItem 49struct WriteQueueItem
50{ 50{
@@ -66,29 +66,29 @@ struct WriteQueueItem
66 66
67 67
68/** 68/**
69 * Information we keep around for each active meshing client. 69 * Information we keep around for each active cadeting client.
70 */ 70 */
71struct MeshClient 71struct CadetClient
72{ 72{
73 /** 73 /**
74 * DLL 74 * DLL
75 */ 75 */
76 struct MeshClient *next; 76 struct CadetClient *next;
77 77
78 /** 78 /**
79 * DLL 79 * DLL
80 */ 80 */
81 struct MeshClient *prev; 81 struct CadetClient *prev;
82 82
83 /** 83 /**
84 * Channel for communication. 84 * Channel for communication.
85 */ 85 */
86 struct GNUNET_MESH_Channel *channel; 86 struct GNUNET_CADET_Channel *channel;
87 87
88 /** 88 /**
89 * Handle for active write operation, or NULL. 89 * Handle for active write operation, or NULL.
90 */ 90 */
91 struct GNUNET_MESH_TransmitHandle *wh; 91 struct GNUNET_CADET_TransmitHandle *wh;
92 92
93 /** 93 /**
94 * Head of write queue. 94 * Head of write queue.
@@ -126,65 +126,65 @@ struct MeshClient
126/** 126/**
127 * Listen channel for incoming requests. 127 * Listen channel for incoming requests.
128 */ 128 */
129static struct GNUNET_MESH_Handle *listen_channel; 129static struct GNUNET_CADET_Handle *listen_channel;
130 130
131/** 131/**
132 * Head of DLL of mesh clients. 132 * Head of DLL of cadet clients.
133 */ 133 */
134static struct MeshClient *sc_head; 134static struct CadetClient *sc_head;
135 135
136/** 136/**
137 * Tail of DLL of mesh clients. 137 * Tail of DLL of cadet clients.
138 */ 138 */
139static struct MeshClient *sc_tail; 139static struct CadetClient *sc_tail;
140 140
141/** 141/**
142 * Number of active mesh clients in the 'sc_*'-DLL. 142 * Number of active cadet clients in the 'sc_*'-DLL.
143 */ 143 */
144static unsigned int sc_count; 144static unsigned int sc_count;
145 145
146/** 146/**
147 * Maximum allowed number of mesh clients. 147 * Maximum allowed number of cadet clients.
148 */ 148 */
149static unsigned long long sc_count_max; 149static unsigned long long sc_count_max;
150 150
151 151
152 152
153/** 153/**
154 * Task run to asynchronously terminate the mesh due to timeout. 154 * Task run to asynchronously terminate the cadet due to timeout.
155 * 155 *
156 * @param cls the 'struct MeshClient' 156 * @param cls the 'struct CadetClient'
157 * @param tc scheduler context 157 * @param tc scheduler context
158 */ 158 */
159static void 159static void
160timeout_mesh_task (void *cls, 160timeout_cadet_task (void *cls,
161 const struct GNUNET_SCHEDULER_TaskContext *tc) 161 const struct GNUNET_SCHEDULER_TaskContext *tc)
162{ 162{
163 struct MeshClient *sc = cls; 163 struct CadetClient *sc = cls;
164 struct GNUNET_MESH_Channel *tun; 164 struct GNUNET_CADET_Channel *tun;
165 165
166 sc->timeout_task = GNUNET_SCHEDULER_NO_TASK; 166 sc->timeout_task = GNUNET_SCHEDULER_NO_TASK;
167 tun = sc->channel; 167 tun = sc->channel;
168 sc->channel = NULL; 168 sc->channel = NULL;
169 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 169 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
170 "Timeout for inactive mesh client %p\n", 170 "Timeout for inactive cadet client %p\n",
171 sc); 171 sc);
172 GNUNET_MESH_channel_destroy (tun); 172 GNUNET_CADET_channel_destroy (tun);
173} 173}
174 174
175 175
176/** 176/**
177 * Reset the timeout for the mesh client (due to activity). 177 * Reset the timeout for the cadet client (due to activity).
178 * 178 *
179 * @param sc client handle to reset timeout for 179 * @param sc client handle to reset timeout for
180 */ 180 */
181static void 181static void
182refresh_timeout_task (struct MeshClient *sc) 182refresh_timeout_task (struct CadetClient *sc)
183{ 183{
184 if (GNUNET_SCHEDULER_NO_TASK != sc->timeout_task) 184 if (GNUNET_SCHEDULER_NO_TASK != sc->timeout_task)
185 GNUNET_SCHEDULER_cancel (sc->timeout_task); 185 GNUNET_SCHEDULER_cancel (sc->timeout_task);
186 sc->timeout_task = GNUNET_SCHEDULER_add_delayed (IDLE_TIMEOUT, 186 sc->timeout_task = GNUNET_SCHEDULER_add_delayed (IDLE_TIMEOUT,
187 &timeout_mesh_task, 187 &timeout_cadet_task,
188 sc); 188 sc);
189} 189}
190 190
@@ -195,13 +195,13 @@ refresh_timeout_task (struct MeshClient *sc)
195 * @param sc client to continue reading requests from 195 * @param sc client to continue reading requests from
196 */ 196 */
197static void 197static void
198continue_reading (struct MeshClient *sc) 198continue_reading (struct CadetClient *sc)
199{ 199{
200 refresh_timeout_task (sc); 200 refresh_timeout_task (sc);
201 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 201 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
202 "Finished processing mesh request from client %p, ready to receive the next one\n", 202 "Finished processing cadet request from client %p, ready to receive the next one\n",
203 sc); 203 sc);
204 GNUNET_MESH_receive_done (sc->channel); 204 GNUNET_CADET_receive_done (sc->channel);
205} 205}
206 206
207 207
@@ -211,13 +211,13 @@ continue_reading (struct MeshClient *sc)
211 * @param sc where to process the write queue 211 * @param sc where to process the write queue
212 */ 212 */
213static void 213static void
214continue_writing (struct MeshClient *sc); 214continue_writing (struct CadetClient *sc);
215 215
216 216
217/** 217/**
218 * Send a reply now, mesh is ready. 218 * Send a reply now, cadet is ready.
219 * 219 *
220 * @param cls closure with the `struct MeshClient` which sent the query 220 * @param cls closure with the `struct CadetClient` which sent the query
221 * @param size number of bytes available in @a buf 221 * @param size number of bytes available in @a buf
222 * @param buf where to write the message 222 * @param buf where to write the message
223 * @return number of bytes written to @a buf 223 * @return number of bytes written to @a buf
@@ -227,8 +227,8 @@ write_continuation (void *cls,
227 size_t size, 227 size_t size,
228 void *buf) 228 void *buf)
229{ 229{
230 struct MeshClient *sc = cls; 230 struct CadetClient *sc = cls;
231 struct GNUNET_MESH_Channel *tun; 231 struct GNUNET_CADET_Channel *tun;
232 struct WriteQueueItem *wqi; 232 struct WriteQueueItem *wqi;
233 size_t ret; 233 size_t ret;
234 234
@@ -243,21 +243,21 @@ write_continuation (void *cls,
243 (size < wqi->msize) ) 243 (size < wqi->msize) )
244 { 244 {
245 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 245 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
246 "Transmission of reply failed, terminating mesh\n"); 246 "Transmission of reply failed, terminating cadet\n");
247 tun = sc->channel; 247 tun = sc->channel;
248 sc->channel = NULL; 248 sc->channel = NULL;
249 GNUNET_MESH_channel_destroy (tun); 249 GNUNET_CADET_channel_destroy (tun);
250 return 0; 250 return 0;
251 } 251 }
252 GNUNET_CONTAINER_DLL_remove (sc->wqi_head, 252 GNUNET_CONTAINER_DLL_remove (sc->wqi_head,
253 sc->wqi_tail, 253 sc->wqi_tail,
254 wqi); 254 wqi);
255 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 255 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
256 "Transmitted %u byte reply via mesh to %p\n", 256 "Transmitted %u byte reply via cadet to %p\n",
257 (unsigned int) size, 257 (unsigned int) size,
258 sc); 258 sc);
259 GNUNET_STATISTICS_update (GSF_stats, 259 GNUNET_STATISTICS_update (GSF_stats,
260 gettext_noop ("# Blocks transferred via mesh"), 1, 260 gettext_noop ("# Blocks transferred via cadet"), 1,
261 GNUNET_NO); 261 GNUNET_NO);
262 memcpy (buf, &wqi[1], ret = wqi->msize); 262 memcpy (buf, &wqi[1], ret = wqi->msize);
263 GNUNET_free (wqi); 263 GNUNET_free (wqi);
@@ -272,10 +272,10 @@ write_continuation (void *cls,
272 * @param sc where to process the write queue 272 * @param sc where to process the write queue
273 */ 273 */
274static void 274static void
275continue_writing (struct MeshClient *sc) 275continue_writing (struct CadetClient *sc)
276{ 276{
277 struct WriteQueueItem *wqi; 277 struct WriteQueueItem *wqi;
278 struct GNUNET_MESH_Channel *tun; 278 struct GNUNET_CADET_Channel *tun;
279 279
280 if (NULL != sc->wh) 280 if (NULL != sc->wh)
281 { 281 {
@@ -290,7 +290,7 @@ continue_writing (struct MeshClient *sc)
290 continue_reading (sc); 290 continue_reading (sc);
291 return; 291 return;
292 } 292 }
293 sc->wh = GNUNET_MESH_notify_transmit_ready (sc->channel, GNUNET_NO, 293 sc->wh = GNUNET_CADET_notify_transmit_ready (sc->channel, GNUNET_NO,
294 GNUNET_TIME_UNIT_FOREVER_REL, 294 GNUNET_TIME_UNIT_FOREVER_REL,
295 wqi->msize, 295 wqi->msize,
296 &write_continuation, 296 &write_continuation,
@@ -298,10 +298,10 @@ continue_writing (struct MeshClient *sc)
298 if (NULL == sc->wh) 298 if (NULL == sc->wh)
299 { 299 {
300 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 300 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
301 "Write failed; terminating mesh\n"); 301 "Write failed; terminating cadet\n");
302 tun = sc->channel; 302 tun = sc->channel;
303 sc->channel = NULL; 303 sc->channel = NULL;
304 GNUNET_MESH_channel_destroy (tun); 304 GNUNET_CADET_channel_destroy (tun);
305 return; 305 return;
306 } 306 }
307} 307}
@@ -310,7 +310,7 @@ continue_writing (struct MeshClient *sc)
310/** 310/**
311 * Process a datum that was stored in the datastore. 311 * Process a datum that was stored in the datastore.
312 * 312 *
313 * @param cls closure with the `struct MeshClient` which sent the query 313 * @param cls closure with the `struct CadetClient` which sent the query
314 * @param key key for the content 314 * @param key key for the content
315 * @param size number of bytes in @a data 315 * @param size number of bytes in @a data
316 * @param data content stored 316 * @param data content stored
@@ -331,10 +331,10 @@ handle_datastore_reply (void *cls,
331 struct GNUNET_TIME_Absolute expiration, 331 struct GNUNET_TIME_Absolute expiration,
332 uint64_t uid) 332 uint64_t uid)
333{ 333{
334 struct MeshClient *sc = cls; 334 struct CadetClient *sc = cls;
335 size_t msize = size + sizeof (struct MeshReplyMessage); 335 size_t msize = size + sizeof (struct CadetReplyMessage);
336 struct WriteQueueItem *wqi; 336 struct WriteQueueItem *wqi;
337 struct MeshReplyMessage *srm; 337 struct CadetReplyMessage *srm;
338 338
339 sc->qe = NULL; 339 sc->qe = NULL;
340 if (NULL == data) 340 if (NULL == data)
@@ -349,7 +349,7 @@ handle_datastore_reply (void *cls,
349 "Have no answer for query `%s'\n", 349 "Have no answer for query `%s'\n",
350 GNUNET_h2s (key)); 350 GNUNET_h2s (key));
351 GNUNET_STATISTICS_update (GSF_stats, 351 GNUNET_STATISTICS_update (GSF_stats,
352 gettext_noop ("# queries received via mesh not answered"), 1, 352 gettext_noop ("# queries received via cadet not answered"), 1,
353 GNUNET_NO); 353 GNUNET_NO);
354 continue_writing (sc); 354 continue_writing (sc);
355 return; 355 return;
@@ -381,16 +381,16 @@ handle_datastore_reply (void *cls,
381 } 381 }
382 GNUNET_break (GNUNET_BLOCK_TYPE_ANY != type); 382 GNUNET_break (GNUNET_BLOCK_TYPE_ANY != type);
383 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 383 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
384 "Starting transmission of %u byte reply of type %d for query `%s' via mesh to %p\n", 384 "Starting transmission of %u byte reply of type %d for query `%s' via cadet to %p\n",
385 (unsigned int) size, 385 (unsigned int) size,
386 (unsigned int) type, 386 (unsigned int) type,
387 GNUNET_h2s (key), 387 GNUNET_h2s (key),
388 sc); 388 sc);
389 wqi = GNUNET_malloc (sizeof (struct WriteQueueItem) + msize); 389 wqi = GNUNET_malloc (sizeof (struct WriteQueueItem) + msize);
390 wqi->msize = msize; 390 wqi->msize = msize;
391 srm = (struct MeshReplyMessage *) &wqi[1]; 391 srm = (struct CadetReplyMessage *) &wqi[1];
392 srm->header.size = htons ((uint16_t) msize); 392 srm->header.size = htons ((uint16_t) msize);
393 srm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_MESH_REPLY); 393 srm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_CADET_REPLY);
394 srm->type = htonl (type); 394 srm->type = htonl (type);
395 srm->expiration = GNUNET_TIME_absolute_hton (expiration); 395 srm->expiration = GNUNET_TIME_absolute_hton (expiration);
396 memcpy (&srm[1], data, size); 396 memcpy (&srm[1], data, size);
@@ -408,7 +408,7 @@ handle_datastore_reply (void *cls,
408 * 408 *
409 * Do not call #GNUNET_SERVER_mst_destroy in callback 409 * Do not call #GNUNET_SERVER_mst_destroy in callback
410 * 410 *
411 * @param cls closure with the 'struct MeshClient' 411 * @param cls closure with the 'struct CadetClient'
412 * @param channel channel handle 412 * @param channel channel handle
413 * @param channel_ctx channel context 413 * @param channel_ctx channel context
414 * @param message the actual message 414 * @param message the actual message
@@ -416,20 +416,20 @@ handle_datastore_reply (void *cls,
416 */ 416 */
417static int 417static int
418request_cb (void *cls, 418request_cb (void *cls,
419 struct GNUNET_MESH_Channel *channel, 419 struct GNUNET_CADET_Channel *channel,
420 void **channel_ctx, 420 void **channel_ctx,
421 const struct GNUNET_MessageHeader *message) 421 const struct GNUNET_MessageHeader *message)
422{ 422{
423 struct MeshClient *sc = *channel_ctx; 423 struct CadetClient *sc = *channel_ctx;
424 const struct MeshQueryMessage *sqm; 424 const struct CadetQueryMessage *sqm;
425 425
426 sqm = (const struct MeshQueryMessage *) message; 426 sqm = (const struct CadetQueryMessage *) message;
427 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 427 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
428 "Received query for `%s' via mesh from client %p\n", 428 "Received query for `%s' via cadet from client %p\n",
429 GNUNET_h2s (&sqm->query), 429 GNUNET_h2s (&sqm->query),
430 sc); 430 sc);
431 GNUNET_STATISTICS_update (GSF_stats, 431 GNUNET_STATISTICS_update (GSF_stats,
432 gettext_noop ("# queries received via mesh"), 1, 432 gettext_noop ("# queries received via cadet"), 1,
433 GNUNET_NO); 433 GNUNET_NO);
434 refresh_timeout_task (sc); 434 refresh_timeout_task (sc);
435 sc->qe = GNUNET_DATASTORE_get_key (GSF_dsh, 435 sc->qe = GNUNET_DATASTORE_get_key (GSF_dsh,
@@ -451,37 +451,37 @@ request_cb (void *cls,
451 451
452 452
453/** 453/**
454 * Functions of this type are called upon new mesh connection from other peers. 454 * Functions of this type are called upon new cadet connection from other peers.
455 * 455 *
456 * @param cls the closure from GNUNET_MESH_connect 456 * @param cls the closure from GNUNET_CADET_connect
457 * @param channel the channel representing the mesh 457 * @param channel the channel representing the cadet
458 * @param initiator the identity of the peer who wants to establish a mesh 458 * @param initiator the identity of the peer who wants to establish a cadet
459 * with us; NULL on binding error 459 * with us; NULL on binding error
460 * @param port mesh port used for the incoming connection 460 * @param port cadet port used for the incoming connection
461 * @param options channel option flags 461 * @param options channel option flags
462 * @return initial channel context (our 'struct MeshClient') 462 * @return initial channel context (our 'struct CadetClient')
463 */ 463 */
464static void * 464static void *
465accept_cb (void *cls, 465accept_cb (void *cls,
466 struct GNUNET_MESH_Channel *channel, 466 struct GNUNET_CADET_Channel *channel,
467 const struct GNUNET_PeerIdentity *initiator, 467 const struct GNUNET_PeerIdentity *initiator,
468 uint32_t port, enum GNUNET_MESH_ChannelOption options) 468 uint32_t port, enum GNUNET_CADET_ChannelOption options)
469{ 469{
470 struct MeshClient *sc; 470 struct CadetClient *sc;
471 471
472 GNUNET_assert (NULL != channel); 472 GNUNET_assert (NULL != channel);
473 if (sc_count >= sc_count_max) 473 if (sc_count >= sc_count_max)
474 { 474 {
475 GNUNET_STATISTICS_update (GSF_stats, 475 GNUNET_STATISTICS_update (GSF_stats,
476 gettext_noop ("# mesh client connections rejected"), 1, 476 gettext_noop ("# cadet client connections rejected"), 1,
477 GNUNET_NO); 477 GNUNET_NO);
478 GNUNET_MESH_channel_destroy (channel); 478 GNUNET_CADET_channel_destroy (channel);
479 return NULL; 479 return NULL;
480 } 480 }
481 GNUNET_STATISTICS_update (GSF_stats, 481 GNUNET_STATISTICS_update (GSF_stats,
482 gettext_noop ("# mesh connections active"), 1, 482 gettext_noop ("# cadet connections active"), 1,
483 GNUNET_NO); 483 GNUNET_NO);
484 sc = GNUNET_new (struct MeshClient); 484 sc = GNUNET_new (struct CadetClient);
485 sc->channel = channel; 485 sc->channel = channel;
486 GNUNET_CONTAINER_DLL_insert (sc_head, 486 GNUNET_CONTAINER_DLL_insert (sc_head,
487 sc_tail, 487 sc_tail,
@@ -489,7 +489,7 @@ accept_cb (void *cls,
489 sc_count++; 489 sc_count++;
490 refresh_timeout_task (sc); 490 refresh_timeout_task (sc);
491 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 491 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
492 "Accepting inbound mesh connection from `%s' as client %p\n", 492 "Accepting inbound cadet connection from `%s' as client %p\n",
493 GNUNET_i2s (initiator), 493 GNUNET_i2s (initiator),
494 sc); 494 sc);
495 return sc; 495 return sc;
@@ -497,36 +497,36 @@ accept_cb (void *cls,
497 497
498 498
499/** 499/**
500 * Function called by mesh when a client disconnects. 500 * Function called by cadet when a client disconnects.
501 * Cleans up our 'struct MeshClient' of that channel. 501 * Cleans up our 'struct CadetClient' of that channel.
502 * 502 *
503 * @param cls NULL 503 * @param cls NULL
504 * @param channel channel of the disconnecting client 504 * @param channel channel of the disconnecting client
505 * @param channel_ctx our 'struct MeshClient' 505 * @param channel_ctx our 'struct CadetClient'
506 */ 506 */
507static void 507static void
508cleaner_cb (void *cls, 508cleaner_cb (void *cls,
509 const struct GNUNET_MESH_Channel *channel, 509 const struct GNUNET_CADET_Channel *channel,
510 void *channel_ctx) 510 void *channel_ctx)
511{ 511{
512 struct MeshClient *sc = channel_ctx; 512 struct CadetClient *sc = channel_ctx;
513 struct WriteQueueItem *wqi; 513 struct WriteQueueItem *wqi;
514 514
515 if (NULL == sc) 515 if (NULL == sc)
516 return; 516 return;
517 sc->channel = NULL; 517 sc->channel = NULL;
518 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 518 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
519 "Terminating mesh connection with client %p\n", 519 "Terminating cadet connection with client %p\n",
520 sc); 520 sc);
521 GNUNET_STATISTICS_update (GSF_stats, 521 GNUNET_STATISTICS_update (GSF_stats,
522 gettext_noop ("# mesh connections active"), -1, 522 gettext_noop ("# cadet connections active"), -1,
523 GNUNET_NO); 523 GNUNET_NO);
524 if (GNUNET_SCHEDULER_NO_TASK != sc->terminate_task) 524 if (GNUNET_SCHEDULER_NO_TASK != sc->terminate_task)
525 GNUNET_SCHEDULER_cancel (sc->terminate_task); 525 GNUNET_SCHEDULER_cancel (sc->terminate_task);
526 if (GNUNET_SCHEDULER_NO_TASK != sc->timeout_task) 526 if (GNUNET_SCHEDULER_NO_TASK != sc->timeout_task)
527 GNUNET_SCHEDULER_cancel (sc->timeout_task); 527 GNUNET_SCHEDULER_cancel (sc->timeout_task);
528 if (NULL != sc->wh) 528 if (NULL != sc->wh)
529 GNUNET_MESH_notify_transmit_ready_cancel (sc->wh); 529 GNUNET_CADET_notify_transmit_ready_cancel (sc->wh);
530 if (NULL != sc->qe) 530 if (NULL != sc->qe)
531 GNUNET_DATASTORE_cancel (sc->qe); 531 GNUNET_DATASTORE_cancel (sc->qe);
532 while (NULL != (wqi = sc->wqi_head)) 532 while (NULL != (wqi = sc->wqi_head))
@@ -548,10 +548,10 @@ cleaner_cb (void *cls,
548 * Initialize subsystem for non-anonymous file-sharing. 548 * Initialize subsystem for non-anonymous file-sharing.
549 */ 549 */
550void 550void
551GSF_mesh_start_server () 551GSF_cadet_start_server ()
552{ 552{
553 static const struct GNUNET_MESH_MessageHandler handlers[] = { 553 static const struct GNUNET_CADET_MessageHandler handlers[] = {
554 { &request_cb, GNUNET_MESSAGE_TYPE_FS_MESH_QUERY, sizeof (struct MeshQueryMessage)}, 554 { &request_cb, GNUNET_MESSAGE_TYPE_FS_CADET_QUERY, sizeof (struct CadetQueryMessage)},
555 { NULL, 0, 0 } 555 { NULL, 0, 0 }
556 }; 556 };
557 static const uint32_t ports[] = { 557 static const uint32_t ports[] = {
@@ -562,13 +562,13 @@ GSF_mesh_start_server ()
562 if (GNUNET_YES != 562 if (GNUNET_YES !=
563 GNUNET_CONFIGURATION_get_value_number (GSF_cfg, 563 GNUNET_CONFIGURATION_get_value_number (GSF_cfg,
564 "fs", 564 "fs",
565 "MAX_MESH_CLIENTS", 565 "MAX_CADET_CLIENTS",
566 &sc_count_max)) 566 &sc_count_max))
567 return; 567 return;
568 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 568 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
569 "Initializing mesh FS server with a limit of %llu connections\n", 569 "Initializing cadet FS server with a limit of %llu connections\n",
570 sc_count_max); 570 sc_count_max);
571 listen_channel = GNUNET_MESH_connect (GSF_cfg, 571 listen_channel = GNUNET_CADET_connect (GSF_cfg,
572 NULL, 572 NULL,
573 &accept_cb, 573 &accept_cb,
574 &cleaner_cb, 574 &cleaner_cb,
@@ -581,15 +581,15 @@ GSF_mesh_start_server ()
581 * Shutdown subsystem for non-anonymous file-sharing. 581 * Shutdown subsystem for non-anonymous file-sharing.
582 */ 582 */
583void 583void
584GSF_mesh_stop_server () 584GSF_cadet_stop_server ()
585{ 585{
586 if (NULL != listen_channel) 586 if (NULL != listen_channel)
587 { 587 {
588 GNUNET_MESH_disconnect (listen_channel); 588 GNUNET_CADET_disconnect (listen_channel);
589 listen_channel = NULL; 589 listen_channel = NULL;
590 } 590 }
591 GNUNET_assert (NULL == sc_head); 591 GNUNET_assert (NULL == sc_head);
592 GNUNET_assert (0 == sc_count); 592 GNUNET_assert (0 == sc_count);
593} 593}
594 594
595/* end of gnunet-service-fs_mesh.c */ 595/* end of gnunet-service-fs_cadet.c */
diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c
index 0af19d537..67c935acd 100644
--- a/src/fs/gnunet-service-fs_pr.c
+++ b/src/fs/gnunet-service-fs_pr.c
@@ -31,7 +31,7 @@
31#include "gnunet-service-fs_indexing.h" 31#include "gnunet-service-fs_indexing.h"
32#include "gnunet-service-fs_pe.h" 32#include "gnunet-service-fs_pe.h"
33#include "gnunet-service-fs_pr.h" 33#include "gnunet-service-fs_pr.h"
34#include "gnunet-service-fs_mesh.h" 34#include "gnunet-service-fs_cadet.h"
35 35
36 36
37/** 37/**
@@ -65,10 +65,10 @@
65#define INSANE_STATISTICS GNUNET_NO 65#define INSANE_STATISTICS GNUNET_NO
66 66
67/** 67/**
68 * If obtaining a block via mesh fails, how often do we retry it before 68 * If obtaining a block via cadet fails, how often do we retry it before
69 * giving up for good (and sticking to non-anonymous transfer)? 69 * giving up for good (and sticking to non-anonymous transfer)?
70 */ 70 */
71#define MESH_RETRY_MAX 3 71#define CADET_RETRY_MAX 3
72 72
73 73
74/** 74/**
@@ -117,9 +117,9 @@ struct GSF_PendingRequest
117 struct GNUNET_DHT_GetHandle *gh; 117 struct GNUNET_DHT_GetHandle *gh;
118 118
119 /** 119 /**
120 * Mesh request handle for this request (or NULL for none). 120 * Cadet request handle for this request (or NULL for none).
121 */ 121 */
122 struct GSF_MeshRequest *mesh_request; 122 struct GSF_CadetRequest *cadet_request;
123 123
124 /** 124 /**
125 * Function to call upon completion of the local get 125 * Function to call upon completion of the local get
@@ -174,10 +174,10 @@ struct GSF_PendingRequest
174 uint64_t first_uid; 174 uint64_t first_uid;
175 175
176 /** 176 /**
177 * How often have we retried this request via 'mesh'? 177 * How often have we retried this request via 'cadet'?
178 * (used to bound overall retries). 178 * (used to bound overall retries).
179 */ 179 */
180 unsigned int mesh_retry_count; 180 unsigned int cadet_retry_count;
181 181
182 /** 182 /**
183 * Number of valid entries in the 'replies_seen' array. 183 * Number of valid entries in the 'replies_seen' array.
@@ -595,11 +595,11 @@ clean_request (void *cls, const struct GNUNET_HashCode *key, void *value)
595 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 595 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
596 "Cleaning up pending request for `%s'.\n", 596 "Cleaning up pending request for `%s'.\n",
597 GNUNET_h2s (key)); 597 GNUNET_h2s (key));
598 if (NULL != pr->mesh_request) 598 if (NULL != pr->cadet_request)
599 { 599 {
600 pr->mesh_retry_count = MESH_RETRY_MAX; 600 pr->cadet_retry_count = CADET_RETRY_MAX;
601 GSF_mesh_query_cancel (pr->mesh_request); 601 GSF_cadet_query_cancel (pr->cadet_request);
602 pr->mesh_request = NULL; 602 pr->cadet_request = NULL;
603 } 603 }
604 if (NULL != (cont = pr->llc_cont)) 604 if (NULL != (cont = pr->llc_cont))
605 { 605 {
@@ -668,11 +668,11 @@ GSF_pending_request_cancel_ (struct GSF_PendingRequest *pr, int full_cleanup)
668 * but do NOT remove from our data-structures, we still need it there 668 * but do NOT remove from our data-structures, we still need it there
669 * to prevent the request from looping */ 669 * to prevent the request from looping */
670 pr->rh = NULL; 670 pr->rh = NULL;
671 if (NULL != pr->mesh_request) 671 if (NULL != pr->cadet_request)
672 { 672 {
673 pr->mesh_retry_count = MESH_RETRY_MAX; 673 pr->cadet_retry_count = CADET_RETRY_MAX;
674 GSF_mesh_query_cancel (pr->mesh_request); 674 GSF_cadet_query_cancel (pr->cadet_request);
675 pr->mesh_request = NULL; 675 pr->cadet_request = NULL;
676 } 676 }
677 if (NULL != (cont = pr->llc_cont)) 677 if (NULL != (cont = pr->llc_cont))
678 { 678 {
@@ -1139,7 +1139,7 @@ GSF_dht_lookup_ (struct GSF_PendingRequest *pr)
1139 1139
1140 1140
1141/** 1141/**
1142 * Function called with a reply from the mesh. 1142 * Function called with a reply from the cadet.
1143 * 1143 *
1144 * @param cls the pending request struct 1144 * @param cls the pending request struct
1145 * @param type type of the block, ANY on error 1145 * @param type type of the block, ANY on error
@@ -1148,7 +1148,7 @@ GSF_dht_lookup_ (struct GSF_PendingRequest *pr)
1148 * @param data reply block data, NULL on error 1148 * @param data reply block data, NULL on error
1149 */ 1149 */
1150static void 1150static void
1151mesh_reply_proc (void *cls, 1151cadet_reply_proc (void *cls,
1152 enum GNUNET_BLOCK_Type type, 1152 enum GNUNET_BLOCK_Type type,
1153 struct GNUNET_TIME_Absolute expiration, 1153 struct GNUNET_TIME_Absolute expiration,
1154 size_t data_size, 1154 size_t data_size,
@@ -1158,22 +1158,22 @@ mesh_reply_proc (void *cls,
1158 struct ProcessReplyClosure prq; 1158 struct ProcessReplyClosure prq;
1159 struct GNUNET_HashCode query; 1159 struct GNUNET_HashCode query;
1160 1160
1161 pr->mesh_request = NULL; 1161 pr->cadet_request = NULL;
1162 if (GNUNET_BLOCK_TYPE_ANY == type) 1162 if (GNUNET_BLOCK_TYPE_ANY == type)
1163 { 1163 {
1164 GNUNET_break (NULL == data); 1164 GNUNET_break (NULL == data);
1165 GNUNET_break (0 == data_size); 1165 GNUNET_break (0 == data_size);
1166 pr->mesh_retry_count++; 1166 pr->cadet_retry_count++;
1167 if (pr->mesh_retry_count >= MESH_RETRY_MAX) 1167 if (pr->cadet_retry_count >= CADET_RETRY_MAX)
1168 return; /* give up on mesh */ 1168 return; /* give up on cadet */
1169 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1169 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1170 "Error retrieiving block via mesh\n"); 1170 "Error retrieiving block via cadet\n");
1171 /* retry -- without delay, as this is non-anonymous 1171 /* retry -- without delay, as this is non-anonymous
1172 and mesh/mesh connect will take some time anyway */ 1172 and cadet/cadet connect will take some time anyway */
1173 pr->mesh_request = GSF_mesh_query (pr->public_data.target, 1173 pr->cadet_request = GSF_cadet_query (pr->public_data.target,
1174 &pr->public_data.query, 1174 &pr->public_data.query,
1175 pr->public_data.type, 1175 pr->public_data.type,
1176 &mesh_reply_proc, 1176 &cadet_reply_proc,
1177 pr); 1177 pr);
1178 return; 1178 return;
1179 } 1179 }
@@ -1189,7 +1189,7 @@ mesh_reply_proc (void *cls,
1189 return; 1189 return;
1190 } 1190 }
1191 GNUNET_STATISTICS_update (GSF_stats, 1191 GNUNET_STATISTICS_update (GSF_stats,
1192 gettext_noop ("# Replies received from MESH"), 1, 1192 gettext_noop ("# Replies received from CADET"), 1,
1193 GNUNET_NO); 1193 GNUNET_NO);
1194 memset (&prq, 0, sizeof (prq)); 1194 memset (&prq, 0, sizeof (prq));
1195 prq.data = data; 1195 prq.data = data;
@@ -1204,27 +1204,27 @@ mesh_reply_proc (void *cls,
1204 1204
1205 1205
1206/** 1206/**
1207 * Consider downloading via mesh (if possible) 1207 * Consider downloading via cadet (if possible)
1208 * 1208 *
1209 * @param pr the pending request to process 1209 * @param pr the pending request to process
1210 */ 1210 */
1211void 1211void
1212GSF_mesh_lookup_ (struct GSF_PendingRequest *pr) 1212GSF_cadet_lookup_ (struct GSF_PendingRequest *pr)
1213{ 1213{
1214 if (0 != pr->public_data.anonymity_level) 1214 if (0 != pr->public_data.anonymity_level)
1215 return; 1215 return;
1216 if (0 == pr->public_data.target) 1216 if (0 == pr->public_data.target)
1217 { 1217 {
1218 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1218 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1219 "Cannot do mesh-based download, target peer not known\n"); 1219 "Cannot do cadet-based download, target peer not known\n");
1220 return; 1220 return;
1221 } 1221 }
1222 if (NULL != pr->mesh_request) 1222 if (NULL != pr->cadet_request)
1223 return; 1223 return;
1224 pr->mesh_request = GSF_mesh_query (pr->public_data.target, 1224 pr->cadet_request = GSF_cadet_query (pr->public_data.target,
1225 &pr->public_data.query, 1225 &pr->public_data.query,
1226 pr->public_data.type, 1226 pr->public_data.type,
1227 &mesh_reply_proc, 1227 &cadet_reply_proc,
1228 pr); 1228 pr);
1229} 1229}
1230 1230
@@ -1553,7 +1553,7 @@ GSF_local_lookup_ (struct GSF_PendingRequest *pr,
1553 GSF_LocalLookupContinuation cont, void *cont_cls) 1553 GSF_LocalLookupContinuation cont, void *cont_cls)
1554{ 1554{
1555 GNUNET_assert (NULL == pr->gh); 1555 GNUNET_assert (NULL == pr->gh);
1556 GNUNET_assert (NULL == pr->mesh_request); 1556 GNUNET_assert (NULL == pr->cadet_request);
1557 GNUNET_assert (NULL == pr->llc_cont); 1557 GNUNET_assert (NULL == pr->llc_cont);
1558 pr->llc_cont = cont; 1558 pr->llc_cont = cont;
1559 pr->llc_cont_cls = cont_cls; 1559 pr->llc_cont_cls = cont_cls;
diff --git a/src/fs/gnunet-service-fs_pr.h b/src/fs/gnunet-service-fs_pr.h
index 022e13eb4..309565d7e 100644
--- a/src/fs/gnunet-service-fs_pr.h
+++ b/src/fs/gnunet-service-fs_pr.h
@@ -351,12 +351,12 @@ GSF_dht_lookup_ (struct GSF_PendingRequest *pr);
351 351
352 352
353/** 353/**
354 * Consider downloading via mesh (if possible) 354 * Consider downloading via cadet (if possible)
355 * 355 *
356 * @param pr the pending request to process 356 * @param pr the pending request to process
357 */ 357 */
358void 358void
359GSF_mesh_lookup_ (struct GSF_PendingRequest *pr); 359GSF_cadet_lookup_ (struct GSF_PendingRequest *pr);
360 360
361 361
362/** 362/**
diff --git a/src/fs/test_fs_download.c b/src/fs/test_fs_download.c
index 51f05192e..8dee24912 100644
--- a/src/fs/test_fs_download.c
+++ b/src/fs/test_fs_download.c
@@ -331,10 +331,10 @@ main (int argc, char *argv[])
331 binary_name = "test-fs-download-indexed"; 331 binary_name = "test-fs-download-indexed";
332 config_name = "test_fs_download_indexed.conf"; 332 config_name = "test_fs_download_indexed.conf";
333 } 333 }
334 if (NULL != strstr (argv[0], "mesh")) 334 if (NULL != strstr (argv[0], "cadet"))
335 { 335 {
336 binary_name = "test-fs-download-mesh"; 336 binary_name = "test-fs-download-cadet";
337 config_name = "test_fs_download_mesh.conf"; 337 config_name = "test_fs_download_cadet.conf";
338 } 338 }
339 if (0 != GNUNET_TESTING_peer_run (binary_name, 339 if (0 != GNUNET_TESTING_peer_run (binary_name,
340 config_name, 340 config_name,
diff --git a/src/fs/test_gnunet_service_fs_p2p.c b/src/fs/test_gnunet_service_fs_p2p.c
index 034bb7b0e..75f85a76f 100644
--- a/src/fs/test_gnunet_service_fs_p2p.c
+++ b/src/fs/test_gnunet_service_fs_p2p.c
@@ -122,7 +122,7 @@ do_publish (void *cls,
122{ 122{
123 unsigned int i; 123 unsigned int i;
124 124
125 if (NULL != strstr (progname, "mesh")) 125 if (NULL != strstr (progname, "cadet"))
126 anonymity_level = 0; 126 anonymity_level = 0;
127 else 127 else
128 anonymity_level = 1; 128 anonymity_level = 1;
@@ -144,8 +144,8 @@ main (int argc, char *argv[])
144 const char *config; 144 const char *config;
145 145
146 progname = argv[0]; 146 progname = argv[0];
147 if (NULL != strstr (progname, "mesh")) 147 if (NULL != strstr (progname, "cadet"))
148 config = "test_gnunet_service_fs_p2p_mesh.conf"; 148 config = "test_gnunet_service_fs_p2p_cadet.conf";
149 else 149 else
150 config = "fs_test_lib_data.conf"; 150 config = "fs_test_lib_data.conf";
151 (void) GNUNET_TESTBED_test_run ("test-gnunet-service-fs-p2p", 151 (void) GNUNET_TESTBED_test_run ("test-gnunet-service-fs-p2p",
diff --git a/src/include/gnunet_applications.h b/src/include/gnunet_applications.h
index b9337addf..6e3d82cae 100644
--- a/src/include/gnunet_applications.h
+++ b/src/include/gnunet_applications.h
@@ -20,7 +20,7 @@
20 20
21/** 21/**
22 * @file include/gnunet_applications.h 22 * @file include/gnunet_applications.h
23 * @brief constants for network applications operating on top of the MESH service 23 * @brief constants for network applications operating on top of the CADET service
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
26 26
diff --git a/src/include/gnunet_block_lib.h b/src/include/gnunet_block_lib.h
index 0da8c03f4..e938acda4 100644
--- a/src/include/gnunet_block_lib.h
+++ b/src/include/gnunet_block_lib.h
@@ -80,7 +80,7 @@ enum GNUNET_BLOCK_Type
80 80
81 /** 81 /**
82 * Type of a block that contains a HELLO for a peer (for 82 * Type of a block that contains a HELLO for a peer (for
83 * DHT and MESH find-peer operations). 83 * DHT and CADET find-peer operations).
84 */ 84 */
85 GNUNET_BLOCK_TYPE_DHT_HELLO = 7, 85 GNUNET_BLOCK_TYPE_DHT_HELLO = 7,
86 86
@@ -107,12 +107,12 @@ enum GNUNET_BLOCK_Type
107 GNUNET_BLOCK_TYPE_GNS_NAMERECORD = 11, 107 GNUNET_BLOCK_TYPE_GNS_NAMERECORD = 11,
108 108
109 /** 109 /**
110 * Block to store a mesh regex state 110 * Block to store a cadet regex state
111 */ 111 */
112 GNUNET_BLOCK_TYPE_REGEX = 22, 112 GNUNET_BLOCK_TYPE_REGEX = 22,
113 113
114 /** 114 /**
115 * Block to store a mesh regex accepting state 115 * Block to store a cadet regex accepting state
116 */ 116 */
117 GNUNET_BLOCK_TYPE_REGEX_ACCEPT = 23 117 GNUNET_BLOCK_TYPE_REGEX_ACCEPT = 23
118}; 118};
diff --git a/src/include/gnunet_core_service.h b/src/include/gnunet_core_service.h
index c4acd3564..7b039ed99 100644
--- a/src/include/gnunet_core_service.h
+++ b/src/include/gnunet_core_service.h
@@ -58,7 +58,7 @@ enum GNUNET_CORE_Priority
58 GNUNET_CORE_PRIO_BACKGROUND = 0, 58 GNUNET_CORE_PRIO_BACKGROUND = 0,
59 59
60 /** 60 /**
61 * Normal traffic (i.e. mesh/dv relay, DHT) 61 * Normal traffic (i.e. cadet/dv relay, DHT)
62 */ 62 */
63 GNUNET_CORE_PRIO_BEST_EFFORT = 1, 63 GNUNET_CORE_PRIO_BEST_EFFORT = 1,
64 64
@@ -68,7 +68,7 @@ enum GNUNET_CORE_Priority
68 GNUNET_CORE_PRIO_URGENT = 2, 68 GNUNET_CORE_PRIO_URGENT = 2,
69 69
70 /** 70 /**
71 * Highest priority, control traffic (i.e. NSE, Core/Mesh KX). 71 * Highest priority, control traffic (i.e. NSE, Core/Cadet KX).
72 */ 72 */
73 GNUNET_CORE_PRIO_CRITICAL_CONTROL = 3 73 GNUNET_CORE_PRIO_CRITICAL_CONTROL = 3
74 74
diff --git a/src/include/gnunet_mesh_service.h b/src/include/gnunet_mesh_service.h
index e49b89556..e69c9eaa7 100644
--- a/src/include/gnunet_mesh_service.h
+++ b/src/include/gnunet_mesh_service.h
@@ -19,13 +19,13 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file include/gnunet_mesh_service.h 22 * @file include/gnunet_cadet_service.h
23 * @brief mesh service; establish channels to distant peers 23 * @brief cadet service; establish channels to distant peers
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
26 26
27#ifndef GNUNET_MESH_SERVICE_H 27#ifndef GNUNET_CADET_SERVICE_H
28#define GNUNET_MESH_SERVICE_H 28#define GNUNET_CADET_SERVICE_H
29 29
30#ifdef __cplusplus 30#ifdef __cplusplus
31extern "C" 31extern "C"
@@ -39,66 +39,66 @@ extern "C"
39#include "gnunet_transport_service.h" 39#include "gnunet_transport_service.h"
40 40
41/** 41/**
42 * Version number of GNUnet-mesh API. 42 * Version number of GNUnet-cadet API.
43 */ 43 */
44#define GNUNET_MESH_VERSION 0x00000003 44#define GNUNET_CADET_VERSION 0x00000003
45 45
46 46
47/** 47/**
48 * Opaque handle to the service. 48 * Opaque handle to the service.
49 */ 49 */
50struct GNUNET_MESH_Handle; 50struct GNUNET_CADET_Handle;
51 51
52/** 52/**
53 * Opaque handle to a channel. 53 * Opaque handle to a channel.
54 */ 54 */
55struct GNUNET_MESH_Channel; 55struct GNUNET_CADET_Channel;
56 56
57/** 57/**
58 * Hash to be used in Mesh communication. Only 256 bits needed, 58 * Hash to be used in Cadet communication. Only 256 bits needed,
59 * instead of the 512 from @c GNUNET_HashCode. 59 * instead of the 512 from @c GNUNET_HashCode.
60 * 60 *
61 */ 61 */
62struct GNUNET_MESH_Hash 62struct GNUNET_CADET_Hash
63{ 63{
64 unsigned char bits[256 / 8]; 64 unsigned char bits[256 / 8];
65}; 65};
66 66
67/** 67/**
68 * Channel options. 68 * Channel options.
69 * Second line indicates filed in the MeshChannelInfo union carrying the answer. 69 * Second line indicates filed in the CadetChannelInfo union carrying the answer.
70 */ 70 */
71enum GNUNET_MESH_ChannelOption 71enum GNUNET_CADET_ChannelOption
72{ 72{
73 /** 73 /**
74 * Default options: unreliable, default buffering, not out of order. 74 * Default options: unreliable, default buffering, not out of order.
75 */ 75 */
76 GNUNET_MESH_OPTION_DEFAULT = 0x0, 76 GNUNET_CADET_OPTION_DEFAULT = 0x0,
77 77
78 /** 78 /**
79 * Disable buffering on intermediate nodes (for minimum latency). 79 * Disable buffering on intermediate nodes (for minimum latency).
80 * Yes/No. 80 * Yes/No.
81 */ 81 */
82 GNUNET_MESH_OPTION_NOBUFFER = 0x1, 82 GNUNET_CADET_OPTION_NOBUFFER = 0x1,
83 83
84 /** 84 /**
85 * Enable channel reliability, lost messages will be retransmitted. 85 * Enable channel reliability, lost messages will be retransmitted.
86 * Yes/No. 86 * Yes/No.
87 */ 87 */
88 GNUNET_MESH_OPTION_RELIABLE = 0x2, 88 GNUNET_CADET_OPTION_RELIABLE = 0x2,
89 89
90 /** 90 /**
91 * Enable out of order delivery of messages. 91 * Enable out of order delivery of messages.
92 * Yes/No. 92 * Yes/No.
93 */ 93 */
94 GNUNET_MESH_OPTION_OOORDER = 0x4, 94 GNUNET_CADET_OPTION_OOORDER = 0x4,
95 95
96 /** 96 /**
97 * Who is the peer at the other end of the channel. 97 * Who is the peer at the other end of the channel.
98 * Only for use in @c GNUNET_MESH_channel_get_info 98 * Only for use in @c GNUNET_CADET_channel_get_info
99 * struct GNUNET_PeerIdentity *peer 99 * struct GNUNET_PeerIdentity *peer
100 */ 100 */
101 GNUNET_MESH_OPTION_PEER = 0x8 101 GNUNET_CADET_OPTION_PEER = 0x8
102 102
103}; 103};
104 104
@@ -107,19 +107,19 @@ enum GNUNET_MESH_ChannelOption
107 * Functions with this signature are called whenever a message is 107 * Functions with this signature are called whenever a message is
108 * received. 108 * received.
109 * 109 *
110 * Each time the function must call #GNUNET_MESH_receive_done on the channel 110 * Each time the function must call #GNUNET_CADET_receive_done on the channel
111 * in order to receive the next message. This doesn't need to be immediate: 111 * in order to receive the next message. This doesn't need to be immediate:
112 * can be delayed if some processing is done on the message. 112 * can be delayed if some processing is done on the message.
113 * 113 *
114 * @param cls Closure (set from #GNUNET_MESH_connect). 114 * @param cls Closure (set from #GNUNET_CADET_connect).
115 * @param channel Connection to the other end. 115 * @param channel Connection to the other end.
116 * @param channel_ctx Place to store local state associated with the channel. 116 * @param channel_ctx Place to store local state associated with the channel.
117 * @param message The actual message. 117 * @param message The actual message.
118 * @return #GNUNET_OK to keep the channel open, 118 * @return #GNUNET_OK to keep the channel open,
119 * #GNUNET_SYSERR to close it (signal serious error). 119 * #GNUNET_SYSERR to close it (signal serious error).
120 */ 120 */
121typedef int (*GNUNET_MESH_MessageCallback) (void *cls, 121typedef int (*GNUNET_CADET_MessageCallback) (void *cls,
122 struct GNUNET_MESH_Channel *channel, 122 struct GNUNET_CADET_Channel *channel,
123 void **channel_ctx, 123 void **channel_ctx,
124 const struct GNUNET_MessageHeader *message); 124 const struct GNUNET_MessageHeader *message);
125 125
@@ -128,12 +128,12 @@ typedef int (*GNUNET_MESH_MessageCallback) (void *cls,
128 * Message handler. Each struct specifies how to handle on particular 128 * Message handler. Each struct specifies how to handle on particular
129 * type of message received. 129 * type of message received.
130 */ 130 */
131struct GNUNET_MESH_MessageHandler 131struct GNUNET_CADET_MessageHandler
132{ 132{
133 /** 133 /**
134 * Function to call for messages of "type". 134 * Function to call for messages of "type".
135 */ 135 */
136 GNUNET_MESH_MessageCallback callback; 136 GNUNET_CADET_MessageCallback callback;
137 137
138 /** 138 /**
139 * Type of the message this handler covers. 139 * Type of the message this handler covers.
@@ -153,29 +153,29 @@ struct GNUNET_MESH_MessageHandler
153 * Method called whenever another peer has added us to a channel 153 * Method called whenever another peer has added us to a channel
154 * the other peer initiated. 154 * the other peer initiated.
155 * Only called (once) upon reception of data with a message type which was 155 * Only called (once) upon reception of data with a message type which was
156 * subscribed to in #GNUNET_MESH_connect. 156 * subscribed to in #GNUNET_CADET_connect.
157 * 157 *
158 * A call to #GNUNET_MESH_channel_destroy causes te channel to be ignored. In 158 * A call to #GNUNET_CADET_channel_destroy causes te channel to be ignored. In
159 * this case the handler MUST return NULL. 159 * this case the handler MUST return NULL.
160 * 160 *
161 * @param cls closure 161 * @param cls closure
162 * @param channel new handle to the channel 162 * @param channel new handle to the channel
163 * @param initiator peer that started the channel 163 * @param initiator peer that started the channel
164 * @param port Port this channel is for. 164 * @param port Port this channel is for.
165 * @param options MeshOption flag field, with all active option bits set to 1. 165 * @param options CadetOption flag field, with all active option bits set to 1.
166 * 166 *
167 * @return initial channel context for the channel 167 * @return initial channel context for the channel
168 * (can be NULL -- that's not an error) 168 * (can be NULL -- that's not an error)
169 */ 169 */
170typedef void *(GNUNET_MESH_InboundChannelNotificationHandler) (void *cls, 170typedef void *(GNUNET_CADET_InboundChannelNotificationHandler) (void *cls,
171 struct 171 struct
172 GNUNET_MESH_Channel 172 GNUNET_CADET_Channel
173 * channel, 173 * channel,
174 const struct 174 const struct
175 GNUNET_PeerIdentity 175 GNUNET_PeerIdentity
176 * initiator, 176 * initiator,
177 uint32_t port, 177 uint32_t port,
178 enum GNUNET_MESH_ChannelOption 178 enum GNUNET_CADET_ChannelOption
179 options); 179 options);
180 180
181 181
@@ -183,21 +183,21 @@ typedef void *(GNUNET_MESH_InboundChannelNotificationHandler) (void *cls,
183 * Function called whenever a channel is destroyed. Should clean up 183 * Function called whenever a channel is destroyed. Should clean up
184 * any associated state. 184 * any associated state.
185 * 185 *
186 * It must NOT call #GNUNET_MESH_channel_destroy on the channel. 186 * It must NOT call #GNUNET_CADET_channel_destroy on the channel.
187 * 187 *
188 * @param cls closure (set from #GNUNET_MESH_connect) 188 * @param cls closure (set from #GNUNET_CADET_connect)
189 * @param channel connection to the other end (henceforth invalid) 189 * @param channel connection to the other end (henceforth invalid)
190 * @param channel_ctx place where local state associated 190 * @param channel_ctx place where local state associated
191 * with the channel is stored 191 * with the channel is stored
192 */ 192 */
193typedef void (GNUNET_MESH_ChannelEndHandler) (void *cls, 193typedef void (GNUNET_CADET_ChannelEndHandler) (void *cls,
194 const struct GNUNET_MESH_Channel * 194 const struct GNUNET_CADET_Channel *
195 channel, 195 channel,
196 void *channel_ctx); 196 void *channel_ctx);
197 197
198 198
199/** 199/**
200 * Connect to the mesh service. 200 * Connect to the cadet service.
201 * 201 *
202 * @param cfg Configuration to use. 202 * @param cfg Configuration to use.
203 * @param cls Closure for the various callbacks that follow (including 203 * @param cls Closure for the various callbacks that follow (including
@@ -206,59 +206,59 @@ typedef void (GNUNET_MESH_ChannelEndHandler) (void *cls,
206 * Can be NULL if no inbound channels are desired. 206 * Can be NULL if no inbound channels are desired.
207 * See @a ports. 207 * See @a ports.
208 * @param cleaner Function called when a channel is destroyed by the remote peer. 208 * @param cleaner Function called when a channel is destroyed by the remote peer.
209 * It is NOT called if #GNUNET_MESH_channel_destroy is called on 209 * It is NOT called if #GNUNET_CADET_channel_destroy is called on
210 * the channel. 210 * the channel.
211 * @param handlers Callbacks for messages we care about, NULL-terminated. Each 211 * @param handlers Callbacks for messages we care about, NULL-terminated. Each
212 * one must call #GNUNET_MESH_receive_done on the channel to 212 * one must call #GNUNET_CADET_receive_done on the channel to
213 * receive the next message. Messages of a type that is not 213 * receive the next message. Messages of a type that is not
214 * in the handlers array are ignored if received. 214 * in the handlers array are ignored if received.
215 * @param ports NULL or 0-terminated array of port numbers for incoming channels. 215 * @param ports NULL or 0-terminated array of port numbers for incoming channels.
216 * See @a new_channel. 216 * See @a new_channel.
217 * 217 *
218 * @return handle to the mesh service NULL on error 218 * @return handle to the cadet service NULL on error
219 * (in this case, init is never called) 219 * (in this case, init is never called)
220 */ 220 */
221struct GNUNET_MESH_Handle * 221struct GNUNET_CADET_Handle *
222GNUNET_MESH_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, void *cls, 222GNUNET_CADET_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, void *cls,
223 GNUNET_MESH_InboundChannelNotificationHandler new_channel, 223 GNUNET_CADET_InboundChannelNotificationHandler new_channel,
224 GNUNET_MESH_ChannelEndHandler cleaner, 224 GNUNET_CADET_ChannelEndHandler cleaner,
225 const struct GNUNET_MESH_MessageHandler *handlers, 225 const struct GNUNET_CADET_MessageHandler *handlers,
226 const uint32_t *ports); 226 const uint32_t *ports);
227 227
228 228
229/** 229/**
230 * Disconnect from the mesh service. All channels will be destroyed. All channel 230 * Disconnect from the cadet service. All channels will be destroyed. All channel
231 * disconnect callbacks will be called on any still connected peers, notifying 231 * disconnect callbacks will be called on any still connected peers, notifying
232 * about their disconnection. The registered inbound channel cleaner will be 232 * about their disconnection. The registered inbound channel cleaner will be
233 * called should any inbound channels still exist. 233 * called should any inbound channels still exist.
234 * 234 *
235 * @param handle connection to mesh to disconnect 235 * @param handle connection to cadet to disconnect
236 */ 236 */
237void 237void
238GNUNET_MESH_disconnect (struct GNUNET_MESH_Handle *handle); 238GNUNET_CADET_disconnect (struct GNUNET_CADET_Handle *handle);
239 239
240 240
241/** 241/**
242 * Create a new channel towards a remote peer. 242 * Create a new channel towards a remote peer.
243 * 243 *
244 * If the destination port is not open by any peer or the destination peer 244 * If the destination port is not open by any peer or the destination peer
245 * does not accept the channel, #GNUNET_MESH_ChannelEndHandler will be called 245 * does not accept the channel, #GNUNET_CADET_ChannelEndHandler will be called
246 * for this channel. 246 * for this channel.
247 * 247 *
248 * @param h mesh handle 248 * @param h cadet handle
249 * @param channel_ctx client's channel context to associate with the channel 249 * @param channel_ctx client's channel context to associate with the channel
250 * @param peer peer identity the channel should go to 250 * @param peer peer identity the channel should go to
251 * @param port Port number. 251 * @param port Port number.
252 * @param options MeshOption flag field, with all desired option bits set to 1. 252 * @param options CadetOption flag field, with all desired option bits set to 1.
253 * 253 *
254 * @return handle to the channel 254 * @return handle to the channel
255 */ 255 */
256struct GNUNET_MESH_Channel * 256struct GNUNET_CADET_Channel *
257GNUNET_MESH_channel_create (struct GNUNET_MESH_Handle *h, 257GNUNET_CADET_channel_create (struct GNUNET_CADET_Handle *h,
258 void *channel_ctx, 258 void *channel_ctx,
259 const struct GNUNET_PeerIdentity *peer, 259 const struct GNUNET_PeerIdentity *peer,
260 uint32_t port, 260 uint32_t port,
261 enum GNUNET_MESH_ChannelOption options); 261 enum GNUNET_CADET_ChannelOption options);
262 262
263 263
264/** 264/**
@@ -271,13 +271,13 @@ GNUNET_MESH_channel_create (struct GNUNET_MESH_Handle *h,
271 * @param channel Channel handle, becomes invalid after this call. 271 * @param channel Channel handle, becomes invalid after this call.
272 */ 272 */
273void 273void
274GNUNET_MESH_channel_destroy (struct GNUNET_MESH_Channel *channel); 274GNUNET_CADET_channel_destroy (struct GNUNET_CADET_Channel *channel);
275 275
276 276
277/** 277/**
278 * Struct to retrieve info about a channel. 278 * Struct to retrieve info about a channel.
279 */ 279 */
280union GNUNET_MESH_ChannelInfo 280union GNUNET_CADET_ChannelInfo
281{ 281{
282 282
283 /** 283 /**
@@ -296,23 +296,23 @@ union GNUNET_MESH_ChannelInfo
296 * Get information about a channel. 296 * Get information about a channel.
297 * 297 *
298 * @param channel Channel handle. 298 * @param channel Channel handle.
299 * @param option Query type GNUNET_MESH_OPTION_* 299 * @param option Query type GNUNET_CADET_OPTION_*
300 * @param ... dependant on option, currently not used 300 * @param ... dependant on option, currently not used
301 * @return Union with an answer to the query. 301 * @return Union with an answer to the query.
302 */ 302 */
303const union GNUNET_MESH_ChannelInfo * 303const union GNUNET_CADET_ChannelInfo *
304GNUNET_MESH_channel_get_info (struct GNUNET_MESH_Channel *channel, 304GNUNET_CADET_channel_get_info (struct GNUNET_CADET_Channel *channel,
305 enum GNUNET_MESH_ChannelOption option, ...); 305 enum GNUNET_CADET_ChannelOption option, ...);
306 306
307 307
308/** 308/**
309 * Handle for a transmission request. 309 * Handle for a transmission request.
310 */ 310 */
311struct GNUNET_MESH_TransmitHandle; 311struct GNUNET_CADET_TransmitHandle;
312 312
313 313
314/** 314/**
315 * Ask the mesh to call @a notify once it is ready to transmit the 315 * Ask the cadet to call @a notify once it is ready to transmit the
316 * given number of bytes to the specified channel. 316 * given number of bytes to the specified channel.
317 * Only one call can be active at any time, to issue another request, 317 * Only one call can be active at any time, to issue another request,
318 * wait for the callback or cancel the current request. 318 * wait for the callback or cancel the current request.
@@ -330,8 +330,8 @@ struct GNUNET_MESH_TransmitHandle;
330 * NULL if we can not even queue the request (insufficient 330 * NULL if we can not even queue the request (insufficient
331 * memory); if NULL is returned, @a notify will NOT be called. 331 * memory); if NULL is returned, @a notify will NOT be called.
332 */ 332 */
333struct GNUNET_MESH_TransmitHandle * 333struct GNUNET_CADET_TransmitHandle *
334GNUNET_MESH_notify_transmit_ready (struct GNUNET_MESH_Channel *channel, 334GNUNET_CADET_notify_transmit_ready (struct GNUNET_CADET_Channel *channel,
335 int cork, 335 int cork,
336 struct GNUNET_TIME_Relative maxdelay, 336 struct GNUNET_TIME_Relative maxdelay,
337 size_t notify_size, 337 size_t notify_size,
@@ -345,7 +345,7 @@ GNUNET_MESH_notify_transmit_ready (struct GNUNET_MESH_Channel *channel,
345 * @param th handle that was returned by "notify_transmit_ready". 345 * @param th handle that was returned by "notify_transmit_ready".
346 */ 346 */
347void 347void
348GNUNET_MESH_notify_transmit_ready_cancel (struct GNUNET_MESH_TransmitHandle 348GNUNET_CADET_notify_transmit_ready_cancel (struct GNUNET_CADET_TransmitHandle
349 *th); 349 *th);
350 350
351 351
@@ -357,23 +357,23 @@ GNUNET_MESH_notify_transmit_ready_cancel (struct GNUNET_MESH_TransmitHandle
357 * @param channel Channel that will be allowed to call another handler. 357 * @param channel Channel that will be allowed to call another handler.
358 */ 358 */
359void 359void
360GNUNET_MESH_receive_done (struct GNUNET_MESH_Channel *channel); 360GNUNET_CADET_receive_done (struct GNUNET_CADET_Channel *channel);
361 361
362 362
363 363
364/******************************************************************************/ 364/******************************************************************************/
365/******************** MONITORING /DEBUG API *************************/ 365/******************** MONITORING /DEBUG API *************************/
366/******************************************************************************/ 366/******************************************************************************/
367/* The following calls are not useful for normal MESH operation, but for */ 367/* The following calls are not useful for normal CADET operation, but for */
368/* debug and monitoring of the mesh state. They can be safely ignored. */ 368/* debug and monitoring of the cadet state. They can be safely ignored. */
369/* The API can change at any point without notice. */ 369/* The API can change at any point without notice. */
370/* Please contact the developer if you consider any of this calls useful for */ 370/* Please contact the developer if you consider any of this calls useful for */
371/* normal mesh applications. */ 371/* normal cadet applications. */
372/******************************************************************************/ 372/******************************************************************************/
373 373
374 374
375/** 375/**
376 * Method called to retrieve information about a specific channel the mesh peer 376 * Method called to retrieve information about a specific channel the cadet peer
377 * is aware of, including all transit nodes. 377 * is aware of, including all transit nodes.
378 * 378 *
379 * @param cls Closure. 379 * @param cls Closure.
@@ -384,7 +384,7 @@ GNUNET_MESH_receive_done (struct GNUNET_MESH_Channel *channel);
384 * @param dest_channel_number Local number for dest, if known. 384 * @param dest_channel_number Local number for dest, if known.
385 * @param public_channel_numbe Number for P2P, always known. 385 * @param public_channel_numbe Number for P2P, always known.
386 */ 386 */
387typedef void (*GNUNET_MESH_ChannelCB) (void *cls, 387typedef void (*GNUNET_CADET_ChannelCB) (void *cls,
388 const struct GNUNET_PeerIdentity *root, 388 const struct GNUNET_PeerIdentity *root,
389 const struct GNUNET_PeerIdentity *dest, 389 const struct GNUNET_PeerIdentity *dest,
390 uint32_t port, 390 uint32_t port,
@@ -393,7 +393,7 @@ typedef void (*GNUNET_MESH_ChannelCB) (void *cls,
393 uint32_t public_channel_number); 393 uint32_t public_channel_number);
394 394
395/** 395/**
396 * Method called to retrieve information about all peers in MESH, called 396 * Method called to retrieve information about all peers in CADET, called
397 * once per peer. 397 * once per peer.
398 * 398 *
399 * After last peer has been reported, an additional call with NULL is done. 399 * After last peer has been reported, an additional call with NULL is done.
@@ -405,7 +405,7 @@ typedef void (*GNUNET_MESH_ChannelCB) (void *cls,
405 * @param best_path How long is the best path? 405 * @param best_path How long is the best path?
406 * (0 = unknown, 1 = ourselves, 2 = neighbor) 406 * (0 = unknown, 1 = ourselves, 2 = neighbor)
407 */ 407 */
408typedef void (*GNUNET_MESH_PeersCB) (void *cls, 408typedef void (*GNUNET_CADET_PeersCB) (void *cls,
409 const struct GNUNET_PeerIdentity *peer, 409 const struct GNUNET_PeerIdentity *peer,
410 int tunnel, unsigned int n_paths, 410 int tunnel, unsigned int n_paths,
411 unsigned int best_path); 411 unsigned int best_path);
@@ -423,7 +423,7 @@ typedef void (*GNUNET_MESH_PeersCB) (void *cls,
423 * Each path starts with the local peer. 423 * Each path starts with the local peer.
424 * Each path ends with the destination peer (given in @c peer). 424 * Each path ends with the destination peer (given in @c peer).
425 */ 425 */
426typedef void (*GNUNET_MESH_PeerCB) (void *cls, 426typedef void (*GNUNET_CADET_PeerCB) (void *cls,
427 const struct GNUNET_PeerIdentity *peer, 427 const struct GNUNET_PeerIdentity *peer,
428 int tunnel, 428 int tunnel,
429 int neighbor, 429 int neighbor,
@@ -432,7 +432,7 @@ typedef void (*GNUNET_MESH_PeerCB) (void *cls,
432 432
433 433
434/** 434/**
435 * Method called to retrieve information about all tunnels in MESH, called 435 * Method called to retrieve information about all tunnels in CADET, called
436 * once per tunnel. 436 * once per tunnel.
437 * 437 *
438 * After last tunnel has been reported, an additional call with NULL is done. 438 * After last tunnel has been reported, an additional call with NULL is done.
@@ -444,7 +444,7 @@ typedef void (*GNUNET_MESH_PeerCB) (void *cls,
444 * @param estate Encryption state. 444 * @param estate Encryption state.
445 * @param cstate Connectivity state. 445 * @param cstate Connectivity state.
446 */ 446 */
447typedef void (*GNUNET_MESH_TunnelsCB) (void *cls, 447typedef void (*GNUNET_CADET_TunnelsCB) (void *cls,
448 const struct GNUNET_PeerIdentity *peer, 448 const struct GNUNET_PeerIdentity *peer,
449 unsigned int channels, 449 unsigned int channels,
450 unsigned int connections, 450 unsigned int connections,
@@ -454,7 +454,7 @@ typedef void (*GNUNET_MESH_TunnelsCB) (void *cls,
454 454
455 455
456/** 456/**
457 * Method called to retrieve information about a specific tunnel the mesh peer 457 * Method called to retrieve information about a specific tunnel the cadet peer
458 * has established, o`r is trying to establish. 458 * has established, o`r is trying to establish.
459 * 459 *
460 * @param cls Closure. 460 * @param cls Closure.
@@ -466,51 +466,51 @@ typedef void (*GNUNET_MESH_TunnelsCB) (void *cls,
466 * @param estate Encryption state. 466 * @param estate Encryption state.
467 * @param cstate Connectivity state. 467 * @param cstate Connectivity state.
468 */ 468 */
469typedef void (*GNUNET_MESH_TunnelCB) (void *cls, 469typedef void (*GNUNET_CADET_TunnelCB) (void *cls,
470 const struct GNUNET_PeerIdentity *peer, 470 const struct GNUNET_PeerIdentity *peer,
471 unsigned int n_channels, 471 unsigned int n_channels,
472 unsigned int n_connections, 472 unsigned int n_connections,
473 uint32_t *channels, 473 uint32_t *channels,
474 struct GNUNET_MESH_Hash *connections, 474 struct GNUNET_CADET_Hash *connections,
475 unsigned int estate, 475 unsigned int estate,
476 unsigned int cstate); 476 unsigned int cstate);
477 477
478/** 478/**
479 * Request information about a specific channel of the running mesh peer. 479 * Request information about a specific channel of the running cadet peer.
480 * 480 *
481 * WARNING: unstable API, likely to change in the future! 481 * WARNING: unstable API, likely to change in the future!
482 * 482 *
483 * @param h Handle to the mesh peer. 483 * @param h Handle to the cadet peer.
484 * @param peer ID of the other end of the channel. 484 * @param peer ID of the other end of the channel.
485 * @param channel_number Channel number. 485 * @param channel_number Channel number.
486 * @param callback Function to call with the requested data. 486 * @param callback Function to call with the requested data.
487 * @param callback_cls Closure for @c callback. 487 * @param callback_cls Closure for @c callback.
488 */ 488 */
489void 489void
490GNUNET_MESH_get_channel (struct GNUNET_MESH_Handle *h, 490GNUNET_CADET_get_channel (struct GNUNET_CADET_Handle *h,
491 struct GNUNET_PeerIdentity *peer, 491 struct GNUNET_PeerIdentity *peer,
492 uint32_t channel_number, 492 uint32_t channel_number,
493 GNUNET_MESH_ChannelCB callback, 493 GNUNET_CADET_ChannelCB callback,
494 void *callback_cls); 494 void *callback_cls);
495 495
496 496
497/** 497/**
498 * Request information about peers known to the running mesh service. 498 * Request information about peers known to the running cadet service.
499 * The callback will be called for every peer known to the service. 499 * The callback will be called for every peer known to the service.
500 * Only one info request (of any kind) can be active at once. 500 * Only one info request (of any kind) can be active at once.
501 * 501 *
502 * 502 *
503 * WARNING: unstable API, likely to change in the future! 503 * WARNING: unstable API, likely to change in the future!
504 * 504 *
505 * @param h Handle to the mesh peer. 505 * @param h Handle to the cadet peer.
506 * @param callback Function to call with the requested data. 506 * @param callback Function to call with the requested data.
507 * @param callback_cls Closure for @c callback. 507 * @param callback_cls Closure for @c callback.
508 * 508 *
509 * @return #GNUNET_OK / #GNUNET_SYSERR 509 * @return #GNUNET_OK / #GNUNET_SYSERR
510 */ 510 */
511int 511int
512GNUNET_MESH_get_peers (struct GNUNET_MESH_Handle *h, 512GNUNET_CADET_get_peers (struct GNUNET_CADET_Handle *h,
513 GNUNET_MESH_PeersCB callback, 513 GNUNET_CADET_PeersCB callback,
514 void *callback_cls); 514 void *callback_cls);
515 515
516/** 516/**
@@ -518,22 +518,22 @@ GNUNET_MESH_get_peers (struct GNUNET_MESH_Handle *h,
518 * 518 *
519 * WARNING: unstable API, likely to change in the future! 519 * WARNING: unstable API, likely to change in the future!
520 * 520 *
521 * @param h Mesh handle. 521 * @param h Cadet handle.
522 * 522 *
523 * @return Closure given to GNUNET_MESH_get_peers. 523 * @return Closure given to GNUNET_CADET_get_peers.
524 */ 524 */
525void * 525void *
526GNUNET_MESH_get_peers_cancel (struct GNUNET_MESH_Handle *h); 526GNUNET_CADET_get_peers_cancel (struct GNUNET_CADET_Handle *h);
527 527
528 528
529/** 529/**
530 * Request information about a peer known to the running mesh peer. 530 * Request information about a peer known to the running cadet peer.
531 * The callback will be called for the tunnel once. 531 * The callback will be called for the tunnel once.
532 * Only one info request (of any kind) can be active at once. 532 * Only one info request (of any kind) can be active at once.
533 * 533 *
534 * WARNING: unstable API, likely to change in the future! 534 * WARNING: unstable API, likely to change in the future!
535 * 535 *
536 * @param h Handle to the mesh peer. 536 * @param h Handle to the cadet peer.
537 * @param id Peer whose tunnel to examine. 537 * @param id Peer whose tunnel to examine.
538 * @param callback Function to call with the requested data. 538 * @param callback Function to call with the requested data.
539 * @param callback_cls Closure for @c callback. 539 * @param callback_cls Closure for @c callback.
@@ -541,48 +541,48 @@ GNUNET_MESH_get_peers_cancel (struct GNUNET_MESH_Handle *h);
541 * @return #GNUNET_OK / #GNUNET_SYSERR 541 * @return #GNUNET_OK / #GNUNET_SYSERR
542 */ 542 */
543int 543int
544GNUNET_MESH_get_peer (struct GNUNET_MESH_Handle *h, 544GNUNET_CADET_get_peer (struct GNUNET_CADET_Handle *h,
545 const struct GNUNET_PeerIdentity *id, 545 const struct GNUNET_PeerIdentity *id,
546 GNUNET_MESH_PeerCB callback, 546 GNUNET_CADET_PeerCB callback,
547 void *callback_cls); 547 void *callback_cls);
548 548
549/** 549/**
550 * Request information about tunnels of the running mesh peer. 550 * Request information about tunnels of the running cadet peer.
551 * The callback will be called for every tunnel of the service. 551 * The callback will be called for every tunnel of the service.
552 * Only one info request (of any kind) can be active at once. 552 * Only one info request (of any kind) can be active at once.
553 * 553 *
554 * WARNING: unstable API, likely to change in the future! 554 * WARNING: unstable API, likely to change in the future!
555 * 555 *
556 * @param h Handle to the mesh peer. 556 * @param h Handle to the cadet peer.
557 * @param callback Function to call with the requested data. 557 * @param callback Function to call with the requested data.
558 * @param callback_cls Closure for @c callback. 558 * @param callback_cls Closure for @c callback.
559 * 559 *
560 * @return #GNUNET_OK / #GNUNET_SYSERR 560 * @return #GNUNET_OK / #GNUNET_SYSERR
561 */ 561 */
562int 562int
563GNUNET_MESH_get_tunnels (struct GNUNET_MESH_Handle *h, 563GNUNET_CADET_get_tunnels (struct GNUNET_CADET_Handle *h,
564 GNUNET_MESH_TunnelsCB callback, 564 GNUNET_CADET_TunnelsCB callback,
565 void *callback_cls); 565 void *callback_cls);
566 566
567/** 567/**
568 * Cancel a monitor request. The monitor callback will not be called. 568 * Cancel a monitor request. The monitor callback will not be called.
569 * 569 *
570 * @param h Mesh handle. 570 * @param h Cadet handle.
571 * 571 *
572 * @return Closure given to GNUNET_MESH_monitor, if any. 572 * @return Closure given to GNUNET_CADET_monitor, if any.
573 */ 573 */
574void * 574void *
575GNUNET_MESH_get_tunnels_cancel (struct GNUNET_MESH_Handle *h); 575GNUNET_CADET_get_tunnels_cancel (struct GNUNET_CADET_Handle *h);
576 576
577 577
578/** 578/**
579 * Request information about a tunnel of the running mesh peer. 579 * Request information about a tunnel of the running cadet peer.
580 * The callback will be called for the tunnel once. 580 * The callback will be called for the tunnel once.
581 * Only one info request (of any kind) can be active at once. 581 * Only one info request (of any kind) can be active at once.
582 * 582 *
583 * WARNING: unstable API, likely to change in the future! 583 * WARNING: unstable API, likely to change in the future!
584 * 584 *
585 * @param h Handle to the mesh peer. 585 * @param h Handle to the cadet peer.
586 * @param id Peer whose tunnel to examine. 586 * @param id Peer whose tunnel to examine.
587 * @param callback Function to call with the requested data. 587 * @param callback Function to call with the requested data.
588 * @param callback_cls Closure for @c callback. 588 * @param callback_cls Closure for @c callback.
@@ -590,13 +590,13 @@ GNUNET_MESH_get_tunnels_cancel (struct GNUNET_MESH_Handle *h);
590 * @return #GNUNET_OK / #GNUNET_SYSERR 590 * @return #GNUNET_OK / #GNUNET_SYSERR
591 */ 591 */
592int 592int
593GNUNET_MESH_get_tunnel (struct GNUNET_MESH_Handle *h, 593GNUNET_CADET_get_tunnel (struct GNUNET_CADET_Handle *h,
594 const struct GNUNET_PeerIdentity *id, 594 const struct GNUNET_PeerIdentity *id,
595 GNUNET_MESH_TunnelCB callback, 595 GNUNET_CADET_TunnelCB callback,
596 void *callback_cls); 596 void *callback_cls);
597 597
598/** 598/**
599 * Create a message queue for a mesh channel. 599 * Create a message queue for a cadet channel.
600 * The message queue can only be used to transmit messages, 600 * The message queue can only be used to transmit messages,
601 * not to receive them. 601 * not to receive them.
602 * 602 *
@@ -604,7 +604,7 @@ GNUNET_MESH_get_tunnel (struct GNUNET_MESH_Handle *h,
604 * @return a message queue to messages over the channel 604 * @return a message queue to messages over the channel
605 */ 605 */
606struct GNUNET_MQ_Handle * 606struct GNUNET_MQ_Handle *
607GNUNET_MESH_mq_create (struct GNUNET_MESH_Channel *channel); 607GNUNET_CADET_mq_create (struct GNUNET_CADET_Channel *channel);
608 608
609 609
610#if 0 /* keep Emacsens' auto-indent happy */ 610#if 0 /* keep Emacsens' auto-indent happy */
@@ -614,6 +614,6 @@ GNUNET_MESH_mq_create (struct GNUNET_MESH_Channel *channel);
614} 614}
615#endif 615#endif
616 616
617/* ifndef GNUNET_MESH_SERVICE_H */ 617/* ifndef GNUNET_CADET_SERVICE_H */
618#endif 618#endif
619/* end of gnunet_mesh_service.h */ 619/* end of gnunet_cadet_service.h */
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index 3c04939ce..af294c785 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -521,14 +521,14 @@ extern "C"
521#define GNUNET_MESSAGE_TYPE_FS_MIGRATION_STOP 139 521#define GNUNET_MESSAGE_TYPE_FS_MIGRATION_STOP 139
522 522
523/** 523/**
524 * P2P request for content (one FS to another via a mesh). 524 * P2P request for content (one FS to another via a cadet).
525 */ 525 */
526#define GNUNET_MESSAGE_TYPE_FS_MESH_QUERY 140 526#define GNUNET_MESSAGE_TYPE_FS_CADET_QUERY 140
527 527
528/** 528/**
529 * P2P answer for content (one FS to another via a mesh). 529 * P2P answer for content (one FS to another via a cadet).
530 */ 530 */
531#define GNUNET_MESSAGE_TYPE_FS_MESH_REPLY 141 531#define GNUNET_MESSAGE_TYPE_FS_CADET_REPLY 141
532 532
533 533
534/******************************************************************************* 534/*******************************************************************************
@@ -811,179 +811,179 @@ extern "C"
811 811
812 812
813/******************************************************************************* 813/*******************************************************************************
814 * MESH message types 814 * CADET message types
815 ******************************************************************************/ 815 ******************************************************************************/
816 816
817/** 817/**
818 * Type of message used to transport messages throug a MESH-tunnel (LEGACY) 818 * Type of message used to transport messages throug a CADET-tunnel (LEGACY)
819 */ 819 */
820#define GNUNET_MESSAGE_TYPE_MESH 215 820#define GNUNET_MESSAGE_TYPE_CADET 215
821 821
822/** 822/**
823 * Type of message used to send another peer which messages we want to receive 823 * Type of message used to send another peer which messages we want to receive
824 * through a mesh-tunnel (LEGACY) 824 * through a cadet-tunnel (LEGACY)
825 */ 825 */
826#define GNUNET_MESSAGE_TYPE_MESH_HELLO 216 826#define GNUNET_MESSAGE_TYPE_CADET_HELLO 216
827 827
828/** 828/**
829 * Request the creation of a connection 829 * Request the creation of a connection
830 */ 830 */
831#define GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE 256 831#define GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE 256
832 832
833/** 833/**
834 * Send origin an ACK that the connection is complete 834 * Send origin an ACK that the connection is complete
835 */ 835 */
836#define GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK 257 836#define GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK 257
837 837
838/** 838/**
839 * Notify that a connection is no longer valid 839 * Notify that a connection is no longer valid
840 */ 840 */
841#define GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN 258 841#define GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN 258
842 842
843/** 843/**
844 * At some point, the route will spontaneously change TODO 844 * At some point, the route will spontaneously change TODO
845 */ 845 */
846#define GNUNET_MESSAGE_TYPE_MESH_PATH_CHANGED 259 846#define GNUNET_MESSAGE_TYPE_CADET_PATH_CHANGED 259
847 847
848/** 848/**
849 * Payload data (usually inside a encrypted tunnel). 849 * Payload data (usually inside a encrypted tunnel).
850 */ 850 */
851#define GNUNET_MESSAGE_TYPE_MESH_DATA 260 851#define GNUNET_MESSAGE_TYPE_CADET_DATA 260
852 852
853/** 853/**
854 * Confirm payload data end-to-end. 854 * Confirm payload data end-to-end.
855 */ 855 */
856#define GNUNET_MESSAGE_TYPE_MESH_DATA_ACK 261 856#define GNUNET_MESSAGE_TYPE_CADET_DATA_ACK 261
857 857
858/** 858/**
859 * Key exchange encapsulation. 859 * Key exchange encapsulation.
860 */ 860 */
861#define GNUNET_MESSAGE_TYPE_MESH_KX 262 861#define GNUNET_MESSAGE_TYPE_CADET_KX 262
862 862
863/** 863/**
864 * New ephemeral key. 864 * New ephemeral key.
865 */ 865 */
866#define GNUNET_MESSAGE_TYPE_MESH_KX_EPHEMERAL 263 866#define GNUNET_MESSAGE_TYPE_CADET_KX_EPHEMERAL 263
867 867
868/** 868/**
869 * Challenge to test peer's session key. 869 * Challenge to test peer's session key.
870 */ 870 */
871#define GNUNET_MESSAGE_TYPE_MESH_KX_PING 264 871#define GNUNET_MESSAGE_TYPE_CADET_KX_PING 264
872 872
873/** 873/**
874 * Answer to session key challenge. 874 * Answer to session key challenge.
875 */ 875 */
876#define GNUNET_MESSAGE_TYPE_MESH_KX_PONG 265 876#define GNUNET_MESSAGE_TYPE_CADET_KX_PONG 265
877 877
878/** 878/**
879 * Request the destuction of a connection 879 * Request the destuction of a connection
880 */ 880 */
881#define GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY 266 881#define GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY 266
882 882
883/** 883/**
884 * Hop-by-hop, connection dependent ACK. 884 * Hop-by-hop, connection dependent ACK.
885 */ 885 */
886#define GNUNET_MESSAGE_TYPE_MESH_ACK 268 886#define GNUNET_MESSAGE_TYPE_CADET_ACK 268
887 887
888/** 888/**
889 * Poll for a hop-by-hop ACK. 889 * Poll for a hop-by-hop ACK.
890 */ 890 */
891#define GNUNET_MESSAGE_TYPE_MESH_POLL 269 891#define GNUNET_MESSAGE_TYPE_CADET_POLL 269
892 892
893/** 893/**
894 * Announce connection is still alive (direction sensitive). 894 * Announce connection is still alive (direction sensitive).
895 */ 895 */
896#define GNUNET_MESSAGE_TYPE_MESH_KEEPALIVE 270 896#define GNUNET_MESSAGE_TYPE_CADET_KEEPALIVE 270
897 897
898/** 898/**
899 * Connect to the mesh service, specifying subscriptions 899 * Connect to the cadet service, specifying subscriptions
900 */ 900 */
901#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT 272 901#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_CONNECT 272
902 902
903/** 903/**
904 * Ask the mesh service to create a new channel. 904 * Ask the cadet service to create a new channel.
905 */ 905 */
906#define GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE 273 906#define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE 273
907 907
908/** 908/**
909 * Ask the mesh service to destroy a channel. 909 * Ask the cadet service to destroy a channel.
910 */ 910 */
911#define GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY 274 911#define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY 274
912 912
913/** 913/**
914 * Confirm the creation of a channel 914 * Confirm the creation of a channel
915 */ 915 */
916#define GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK 275 916#define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK 275
917 917
918/** 918/**
919 * Reject the creation of a channel 919 * Reject the creation of a channel
920 */ 920 */
921#define GNUNET_MESSAGE_TYPE_MESH_CHANNEL_NACK 276 921#define GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK 276
922 922
923/** 923/**
924 * Encrypted data. (Payload, channel management, keepalive) 924 * Encrypted data. (Payload, channel management, keepalive)
925 */ 925 */
926#define GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED 280 926#define GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED 280
927 927
928/** 928/**
929 * Payload client <-> service 929 * Payload client <-> service
930 */ 930 */
931#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA 285 931#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA 285
932 932
933/** 933/**
934 * Local ACK for data. 934 * Local ACK for data.
935 */ 935 */
936#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK 286 936#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK 286
937 937
938/** 938/**
939 * Local information about all channels of service. 939 * Local information about all channels of service.
940 */ 940 */
941#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_CHANNELS 290 941#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CHANNELS 290
942 942
943/** 943/**
944 * Local information of service about a specific channel. 944 * Local information of service about a specific channel.
945 */ 945 */
946#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_CHANNEL 291 946#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CHANNEL 291
947 947
948/** 948/**
949 * Local information about all tunnels of service. 949 * Local information about all tunnels of service.
950 */ 950 */
951#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS 292 951#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS 292
952 952
953/** 953/**
954 * Local information of service about a specific tunnel. 954 * Local information of service about a specific tunnel.
955 */ 955 */
956#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNEL 293 956#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL 293
957 957
958/** 958/**
959 * Local information about all connections of service. 959 * Local information about all connections of service.
960 */ 960 */
961#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_CONNECTIONS 294 961#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CONNECTIONS 294
962 962
963/** 963/**
964 * Local information of service about a specific connection. 964 * Local information of service about a specific connection.
965 */ 965 */
966#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_CONNECTION 295 966#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CONNECTION 295
967 967
968/** 968/**
969 * Local information about all peers known to the service. 969 * Local information about all peers known to the service.
970 */ 970 */
971#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_PEERS 296 971#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS 296
972 972
973/** 973/**
974 * Local information of service about a specific peer. 974 * Local information of service about a specific peer.
975 */ 975 */
976#define GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_PEER 297 976#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER 297
977 977
978/** 978/**
979 * Traffic (net-cat style) used by the Command Line Interface. 979 * Traffic (net-cat style) used by the Command Line Interface.
980 */ 980 */
981#define GNUNET_MESSAGE_TYPE_MESH_CLI 298 981#define GNUNET_MESSAGE_TYPE_CADET_CLI 298
982 982
983/** 983/**
984 * 640kb should be enough for everybody 984 * 640kb should be enough for everybody
985 */ 985 */
986#define GNUNET_MESSAGE_TYPE_MESH_RESERVE_END 299 986#define GNUNET_MESSAGE_TYPE_CADET_RESERVE_END 299
987 987
988 988
989 989
@@ -2292,34 +2292,34 @@ extern "C"
2292#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO 739 2292#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO 739
2293 2293
2294/** 2294/**
2295 * Mesh: call initiation 2295 * Cadet: call initiation
2296 */ 2296 */
2297#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_RING 740 2297#define GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RING 740
2298 2298
2299/** 2299/**
2300 * Mesh: hang up / refuse call 2300 * Cadet: hang up / refuse call
2301 */ 2301 */
2302#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_HANG_UP 741 2302#define GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_HANG_UP 741
2303 2303
2304/** 2304/**
2305 * Mesh: pick up phone (establish audio channel) 2305 * Cadet: pick up phone (establish audio channel)
2306 */ 2306 */
2307#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_PICK_UP 742 2307#define GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_PICK_UP 742
2308 2308
2309/** 2309/**
2310 * Mesh: phone suspended. 2310 * Cadet: phone suspended.
2311 */ 2311 */
2312#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_SUSPEND 743 2312#define GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_SUSPEND 743
2313 2313
2314/** 2314/**
2315 * Mesh: phone resumed. 2315 * Cadet: phone resumed.
2316 */ 2316 */
2317#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_RESUME 744 2317#define GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RESUME 744
2318 2318
2319/** 2319/**
2320 * Mesh: audio data 2320 * Cadet: audio data
2321 */ 2321 */
2322#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_AUDIO 745 2322#define GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_AUDIO 745
2323 2323
2324 2324
2325/******************************************************************************* 2325/*******************************************************************************
diff --git a/src/include/gnunet_signatures.h b/src/include/gnunet_signatures.h
index 05d758cdb..fafe6e5ae 100644
--- a/src/include/gnunet_signatures.h
+++ b/src/include/gnunet_signatures.h
@@ -147,9 +147,9 @@ extern "C"
147#define GNUNET_SIGNATURE_PURPOSE_CONVERSATION_RING 20 147#define GNUNET_SIGNATURE_PURPOSE_CONVERSATION_RING 20
148 148
149/** 149/**
150 * Key exchange in MESH 150 * Key exchange in CADET
151 */ 151 */
152#define GNUNET_SIGNATURE_PURPOSE_MESH_KX 21 152#define GNUNET_SIGNATURE_PURPOSE_CADET_KX 21
153 153
154/** 154/**
155 * Signature for the first round of distributed key generation. 155 * Signature for the first round of distributed key generation.
diff --git a/src/mesh/gnunet-mesh-profiler.c b/src/mesh/gnunet-mesh-profiler.c
index a1f1107bc..c944caa75 100644
--- a/src/mesh/gnunet-mesh-profiler.c
+++ b/src/mesh/gnunet-mesh-profiler.c
@@ -18,14 +18,14 @@
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20/** 20/**
21 * @file mesh/gnunet-mesh-profiler.c 21 * @file cadet/gnunet-cadet-profiler.c
22 * 22 *
23 * @brief Profiler for mesh experiments. 23 * @brief Profiler for cadet experiments.
24 */ 24 */
25#include <stdio.h> 25#include <stdio.h>
26#include "platform.h" 26#include "platform.h"
27#include "mesh_test_lib.h" 27#include "cadet_test_lib.h"
28#include "gnunet_mesh_service.h" 28#include "gnunet_cadet_service.h"
29#include "gnunet_statistics_service.h" 29#include "gnunet_statistics_service.h"
30 30
31 31
@@ -61,7 +61,7 @@ static float rounds[] = {0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.0};
61/** 61/**
62 * Message type for pings. 62 * Message type for pings.
63 */ 63 */
64struct MeshPingMessage 64struct CadetPingMessage
65{ 65{
66 /** 66 /**
67 * Header. Type PING/PONG. 67 * Header. Type PING/PONG.
@@ -87,7 +87,7 @@ struct MeshPingMessage
87/** 87/**
88 * Peer description. 88 * Peer description.
89 */ 89 */
90struct MeshPeer 90struct CadetPeer
91{ 91{
92 /** 92 /**
93 * Testbed Operation (to get peer id, etc). 93 * Testbed Operation (to get peer id, etc).
@@ -100,24 +100,24 @@ struct MeshPeer
100 struct GNUNET_PeerIdentity id; 100 struct GNUNET_PeerIdentity id;
101 101
102 /** 102 /**
103 * Mesh handle for the root peer 103 * Cadet handle for the root peer
104 */ 104 */
105 struct GNUNET_MESH_Handle *mesh; 105 struct GNUNET_CADET_Handle *cadet;
106 106
107 /** 107 /**
108 * Channel handle for the root peer 108 * Channel handle for the root peer
109 */ 109 */
110 struct GNUNET_MESH_Channel *ch; 110 struct GNUNET_CADET_Channel *ch;
111 111
112 /** 112 /**
113 * Channel handle for the dest peer 113 * Channel handle for the dest peer
114 */ 114 */
115 struct GNUNET_MESH_Channel *incoming_ch; 115 struct GNUNET_CADET_Channel *incoming_ch;
116 116
117 /** 117 /**
118 * Channel handle for a warmup channel. 118 * Channel handle for a warmup channel.
119 */ 119 */
120 struct GNUNET_MESH_Channel *warmup_ch; 120 struct GNUNET_CADET_Channel *warmup_ch;
121 121
122 /** 122 /**
123 * Number of payload packes sent 123 * Number of payload packes sent
@@ -137,12 +137,12 @@ struct MeshPeer
137 /** 137 /**
138 * Destinaton to ping. 138 * Destinaton to ping.
139 */ 139 */
140 struct MeshPeer *dest; 140 struct CadetPeer *dest;
141 141
142 /** 142 /**
143 * Incoming channel for pings. 143 * Incoming channel for pings.
144 */ 144 */
145 struct MeshPeer *incoming; 145 struct CadetPeer *incoming;
146 146
147 /** 147 /**
148 * Task to do the next ping. 148 * Task to do the next ping.
@@ -162,7 +162,7 @@ struct MeshPeer
162static struct GNUNET_TIME_Relative round_time; 162static struct GNUNET_TIME_Relative round_time;
163 163
164/** 164/**
165 * GNUNET_PeerIdentity -> MeshPeer 165 * GNUNET_PeerIdentity -> CadetPeer
166 */ 166 */
167static struct GNUNET_CONTAINER_MultiPeerMap *ids; 167static struct GNUNET_CONTAINER_MultiPeerMap *ids;
168 168
@@ -179,7 +179,7 @@ static struct GNUNET_TESTBED_Operation *stats_op;
179/** 179/**
180 * Operation to get peer ids. 180 * Operation to get peer ids.
181 */ 181 */
182struct MeshPeer *peers; 182struct CadetPeer *peers;
183 183
184/** 184/**
185 * Peer ids counter. 185 * Peer ids counter.
@@ -204,7 +204,7 @@ static unsigned long long peers_pinging;
204/** 204/**
205 * Test context (to shut down). 205 * Test context (to shut down).
206 */ 206 */
207static struct GNUNET_MESH_TEST_Context *test_ctx; 207static struct GNUNET_CADET_TEST_Context *test_ctx;
208 208
209/** 209/**
210 * Task called to shutdown test. 210 * Task called to shutdown test.
@@ -243,7 +243,7 @@ static int test_finished;
243 243
244 244
245/** 245/**
246 * START THE TEST ITSELF, AS WE ARE CONNECTED TO THE MESH SERVICES. 246 * START THE TEST ITSELF, AS WE ARE CONNECTED TO THE CADET SERVICES.
247 * 247 *
248 * Testcase continues when the root receives confirmation of connected peers, 248 * Testcase continues when the root receives confirmation of connected peers,
249 * on callback funtion ch. 249 * on callback funtion ch.
@@ -280,7 +280,7 @@ delay_ms_rnd (unsigned int max)
280 * @return Index of peer in peers. 280 * @return Index of peer in peers.
281 */ 281 */
282static unsigned int 282static unsigned int
283get_index (struct MeshPeer *peer) 283get_index (struct CadetPeer *peer)
284{ 284{
285 return peer - peers; 285 return peer - peers;
286} 286}
@@ -292,7 +292,7 @@ get_index (struct MeshPeer *peer)
292static void 292static void
293show_end_data (void) 293show_end_data (void)
294{ 294{
295 struct MeshPeer *peer; 295 struct CadetPeer *peer;
296 unsigned int i; 296 unsigned int i;
297 unsigned int j; 297 unsigned int j;
298 298
@@ -325,19 +325,19 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
325 325
326 326
327/** 327/**
328 * Disconnect from mesh services af all peers, call shutdown. 328 * Disconnect from cadet services af all peers, call shutdown.
329 * 329 *
330 * @param cls Closure (unused). 330 * @param cls Closure (unused).
331 * @param tc Task Context. 331 * @param tc Task Context.
332 */ 332 */
333static void 333static void
334disconnect_mesh_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 334disconnect_cadet_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
335{ 335{
336 long line = (long) cls; 336 long line = (long) cls;
337 unsigned int i; 337 unsigned int i;
338 338
339 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 339 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
340 "disconnecting mesh service, called from line %ld\n", line); 340 "disconnecting cadet service, called from line %ld\n", line);
341 disconnect_task = GNUNET_SCHEDULER_NO_TASK; 341 disconnect_task = GNUNET_SCHEDULER_NO_TASK;
342 for (i = 0; i < peers_total; i++) 342 for (i = 0; i < peers_total; i++)
343 { 343 {
@@ -350,22 +350,22 @@ disconnect_mesh_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
350 if (NULL != peers[i].ch) 350 if (NULL != peers[i].ch)
351 { 351 {
352 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%u: channel %p\n", i, peers[i].ch); 352 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%u: channel %p\n", i, peers[i].ch);
353 GNUNET_MESH_channel_destroy (peers[i].ch); 353 GNUNET_CADET_channel_destroy (peers[i].ch);
354 } 354 }
355 if (NULL != peers[i].warmup_ch) 355 if (NULL != peers[i].warmup_ch)
356 { 356 {
357 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%u: warmup channel %p\n", 357 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%u: warmup channel %p\n",
358 i, peers[i].warmup_ch); 358 i, peers[i].warmup_ch);
359 GNUNET_MESH_channel_destroy (peers[i].warmup_ch); 359 GNUNET_CADET_channel_destroy (peers[i].warmup_ch);
360 } 360 }
361 if (NULL != peers[i].incoming_ch) 361 if (NULL != peers[i].incoming_ch)
362 { 362 {
363 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%u: incoming channel %p\n", 363 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%u: incoming channel %p\n",
364 i, peers[i].incoming_ch); 364 i, peers[i].incoming_ch);
365 GNUNET_MESH_channel_destroy (peers[i].incoming_ch); 365 GNUNET_CADET_channel_destroy (peers[i].incoming_ch);
366 } 366 }
367 } 367 }
368 GNUNET_MESH_TEST_cleanup (test_ctx); 368 GNUNET_CADET_TEST_cleanup (test_ctx);
369 if (GNUNET_SCHEDULER_NO_TASK != shutdown_handle) 369 if (GNUNET_SCHEDULER_NO_TASK != shutdown_handle)
370 { 370 {
371 GNUNET_SCHEDULER_cancel (shutdown_handle); 371 GNUNET_SCHEDULER_cancel (shutdown_handle);
@@ -385,7 +385,7 @@ abort_test (long line)
385 if (disconnect_task != GNUNET_SCHEDULER_NO_TASK) 385 if (disconnect_task != GNUNET_SCHEDULER_NO_TASK)
386 { 386 {
387 GNUNET_SCHEDULER_cancel (disconnect_task); 387 GNUNET_SCHEDULER_cancel (disconnect_task);
388 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_mesh_peers, 388 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers,
389 (void *) line); 389 (void *) line);
390 } 390 }
391} 391}
@@ -407,7 +407,7 @@ stats_cont (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg)
407 407
408 if (GNUNET_SCHEDULER_NO_TASK != disconnect_task) 408 if (GNUNET_SCHEDULER_NO_TASK != disconnect_task)
409 GNUNET_SCHEDULER_cancel (disconnect_task); 409 GNUNET_SCHEDULER_cancel (disconnect_task);
410 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_mesh_peers, 410 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers,
411 (void *) __LINE__); 411 (void *) __LINE__);
412 412
413} 413}
@@ -520,17 +520,17 @@ adjust_running_peers (unsigned int target)
520 peers[r].up = run; 520 peers[r].up = run;
521 521
522 if (NULL != peers[r].ch) 522 if (NULL != peers[r].ch)
523 GNUNET_MESH_channel_destroy (peers[r].ch); 523 GNUNET_CADET_channel_destroy (peers[r].ch);
524 peers[r].ch = NULL; 524 peers[r].ch = NULL;
525 if (NULL != peers[r].dest) 525 if (NULL != peers[r].dest)
526 { 526 {
527 if (NULL != peers[r].dest->incoming_ch) 527 if (NULL != peers[r].dest->incoming_ch)
528 GNUNET_MESH_channel_destroy (peers[r].dest->incoming_ch); 528 GNUNET_CADET_channel_destroy (peers[r].dest->incoming_ch);
529 peers[r].dest->incoming_ch = NULL; 529 peers[r].dest->incoming_ch = NULL;
530 } 530 }
531 531
532 op = GNUNET_TESTBED_peer_manage_service (&peers[r], testbed_handles[r], 532 op = GNUNET_TESTBED_peer_manage_service (&peers[r], testbed_handles[r],
533 "mesh", NULL, NULL, run); 533 "cadet", NULL, NULL, run);
534 GNUNET_break (NULL != op); 534 GNUNET_break (NULL != op);
535 peers_running += run ? 1 : -1; 535 peers_running += run ? 1 : -1;
536 GNUNET_assert (peers_running > 0); 536 GNUNET_assert (peers_running > 0);
@@ -587,15 +587,15 @@ tmt_rdy_ping (void *cls, size_t size, void *buf);
587static size_t 587static size_t
588tmt_rdy_pong (void *cls, size_t size, void *buf) 588tmt_rdy_pong (void *cls, size_t size, void *buf)
589{ 589{
590 struct MeshPingMessage *ping = cls; 590 struct CadetPingMessage *ping = cls;
591 struct MeshPingMessage *pong; 591 struct CadetPingMessage *pong;
592 592
593 if (0 == size || NULL == buf) 593 if (0 == size || NULL == buf)
594 { 594 {
595 GNUNET_free (ping); 595 GNUNET_free (ping);
596 return 0; 596 return 0;
597 } 597 }
598 pong = (struct MeshPingMessage *) buf; 598 pong = (struct CadetPingMessage *) buf;
599 memcpy (pong, ping, sizeof (*ping)); 599 memcpy (pong, ping, sizeof (*ping));
600 pong->header.type = htons (PONG); 600 pong->header.type = htons (PONG);
601 601
@@ -613,7 +613,7 @@ tmt_rdy_pong (void *cls, size_t size, void *buf)
613static void 613static void
614ping (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 614ping (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
615{ 615{
616 struct MeshPeer *peer = (struct MeshPeer *) cls; 616 struct CadetPeer *peer = (struct CadetPeer *) cls;
617 617
618 peer->ping_task = GNUNET_SCHEDULER_NO_TASK; 618 peer->ping_task = GNUNET_SCHEDULER_NO_TASK;
619 619
@@ -624,9 +624,9 @@ ping (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
624 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%u -> %u (%u)\n", 624 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%u -> %u (%u)\n",
625 get_index (peer), get_index (peer->dest), peer->data_sent); 625 get_index (peer), get_index (peer->dest), peer->data_sent);
626 626
627 GNUNET_MESH_notify_transmit_ready (peer->ch, GNUNET_NO, 627 GNUNET_CADET_notify_transmit_ready (peer->ch, GNUNET_NO,
628 GNUNET_TIME_UNIT_FOREVER_REL, 628 GNUNET_TIME_UNIT_FOREVER_REL,
629 sizeof (struct MeshPingMessage), 629 sizeof (struct CadetPingMessage),
630 &tmt_rdy_ping, peer); 630 &tmt_rdy_ping, peer);
631} 631}
632 632
@@ -637,15 +637,15 @@ ping (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
637 * @param tc Task context. 637 * @param tc Task context.
638 */ 638 */
639static void 639static void
640pong (struct GNUNET_MESH_Channel *channel, const struct MeshPingMessage *ping) 640pong (struct GNUNET_CADET_Channel *channel, const struct CadetPingMessage *ping)
641{ 641{
642 struct MeshPingMessage *copy; 642 struct CadetPingMessage *copy;
643 643
644 copy = GNUNET_new (struct MeshPingMessage); 644 copy = GNUNET_new (struct CadetPingMessage);
645 memcpy (copy, ping, sizeof (*ping)); 645 memcpy (copy, ping, sizeof (*ping));
646 GNUNET_MESH_notify_transmit_ready (channel, GNUNET_NO, 646 GNUNET_CADET_notify_transmit_ready (channel, GNUNET_NO,
647 GNUNET_TIME_UNIT_FOREVER_REL, 647 GNUNET_TIME_UNIT_FOREVER_REL,
648 sizeof (struct MeshPingMessage), 648 sizeof (struct CadetPingMessage),
649 &tmt_rdy_pong, copy); 649 &tmt_rdy_pong, copy);
650} 650}
651 651
@@ -660,11 +660,11 @@ pong (struct GNUNET_MESH_Channel *channel, const struct MeshPingMessage *ping)
660static size_t 660static size_t
661tmt_rdy_ping (void *cls, size_t size, void *buf) 661tmt_rdy_ping (void *cls, size_t size, void *buf)
662{ 662{
663 struct MeshPeer *peer = (struct MeshPeer *) cls; 663 struct CadetPeer *peer = (struct CadetPeer *) cls;
664 struct MeshPingMessage *msg = buf; 664 struct CadetPingMessage *msg = buf;
665 665
666 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tmt_rdy called, filling buffer\n"); 666 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tmt_rdy called, filling buffer\n");
667 if (size < sizeof (struct MeshPingMessage) || NULL == buf) 667 if (size < sizeof (struct CadetPingMessage) || NULL == buf)
668 { 668 {
669 GNUNET_break (GNUNET_YES == test_finished); 669 GNUNET_break (GNUNET_YES == test_finished);
670 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 670 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -683,14 +683,14 @@ tmt_rdy_ping (void *cls, size_t size, void *buf)
683 peer->ping_task = GNUNET_SCHEDULER_add_delayed (delay_ms_rnd (PING_PERIOD), 683 peer->ping_task = GNUNET_SCHEDULER_add_delayed (delay_ms_rnd (PING_PERIOD),
684 &ping, peer); 684 &ping, peer);
685 685
686 return sizeof (struct MeshPingMessage); 686 return sizeof (struct CadetPingMessage);
687} 687}
688 688
689 689
690/** 690/**
691 * Function is called whenever a PING message is received. 691 * Function is called whenever a PING message is received.
692 * 692 *
693 * @param cls closure (peer #, set from GNUNET_MESH_connect) 693 * @param cls closure (peer #, set from GNUNET_CADET_connect)
694 * @param channel connection to the other end 694 * @param channel connection to the other end
695 * @param channel_ctx place to store local state associated with the channel 695 * @param channel_ctx place to store local state associated with the channel
696 * @param message the actual message 696 * @param message the actual message
@@ -698,16 +698,16 @@ tmt_rdy_ping (void *cls, size_t size, void *buf)
698 * GNUNET_SYSERR to close it (signal serious error) 698 * GNUNET_SYSERR to close it (signal serious error)
699 */ 699 */
700int 700int
701ping_handler (void *cls, struct GNUNET_MESH_Channel *channel, 701ping_handler (void *cls, struct GNUNET_CADET_Channel *channel,
702 void **channel_ctx, 702 void **channel_ctx,
703 const struct GNUNET_MessageHeader *message) 703 const struct GNUNET_MessageHeader *message)
704{ 704{
705 long n = (long) cls; 705 long n = (long) cls;
706 706
707 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%u got PING\n", n); 707 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%u got PING\n", n);
708 GNUNET_MESH_receive_done (channel); 708 GNUNET_CADET_receive_done (channel);
709 if (GNUNET_NO == test_finished) 709 if (GNUNET_NO == test_finished)
710 pong (channel, (struct MeshPingMessage *) message); 710 pong (channel, (struct CadetPingMessage *) message);
711 711
712 return GNUNET_OK; 712 return GNUNET_OK;
713} 713}
@@ -716,7 +716,7 @@ ping_handler (void *cls, struct GNUNET_MESH_Channel *channel,
716/** 716/**
717 * Function is called whenever a PONG message is received. 717 * Function is called whenever a PONG message is received.
718 * 718 *
719 * @param cls closure (peer #, set from GNUNET_MESH_connect) 719 * @param cls closure (peer #, set from GNUNET_CADET_connect)
720 * @param channel connection to the other end 720 * @param channel connection to the other end
721 * @param channel_ctx place to store local state associated with the channel 721 * @param channel_ctx place to store local state associated with the channel
722 * @param message the actual message 722 * @param message the actual message
@@ -724,22 +724,22 @@ ping_handler (void *cls, struct GNUNET_MESH_Channel *channel,
724 * GNUNET_SYSERR to close it (signal serious error) 724 * GNUNET_SYSERR to close it (signal serious error)
725 */ 725 */
726int 726int
727pong_handler (void *cls, struct GNUNET_MESH_Channel *channel, 727pong_handler (void *cls, struct GNUNET_CADET_Channel *channel,
728 void **channel_ctx, 728 void **channel_ctx,
729 const struct GNUNET_MessageHeader *message) 729 const struct GNUNET_MessageHeader *message)
730{ 730{
731 long n = (long) cls; 731 long n = (long) cls;
732 struct MeshPeer *peer; 732 struct CadetPeer *peer;
733 struct MeshPingMessage *msg; 733 struct CadetPingMessage *msg;
734 struct GNUNET_TIME_Absolute send_time; 734 struct GNUNET_TIME_Absolute send_time;
735 struct GNUNET_TIME_Relative latency; 735 struct GNUNET_TIME_Relative latency;
736 unsigned int r /* Ping round */; 736 unsigned int r /* Ping round */;
737 float delta; 737 float delta;
738 738
739 GNUNET_MESH_receive_done (channel); 739 GNUNET_CADET_receive_done (channel);
740 peer = &peers[n]; 740 peer = &peers[n];
741 741
742 msg = (struct MeshPingMessage *) message; 742 msg = (struct CadetPingMessage *) message;
743 743
744 send_time = GNUNET_TIME_absolute_ntoh (msg->timestamp); 744 send_time = GNUNET_TIME_absolute_ntoh (msg->timestamp);
745 latency = GNUNET_TIME_absolute_get_duration (send_time); 745 latency = GNUNET_TIME_absolute_get_duration (send_time);
@@ -761,9 +761,9 @@ pong_handler (void *cls, struct GNUNET_MESH_Channel *channel,
761/** 761/**
762 * Handlers, for diverse services 762 * Handlers, for diverse services
763 */ 763 */
764static struct GNUNET_MESH_MessageHandler handlers[] = { 764static struct GNUNET_CADET_MessageHandler handlers[] = {
765 {&ping_handler, PING, sizeof (struct MeshPingMessage)}, 765 {&ping_handler, PING, sizeof (struct CadetPingMessage)},
766 {&pong_handler, PONG, sizeof (struct MeshPingMessage)}, 766 {&pong_handler, PONG, sizeof (struct CadetPingMessage)},
767 {NULL, 0, 0} 767 {NULL, 0, 0}
768}; 768};
769 769
@@ -781,12 +781,12 @@ static struct GNUNET_MESH_MessageHandler handlers[] = {
781 * (can be NULL -- that's not an error). 781 * (can be NULL -- that's not an error).
782 */ 782 */
783static void * 783static void *
784incoming_channel (void *cls, struct GNUNET_MESH_Channel *channel, 784incoming_channel (void *cls, struct GNUNET_CADET_Channel *channel,
785 const struct GNUNET_PeerIdentity *initiator, 785 const struct GNUNET_PeerIdentity *initiator,
786 uint32_t port, enum GNUNET_MESH_ChannelOption options) 786 uint32_t port, enum GNUNET_CADET_ChannelOption options)
787{ 787{
788 long n = (long) cls; 788 long n = (long) cls;
789 struct MeshPeer *peer; 789 struct CadetPeer *peer;
790 790
791 peer = GNUNET_CONTAINER_multipeermap_get (ids, initiator); 791 peer = GNUNET_CONTAINER_multipeermap_get (ids, initiator);
792 GNUNET_assert (NULL != peer); 792 GNUNET_assert (NULL != peer);
@@ -818,17 +818,17 @@ incoming_channel (void *cls, struct GNUNET_MESH_Channel *channel,
818 * Function called whenever an inbound channel is destroyed. Should clean up 818 * Function called whenever an inbound channel is destroyed. Should clean up
819 * any associated state. 819 * any associated state.
820 * 820 *
821 * @param cls closure (set from GNUNET_MESH_connect) 821 * @param cls closure (set from GNUNET_CADET_connect)
822 * @param channel connection to the other end (henceforth invalid) 822 * @param channel connection to the other end (henceforth invalid)
823 * @param channel_ctx place where local state associated 823 * @param channel_ctx place where local state associated
824 * with the channel is stored 824 * with the channel is stored
825 */ 825 */
826static void 826static void
827channel_cleaner (void *cls, const struct GNUNET_MESH_Channel *channel, 827channel_cleaner (void *cls, const struct GNUNET_CADET_Channel *channel,
828 void *channel_ctx) 828 void *channel_ctx)
829{ 829{
830 long n = (long) cls; 830 long n = (long) cls;
831 struct MeshPeer *peer = &peers[n]; 831 struct CadetPeer *peer = &peers[n];
832 832
833 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 833 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
834 "Channel %p disconnected at peer %ld\n", channel, n); 834 "Channel %p disconnected at peer %ld\n", channel, n);
@@ -844,8 +844,8 @@ channel_cleaner (void *cls, const struct GNUNET_MESH_Channel *channel,
844 * 844 *
845 * @return Random peer not yet connected to. 845 * @return Random peer not yet connected to.
846 */ 846 */
847static struct MeshPeer * 847static struct CadetPeer *
848select_random_peer (struct MeshPeer *peer) 848select_random_peer (struct CadetPeer *peer)
849{ 849{
850 unsigned int r; 850 unsigned int r;
851 851
@@ -859,7 +859,7 @@ select_random_peer (struct MeshPeer *peer)
859} 859}
860 860
861/** 861/**
862 * START THE TEST ITSELF, AS WE ARE CONNECTED TO THE MESH SERVICES. 862 * START THE TEST ITSELF, AS WE ARE CONNECTED TO THE CADET SERVICES.
863 * 863 *
864 * Testcase continues when the root receives confirmation of connected peers, 864 * Testcase continues when the root receives confirmation of connected peers,
865 * on callback funtion ch. 865 * on callback funtion ch.
@@ -870,7 +870,7 @@ select_random_peer (struct MeshPeer *peer)
870static void 870static void
871start_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 871start_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
872{ 872{
873 enum GNUNET_MESH_ChannelOption flags; 873 enum GNUNET_CADET_ChannelOption flags;
874 unsigned long i; 874 unsigned long i;
875 875
876 test_task = GNUNET_SCHEDULER_NO_TASK; 876 test_task = GNUNET_SCHEDULER_NO_TASK;
@@ -879,17 +879,17 @@ start_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
879 879
880 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Start profiler\n"); 880 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Start profiler\n");
881 881
882 flags = GNUNET_MESH_OPTION_DEFAULT; 882 flags = GNUNET_CADET_OPTION_DEFAULT;
883 for (i = 0; i < peers_pinging; i++) 883 for (i = 0; i < peers_pinging; i++)
884 { 884 {
885 peers[i].dest = select_random_peer (&peers[i]); 885 peers[i].dest = select_random_peer (&peers[i]);
886 peers[i].ch = GNUNET_MESH_channel_create (peers[i].mesh, NULL, 886 peers[i].ch = GNUNET_CADET_channel_create (peers[i].cadet, NULL,
887 &peers[i].dest->id, 887 &peers[i].dest->id,
888 1, flags); 888 1, flags);
889 if (NULL == peers[i].ch) 889 if (NULL == peers[i].ch)
890 { 890 {
891 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Channel %lu failed\n", i); 891 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Channel %lu failed\n", i);
892 GNUNET_MESH_TEST_cleanup (test_ctx); 892 GNUNET_CADET_TEST_cleanup (test_ctx);
893 return; 893 return;
894 } 894 }
895 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%u => %u %p\n", 895 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%u => %u %p\n",
@@ -903,7 +903,7 @@ start_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
903 disconnect_task = 903 disconnect_task =
904 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply(round_time, 904 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply(round_time,
905 number_rounds + 1), 905 number_rounds + 1),
906 &disconnect_mesh_peers, 906 &disconnect_cadet_peers,
907 (void *) __LINE__); 907 (void *) __LINE__);
908 GNUNET_SCHEDULER_add_delayed (round_time, &next_rnd, NULL); 908 GNUNET_SCHEDULER_add_delayed (round_time, &next_rnd, NULL);
909} 909}
@@ -915,7 +915,7 @@ start_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
915static void 915static void
916warmup (void) 916warmup (void)
917{ 917{
918 struct MeshPeer *peer; 918 struct CadetPeer *peer;
919 unsigned int i; 919 unsigned int i;
920 920
921 for (i = 0; i < peers_total; i++) 921 for (i = 0; i < peers_total; i++)
@@ -924,12 +924,12 @@ warmup (void)
924 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "WARMUP %u => %u\n", 924 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "WARMUP %u => %u\n",
925 i, get_index (peer)); 925 i, get_index (peer));
926 peers[i].warmup_ch = 926 peers[i].warmup_ch =
927 GNUNET_MESH_channel_create (peers[i].mesh, NULL, &peer->id, 927 GNUNET_CADET_channel_create (peers[i].cadet, NULL, &peer->id,
928 1, GNUNET_MESH_OPTION_DEFAULT); 928 1, GNUNET_CADET_OPTION_DEFAULT);
929 if (NULL == peers[i].warmup_ch) 929 if (NULL == peers[i].warmup_ch)
930 { 930 {
931 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Warmup %u failed\n", i); 931 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Warmup %u failed\n", i);
932 GNUNET_MESH_TEST_cleanup (test_ctx); 932 GNUNET_CADET_TEST_cleanup (test_ctx);
933 return; 933 return;
934 } 934 }
935 } 935 }
@@ -991,17 +991,17 @@ peer_id_cb (void *cls,
991 * test main: start test when all peers are connected 991 * test main: start test when all peers are connected
992 * 992 *
993 * @param cls Closure. 993 * @param cls Closure.
994 * @param ctx Argument to give to GNUNET_MESH_TEST_cleanup on test end. 994 * @param ctx Argument to give to GNUNET_CADET_TEST_cleanup on test end.
995 * @param num_peers Number of peers that are running. 995 * @param num_peers Number of peers that are running.
996 * @param testbed_peers Array of peers. 996 * @param testbed_peers Array of peers.
997 * @param meshes Handle to each of the MESHs of the peers. 997 * @param cadetes Handle to each of the CADETs of the peers.
998 */ 998 */
999static void 999static void
1000tmain (void *cls, 1000tmain (void *cls,
1001 struct GNUNET_MESH_TEST_Context *ctx, 1001 struct GNUNET_CADET_TEST_Context *ctx,
1002 unsigned int num_peers, 1002 unsigned int num_peers,
1003 struct GNUNET_TESTBED_Peer **testbed_peers, 1003 struct GNUNET_TESTBED_Peer **testbed_peers,
1004 struct GNUNET_MESH_Handle **meshes) 1004 struct GNUNET_CADET_Handle **cadetes)
1005{ 1005{
1006 unsigned long i; 1006 unsigned long i;
1007 1007
@@ -1011,7 +1011,7 @@ tmain (void *cls,
1011 peers_running = num_peers; 1011 peers_running = num_peers;
1012 testbed_handles = testbed_peers; 1012 testbed_handles = testbed_peers;
1013 disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME, 1013 disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
1014 &disconnect_mesh_peers, 1014 &disconnect_cadet_peers,
1015 (void *) __LINE__); 1015 (void *) __LINE__);
1016 shutdown_handle = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 1016 shutdown_handle = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
1017 &shutdown_task, NULL); 1017 &shutdown_task, NULL);
@@ -1019,7 +1019,7 @@ tmain (void *cls,
1019 { 1019 {
1020 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "requesting id %ld\n", i); 1020 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "requesting id %ld\n", i);
1021 peers[i].up = GNUNET_YES; 1021 peers[i].up = GNUNET_YES;
1022 peers[i].mesh = meshes[i]; 1022 peers[i].cadet = cadetes[i];
1023 peers[i].op = 1023 peers[i].op =
1024 GNUNET_TESTBED_peer_get_information (testbed_handles[i], 1024 GNUNET_TESTBED_peer_get_information (testbed_handles[i],
1025 GNUNET_TESTBED_PIT_IDENTITY, 1025 GNUNET_TESTBED_PIT_IDENTITY,
@@ -1060,7 +1060,7 @@ main (int argc, char *argv[])
1060 fprintf (stderr, "%s peers is not valid (> 2)\n", argv[1]); 1060 fprintf (stderr, "%s peers is not valid (> 2)\n", argv[1]);
1061 return 1; 1061 return 1;
1062 } 1062 }
1063 peers = GNUNET_malloc (sizeof (struct MeshPeer) * peers_total); 1063 peers = GNUNET_malloc (sizeof (struct CadetPeer) * peers_total);
1064 1064
1065 peers_pinging = atoll (argv[3]); 1065 peers_pinging = atoll (argv[3]);
1066 1066
@@ -1079,7 +1079,7 @@ main (int argc, char *argv[])
1079 test_finished = GNUNET_NO; 1079 test_finished = GNUNET_NO;
1080 ports[0] = 1; 1080 ports[0] = 1;
1081 ports[1] = 0; 1081 ports[1] = 0;
1082 GNUNET_MESH_TEST_run ("mesh-profiler", config_file, peers_total, 1082 GNUNET_CADET_TEST_run ("cadet-profiler", config_file, peers_total,
1083 &tmain, NULL, /* tmain cls */ 1083 &tmain, NULL, /* tmain cls */
1084 &incoming_channel, &channel_cleaner, 1084 &incoming_channel, &channel_cleaner,
1085 handlers, ports); 1085 handlers, ports);
@@ -1088,5 +1088,5 @@ main (int argc, char *argv[])
1088 return 0; 1088 return 0;
1089} 1089}
1090 1090
1091/* end of gnunet-mesh-profiler.c */ 1091/* end of gnunet-cadet-profiler.c */
1092 1092
diff --git a/src/mesh/gnunet-mesh.c b/src/mesh/gnunet-mesh.c
index a1d94ac03..840c6d0ac 100644
--- a/src/mesh/gnunet-mesh.c
+++ b/src/mesh/gnunet-mesh.c
@@ -19,14 +19,14 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file mesh/gnunet-mesh.c 22 * @file cadet/gnunet-cadet.c
23 * @brief Print information about mesh tunnels and peers. 23 * @brief Print information about cadet tunnels and peers.
24 * @author Bartlomiej Polot 24 * @author Bartlomiej Polot
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_mesh_service.h" 28#include "gnunet_cadet_service.h"
29#include "mesh.h" 29#include "cadet.h"
30 30
31 31
32/** 32/**
@@ -101,14 +101,14 @@ size_t data_size;
101 101
102 102
103/** 103/**
104 * Mesh handle. 104 * Cadet handle.
105 */ 105 */
106static struct GNUNET_MESH_Handle *mh; 106static struct GNUNET_CADET_Handle *mh;
107 107
108/** 108/**
109 * Channel handle. 109 * Channel handle.
110 */ 110 */
111static struct GNUNET_MESH_Channel *ch; 111static struct GNUNET_CADET_Channel *ch;
112 112
113/** 113/**
114 * Shutdown task handle. 114 * Shutdown task handle.
@@ -136,12 +136,12 @@ shutdown_task (void *cls,
136 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown\n"); 136 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown\n");
137 if (NULL != ch) 137 if (NULL != ch)
138 { 138 {
139 GNUNET_MESH_channel_destroy (ch); 139 GNUNET_CADET_channel_destroy (ch);
140 ch = NULL; 140 ch = NULL;
141 } 141 }
142 if (NULL != mh) 142 if (NULL != mh)
143 { 143 {
144 GNUNET_MESH_disconnect (mh); 144 GNUNET_CADET_disconnect (mh);
145 mh = NULL; 145 mh = NULL;
146 } 146 }
147} 147}
@@ -178,7 +178,7 @@ data_ready (void *cls, size_t size, void *buf)
178 178
179 msg = buf; 179 msg = buf;
180 msg->size = htons (total_size); 180 msg->size = htons (total_size);
181 msg->type = htons (GNUNET_MESSAGE_TYPE_MESH_CLI); 181 msg->type = htons (GNUNET_MESSAGE_TYPE_CADET_CLI);
182 memcpy (&msg[1], cls, data_size); 182 memcpy (&msg[1], cls, data_size);
183 if (GNUNET_NO == echo) 183 if (GNUNET_NO == echo)
184 { 184 {
@@ -218,7 +218,7 @@ read_stdio (void *cls,
218 GNUNET_SCHEDULER_shutdown(); 218 GNUNET_SCHEDULER_shutdown();
219 return; 219 return;
220 } 220 }
221 GNUNET_MESH_notify_transmit_ready (ch, GNUNET_NO, 221 GNUNET_CADET_notify_transmit_ready (ch, GNUNET_NO,
222 GNUNET_TIME_UNIT_FOREVER_REL, 222 GNUNET_TIME_UNIT_FOREVER_REL,
223 data_size 223 data_size
224 + sizeof (struct GNUNET_MessageHeader), 224 + sizeof (struct GNUNET_MessageHeader),
@@ -248,16 +248,16 @@ listen_stdio (void)
248 * Function called whenever a channel is destroyed. Should clean up 248 * Function called whenever a channel is destroyed. Should clean up
249 * any associated state. 249 * any associated state.
250 * 250 *
251 * It must NOT call #GNUNET_MESH_channel_destroy on the channel. 251 * It must NOT call #GNUNET_CADET_channel_destroy on the channel.
252 * 252 *
253 * @param cls closure (set from #GNUNET_MESH_connect) 253 * @param cls closure (set from #GNUNET_CADET_connect)
254 * @param channel connection to the other end (henceforth invalid) 254 * @param channel connection to the other end (henceforth invalid)
255 * @param channel_ctx place where local state associated 255 * @param channel_ctx place where local state associated
256 * with the channel is stored 256 * with the channel is stored
257 */ 257 */
258static void 258static void
259channel_ended (void *cls, 259channel_ended (void *cls,
260 const struct GNUNET_MESH_Channel *channel, 260 const struct GNUNET_CADET_Channel *channel,
261 void *channel_ctx) 261 void *channel_ctx)
262{ 262{
263 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Channel ended!\n"); 263 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Channel ended!\n");
@@ -271,25 +271,25 @@ channel_ended (void *cls,
271 * Method called whenever another peer has added us to a channel 271 * Method called whenever another peer has added us to a channel
272 * the other peer initiated. 272 * the other peer initiated.
273 * Only called (once) upon reception of data with a message type which was 273 * Only called (once) upon reception of data with a message type which was
274 * subscribed to in #GNUNET_MESH_connect. 274 * subscribed to in #GNUNET_CADET_connect.
275 * 275 *
276 * A call to #GNUNET_MESH_channel_destroy causes te channel to be ignored. In 276 * A call to #GNUNET_CADET_channel_destroy causes te channel to be ignored. In
277 * this case the handler MUST return NULL. 277 * this case the handler MUST return NULL.
278 * 278 *
279 * @param cls closure 279 * @param cls closure
280 * @param channel new handle to the channel 280 * @param channel new handle to the channel
281 * @param initiator peer that started the channel 281 * @param initiator peer that started the channel
282 * @param port Port this channel is for. 282 * @param port Port this channel is for.
283 * @param options MeshOption flag field, with all active option bits set to 1. 283 * @param options CadetOption flag field, with all active option bits set to 1.
284 * 284 *
285 * @return initial channel context for the channel 285 * @return initial channel context for the channel
286 * (can be NULL -- that's not an error) 286 * (can be NULL -- that's not an error)
287 */ 287 */
288static void * 288static void *
289channel_incoming (void *cls, 289channel_incoming (void *cls,
290 struct GNUNET_MESH_Channel * channel, 290 struct GNUNET_CADET_Channel * channel,
291 const struct GNUNET_PeerIdentity * initiator, 291 const struct GNUNET_PeerIdentity * initiator,
292 uint32_t port, enum GNUNET_MESH_ChannelOption options) 292 uint32_t port, enum GNUNET_CADET_ChannelOption options)
293{ 293{
294 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 294 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
295 "Incoming channel %p on port %u\n", 295 "Incoming channel %p on port %u\n",
@@ -326,7 +326,7 @@ send_echo (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
326 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) || NULL == ch) 326 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) || NULL == ch)
327 return; 327 return;
328 328
329 GNUNET_MESH_notify_transmit_ready (ch, GNUNET_NO, 329 GNUNET_CADET_notify_transmit_ready (ch, GNUNET_NO,
330 GNUNET_TIME_UNIT_FOREVER_REL, 330 GNUNET_TIME_UNIT_FOREVER_REL,
331 sizeof (struct GNUNET_MessageHeader), 331 sizeof (struct GNUNET_MessageHeader),
332 &data_ready, NULL); 332 &data_ready, NULL);
@@ -335,7 +335,7 @@ send_echo (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
335 335
336 336
337/** 337/**
338 * Call MESH's monitor API, get info of one connection. 338 * Call CADET's monitor API, get info of one connection.
339 * 339 *
340 * @param cls Closure (unused). 340 * @param cls Closure (unused).
341 * @param tc TaskContext 341 * @param tc TaskContext
@@ -344,7 +344,7 @@ static void
344create_channel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 344create_channel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
345{ 345{
346 struct GNUNET_PeerIdentity pid; 346 struct GNUNET_PeerIdentity pid;
347 enum GNUNET_MESH_ChannelOption opt; 347 enum GNUNET_CADET_ChannelOption opt;
348 348
349 GNUNET_assert (NULL == ch); 349 GNUNET_assert (NULL == ch);
350 350
@@ -360,8 +360,8 @@ create_channel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
360 return; 360 return;
361 } 361 }
362 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting to `%s'\n", target_id); 362 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting to `%s'\n", target_id);
363 opt = GNUNET_MESH_OPTION_DEFAULT | GNUNET_MESH_OPTION_RELIABLE; 363 opt = GNUNET_CADET_OPTION_DEFAULT | GNUNET_CADET_OPTION_RELIABLE;
364 ch = GNUNET_MESH_channel_create (mh, NULL, &pid, target_port, opt); 364 ch = GNUNET_CADET_channel_create (mh, NULL, &pid, target_port, opt);
365 if (GNUNET_NO == echo) 365 if (GNUNET_NO == echo)
366 listen_stdio (); 366 listen_stdio ();
367 else 367 else
@@ -372,11 +372,11 @@ create_channel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
372/** 372/**
373 * Function called whenever a message is received. 373 * Function called whenever a message is received.
374 * 374 *
375 * Each time the function must call #GNUNET_MESH_receive_done on the channel 375 * Each time the function must call #GNUNET_CADET_receive_done on the channel
376 * in order to receive the next message. This doesn't need to be immediate: 376 * in order to receive the next message. This doesn't need to be immediate:
377 * can be delayed if some processing is done on the message. 377 * can be delayed if some processing is done on the message.
378 * 378 *
379 * @param cls Closure (set from #GNUNET_MESH_connect). 379 * @param cls Closure (set from #GNUNET_CADET_connect).
380 * @param channel Connection to the other end. 380 * @param channel Connection to the other end.
381 * @param channel_ctx Place to store local state associated with the channel. 381 * @param channel_ctx Place to store local state associated with the channel.
382 * @param message The actual message. 382 * @param message The actual message.
@@ -385,7 +385,7 @@ create_channel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
385 */ 385 */
386static int 386static int
387data_callback (void *cls, 387data_callback (void *cls,
388 struct GNUNET_MESH_Channel *channel, 388 struct GNUNET_CADET_Channel *channel,
389 void **channel_ctx, 389 void **channel_ctx,
390 const struct GNUNET_MessageHeader *message) 390 const struct GNUNET_MessageHeader *message)
391{ 391{
@@ -400,7 +400,7 @@ data_callback (void *cls,
400 if (0 != listen_port) 400 if (0 != listen_port)
401 { 401 {
402 /* Just listening to echo incoming messages*/ 402 /* Just listening to echo incoming messages*/
403 GNUNET_MESH_notify_transmit_ready (channel, GNUNET_NO, 403 GNUNET_CADET_notify_transmit_ready (channel, GNUNET_NO,
404 GNUNET_TIME_UNIT_FOREVER_REL, 404 GNUNET_TIME_UNIT_FOREVER_REL,
405 sizeof (struct GNUNET_MessageHeader), 405 sizeof (struct GNUNET_MessageHeader),
406 &data_ready, NULL); 406 &data_ready, NULL);
@@ -440,7 +440,7 @@ data_callback (void *cls,
440 440
441 441
442/** 442/**
443 * Method called to retrieve information about all peers in MESH, called 443 * Method called to retrieve information about all peers in CADET, called
444 * once per peer. 444 * once per peer.
445 * 445 *
446 * After last peer has been reported, an additional call with NULL is done. 446 * After last peer has been reported, an additional call with NULL is done.
@@ -493,7 +493,7 @@ peer_callback (void *cls,
493 493
494 494
495/** 495/**
496 * Method called to retrieve information about all tunnels in MESH. 496 * Method called to retrieve information about all tunnels in CADET.
497 * 497 *
498 * @param cls Closure. 498 * @param cls Closure.
499 * @param peer Destination peer. 499 * @param peer Destination peer.
@@ -524,7 +524,7 @@ tunnels_callback (void *cls,
524 524
525 525
526/** 526/**
527 * Method called to retrieve information about a specific tunnel the mesh peer 527 * Method called to retrieve information about a specific tunnel the cadet peer
528 * has established, o`r is trying to establish. 528 * has established, o`r is trying to establish.
529 * 529 *
530 * @param cls Closure. 530 * @param cls Closure.
@@ -542,7 +542,7 @@ tunnel_callback (void *cls,
542 unsigned int n_channels, 542 unsigned int n_channels,
543 unsigned int n_connections, 543 unsigned int n_connections,
544 uint32_t *channels, 544 uint32_t *channels,
545 struct GNUNET_MESH_Hash *connections, 545 struct GNUNET_CADET_Hash *connections,
546 unsigned int estate, 546 unsigned int estate,
547 unsigned int cstate) 547 unsigned int cstate)
548{ 548{
@@ -570,7 +570,7 @@ tunnel_callback (void *cls,
570 570
571 571
572/** 572/**
573 * Call MESH's meta API, get all peers known to a peer. 573 * Call CADET's meta API, get all peers known to a peer.
574 * 574 *
575 * @param cls Closure (unused). 575 * @param cls Closure (unused).
576 * @param tc TaskContext 576 * @param tc TaskContext
@@ -583,12 +583,12 @@ get_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
583 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown\n"); 583 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown\n");
584 return; 584 return;
585 } 585 }
586 GNUNET_MESH_get_peers (mh, &peers_callback, NULL); 586 GNUNET_CADET_get_peers (mh, &peers_callback, NULL);
587} 587}
588 588
589 589
590/** 590/**
591 * Call MESH's monitor API, get info of one peer. 591 * Call CADET's monitor API, get info of one peer.
592 * 592 *
593 * @param cls Closure (unused). 593 * @param cls Closure (unused).
594 * @param tc TaskContext 594 * @param tc TaskContext
@@ -609,11 +609,11 @@ show_peer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
609 GNUNET_SCHEDULER_shutdown(); 609 GNUNET_SCHEDULER_shutdown();
610 return; 610 return;
611 } 611 }
612 GNUNET_MESH_get_peer (mh, &pid, peer_callback, NULL); 612 GNUNET_CADET_get_peer (mh, &pid, peer_callback, NULL);
613} 613}
614 614
615/** 615/**
616 * Call MESH's meta API, get all tunnels known to a peer. 616 * Call CADET's meta API, get all tunnels known to a peer.
617 * 617 *
618 * @param cls Closure (unused). 618 * @param cls Closure (unused).
619 * @param tc TaskContext 619 * @param tc TaskContext
@@ -626,12 +626,12 @@ get_tunnels (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
626 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown\n"); 626 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown\n");
627 return; 627 return;
628 } 628 }
629 GNUNET_MESH_get_tunnels (mh, &tunnels_callback, NULL); 629 GNUNET_CADET_get_tunnels (mh, &tunnels_callback, NULL);
630} 630}
631 631
632 632
633/** 633/**
634 * Call MESH's monitor API, get info of one tunnel. 634 * Call CADET's monitor API, get info of one tunnel.
635 * 635 *
636 * @param cls Closure (unused). 636 * @param cls Closure (unused).
637 * @param tc TaskContext 637 * @param tc TaskContext
@@ -652,12 +652,12 @@ show_tunnel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
652 GNUNET_SCHEDULER_shutdown(); 652 GNUNET_SCHEDULER_shutdown();
653 return; 653 return;
654 } 654 }
655 GNUNET_MESH_get_tunnel (mh, &pid, tunnel_callback, NULL); 655 GNUNET_CADET_get_tunnel (mh, &pid, tunnel_callback, NULL);
656} 656}
657 657
658 658
659/** 659/**
660 * Call MESH's monitor API, get info of one channel. 660 * Call CADET's monitor API, get info of one channel.
661 * 661 *
662 * @param cls Closure (unused). 662 * @param cls Closure (unused).
663 * @param tc TaskContext 663 * @param tc TaskContext
@@ -670,7 +670,7 @@ show_channel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
670 670
671 671
672/** 672/**
673 * Call MESH's monitor API, get info of one connection. 673 * Call CADET's monitor API, get info of one connection.
674 * 674 *
675 * @param cls Closure (unused). 675 * @param cls Closure (unused).
676 * @param tc TaskContext 676 * @param tc TaskContext
@@ -694,10 +694,10 @@ static void
694run (void *cls, char *const *args, const char *cfgfile, 694run (void *cls, char *const *args, const char *cfgfile,
695 const struct GNUNET_CONFIGURATION_Handle *cfg) 695 const struct GNUNET_CONFIGURATION_Handle *cfg)
696{ 696{
697 GNUNET_MESH_InboundChannelNotificationHandler *newch = NULL; 697 GNUNET_CADET_InboundChannelNotificationHandler *newch = NULL;
698 GNUNET_MESH_ChannelEndHandler *endch = NULL; 698 GNUNET_CADET_ChannelEndHandler *endch = NULL;
699 static const struct GNUNET_MESH_MessageHandler handlers[] = { 699 static const struct GNUNET_CADET_MessageHandler handlers[] = {
700 {&data_callback, GNUNET_MESSAGE_TYPE_MESH_CLI, 0}, 700 {&data_callback, GNUNET_MESSAGE_TYPE_CADET_CLI, 0},
701 {NULL, 0, 0} /* FIXME add option to monitor msg types */ 701 {NULL, 0, 0} /* FIXME add option to monitor msg types */
702 }; 702 };
703 static uint32_t *ports = NULL; 703 static uint32_t *ports = NULL;
@@ -770,8 +770,8 @@ run (void *cls, char *const *args, const char *cfgfile,
770 return; 770 return;
771 } 771 }
772 772
773 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting to mesh\n"); 773 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting to cadet\n");
774 mh = GNUNET_MESH_connect (cfg, 774 mh = GNUNET_CADET_connect (cfg,
775 NULL, /* cls */ 775 NULL, /* cls */
776 newch, /* new channel */ 776 newch, /* new channel */
777 endch, /* cleaner */ 777 endch, /* cleaner */
@@ -798,7 +798,7 @@ int
798main (int argc, char *const *argv) 798main (int argc, char *const *argv)
799{ 799{
800 int res; 800 int res;
801 const char helpstr[] = "Create channels and retreive info about meshs status."; 801 const char helpstr[] = "Create channels and retreive info about cadets status.";
802 static const struct GNUNET_GETOPT_CommandLineOption options[] = { 802 static const struct GNUNET_GETOPT_CommandLineOption options[] = {
803// {'a', "channel", "TUNNEL_ID:CHANNEL_ID", 803// {'a', "channel", "TUNNEL_ID:CHANNEL_ID",
804// gettext_noop ("provide information about a particular channel"), 804// gettext_noop ("provide information about a particular channel"),
@@ -836,7 +836,7 @@ main (int argc, char *const *argv)
836 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) 836 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
837 return 2; 837 return 2;
838 838
839 res = GNUNET_PROGRAM_run (argc, argv, "gnunet-mesh (OPTIONS | TARGET PORT)", 839 res = GNUNET_PROGRAM_run (argc, argv, "gnunet-cadet (OPTIONS | TARGET PORT)",
840 gettext_noop (helpstr), 840 gettext_noop (helpstr),
841 options, &run, NULL); 841 options, &run, NULL);
842 842
@@ -848,4 +848,4 @@ main (int argc, char *const *argv)
848 return 1; 848 return 1;
849} 849}
850 850
851/* end of gnunet-mesh.c */ 851/* end of gnunet-cadet.c */
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c
index 044ab99da..de9aaf7a5 100644
--- a/src/mesh/gnunet-service-mesh.c
+++ b/src/mesh/gnunet-service-mesh.c
@@ -19,8 +19,8 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file mesh/gnunet-service-mesh.c 22 * @file cadet/gnunet-service-cadet.c
23 * @brief GNUnet MESH service with encryption 23 * @brief GNUnet CADET service with encryption
24 * @author Bartlomiej Polot 24 * @author Bartlomiej Polot
25 * 25 *
26 * FIXME in progress: 26 * FIXME in progress:
@@ -33,7 +33,7 @@
33 * TODO END 33 * TODO END
34 * 34 *
35 * Dictionary: 35 * Dictionary:
36 * - peer: other mesh instance. If there is direct connection it's a neighbor. 36 * - peer: other cadet instance. If there is direct connection it's a neighbor.
37 * - tunnel: encrypted connection to a peer, neighbor or not. 37 * - tunnel: encrypted connection to a peer, neighbor or not.
38 * - channel: connection between two clients, on the same or different peers. 38 * - channel: connection between two clients, on the same or different peers.
39 * have properties like reliability. 39 * have properties like reliability.
@@ -43,16 +43,16 @@
43 43
44#include "platform.h" 44#include "platform.h"
45#include "gnunet_util_lib.h" 45#include "gnunet_util_lib.h"
46#include "mesh.h" 46#include "cadet.h"
47#include "gnunet_statistics_service.h" 47#include "gnunet_statistics_service.h"
48 48
49#include "gnunet-service-mesh_local.h" 49#include "gnunet-service-cadet_local.h"
50#include "gnunet-service-mesh_channel.h" 50#include "gnunet-service-cadet_channel.h"
51#include "gnunet-service-mesh_connection.h" 51#include "gnunet-service-cadet_connection.h"
52#include "gnunet-service-mesh_tunnel.h" 52#include "gnunet-service-cadet_tunnel.h"
53#include "gnunet-service-mesh_dht.h" 53#include "gnunet-service-cadet_dht.h"
54#include "gnunet-service-mesh_peer.h" 54#include "gnunet-service-cadet_peer.h"
55#include "gnunet-service-mesh_hello.h" 55#include "gnunet-service-cadet_hello.h"
56 56
57 57
58/******************************************************************************/ 58/******************************************************************************/
@@ -121,7 +121,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
121 121
122 122
123/** 123/**
124 * Process mesh requests. 124 * Process cadet requests.
125 * 125 *
126 * @param cls closure 126 * @param cls closure
127 * @param server the initialized server 127 * @param server the initialized server
@@ -133,7 +133,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
133{ 133{
134 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "starting to run\n"); 134 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "starting to run\n");
135 135
136 stats = GNUNET_STATISTICS_create ("mesh", c); 136 stats = GNUNET_STATISTICS_create ("cadet", c);
137 137
138 /* Scheduled the task to clean up when shutdown is called */ 138 /* Scheduled the task to clean up when shutdown is called */
139 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, 139 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
@@ -144,7 +144,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
144 GNUNET_CRYPTO_eddsa_key_get_public (my_private_key, &my_full_id.public_key); 144 GNUNET_CRYPTO_eddsa_key_get_public (my_private_key, &my_full_id.public_key);
145 myid = GNUNET_PEER_intern (&my_full_id); 145 myid = GNUNET_PEER_intern (&my_full_id);
146 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 146 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
147 "STARTING SERVICE (MESH) for peer [%s]\n", 147 "STARTING SERVICE (CADET) for peer [%s]\n",
148 GNUNET_i2s (&my_full_id)); 148 GNUNET_i2s (&my_full_id));
149 149
150 GML_init (server); /* Local clients */ 150 GML_init (server); /* Local clients */
@@ -154,12 +154,12 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
154 GMD_init (c); /* DHT */ 154 GMD_init (c); /* DHT */
155 GMT_init (c, my_private_key); /* Tunnels */ 155 GMT_init (c, my_private_key); /* Tunnels */
156 156
157 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Mesh service running\n"); 157 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cadet service running\n");
158} 158}
159 159
160 160
161/** 161/**
162 * The main function for the mesh service. 162 * The main function for the cadet service.
163 * 163 *
164 * @param argc number of arguments from the command line 164 * @param argc number of arguments from the command line
165 * @param argv command line arguments 165 * @param argv command line arguments
@@ -172,7 +172,7 @@ main (int argc, char *const *argv)
172 int r; 172 int r;
173 173
174 shutting_down = GNUNET_NO; 174 shutting_down = GNUNET_NO;
175 r = GNUNET_SERVICE_run (argc, argv, "mesh", GNUNET_SERVICE_OPTION_NONE, &run, 175 r = GNUNET_SERVICE_run (argc, argv, "cadet", GNUNET_SERVICE_OPTION_NONE, &run,
176 NULL); 176 NULL);
177 GNUNET_free (my_private_key); 177 GNUNET_free (my_private_key);
178 ret = (GNUNET_OK == r) ? 0 : 1; 178 ret = (GNUNET_OK == r) ? 0 : 1;
diff --git a/src/mesh/gnunet-service-mesh_channel.c b/src/mesh/gnunet-service-mesh_channel.c
index d3bbcdbc0..91338d5c0 100644
--- a/src/mesh/gnunet-service-mesh_channel.c
+++ b/src/mesh/gnunet-service-mesh_channel.c
@@ -24,52 +24,52 @@
24 24
25#include "gnunet_statistics_service.h" 25#include "gnunet_statistics_service.h"
26 26
27#include "mesh.h" 27#include "cadet.h"
28#include "mesh_protocol.h" 28#include "cadet_protocol.h"
29 29
30#include "gnunet-service-mesh_channel.h" 30#include "gnunet-service-cadet_channel.h"
31#include "gnunet-service-mesh_local.h" 31#include "gnunet-service-cadet_local.h"
32#include "gnunet-service-mesh_tunnel.h" 32#include "gnunet-service-cadet_tunnel.h"
33#include "gnunet-service-mesh_peer.h" 33#include "gnunet-service-cadet_peer.h"
34 34
35#define LOG(level, ...) GNUNET_log_from(level,"mesh-chn",__VA_ARGS__) 35#define LOG(level, ...) GNUNET_log_from(level,"cadet-chn",__VA_ARGS__)
36 36
37#define MESH_RETRANSMIT_TIME GNUNET_TIME_relative_multiply(\ 37#define CADET_RETRANSMIT_TIME GNUNET_TIME_relative_multiply(\
38 GNUNET_TIME_UNIT_MILLISECONDS, 250) 38 GNUNET_TIME_UNIT_MILLISECONDS, 250)
39#define MESH_RETRANSMIT_MARGIN 4 39#define CADET_RETRANSMIT_MARGIN 4
40 40
41 41
42/** 42/**
43 * All the states a connection can be in. 43 * All the states a connection can be in.
44 */ 44 */
45enum MeshChannelState 45enum CadetChannelState
46{ 46{
47 /** 47 /**
48 * Uninitialized status, should never appear in operation. 48 * Uninitialized status, should never appear in operation.
49 */ 49 */
50 MESH_CHANNEL_NEW, 50 CADET_CHANNEL_NEW,
51 51
52 /** 52 /**
53 * Connection create message sent, waiting for ACK. 53 * Connection create message sent, waiting for ACK.
54 */ 54 */
55 MESH_CHANNEL_SENT, 55 CADET_CHANNEL_SENT,
56 56
57 /** 57 /**
58 * Connection confirmed, ready to carry traffic. 58 * Connection confirmed, ready to carry traffic.
59 */ 59 */
60 MESH_CHANNEL_READY, 60 CADET_CHANNEL_READY,
61}; 61};
62 62
63 63
64/** 64/**
65 * Info holder for channel messages in queues. 65 * Info holder for channel messages in queues.
66 */ 66 */
67struct MeshChannelQueue 67struct CadetChannelQueue
68{ 68{
69 /** 69 /**
70 * Tunnel Queue. 70 * Tunnel Queue.
71 */ 71 */
72 struct MeshTunnel3Queue *tq; 72 struct CadetTunnel3Queue *tq;
73 73
74 /** 74 /**
75 * Message type (DATA/DATA_ACK) 75 * Message type (DATA/DATA_ACK)
@@ -79,25 +79,25 @@ struct MeshChannelQueue
79 /** 79 /**
80 * Message copy (for DATAs, to start retransmission timer) 80 * Message copy (for DATAs, to start retransmission timer)
81 */ 81 */
82 struct MeshReliableMessage *copy; 82 struct CadetReliableMessage *copy;
83 83
84 /** 84 /**
85 * Reliability (for DATA_ACKs, to access rel->ack_q) 85 * Reliability (for DATA_ACKs, to access rel->ack_q)
86 */ 86 */
87 struct MeshChannelReliability *rel; 87 struct CadetChannelReliability *rel;
88}; 88};
89 89
90 90
91/** 91/**
92 * Info needed to retry a message in case it gets lost. 92 * Info needed to retry a message in case it gets lost.
93 */ 93 */
94struct MeshReliableMessage 94struct CadetReliableMessage
95{ 95{
96 /** 96 /**
97 * Double linked list, FIFO style 97 * Double linked list, FIFO style
98 */ 98 */
99 struct MeshReliableMessage *next; 99 struct CadetReliableMessage *next;
100 struct MeshReliableMessage *prev; 100 struct CadetReliableMessage *prev;
101 101
102 /** 102 /**
103 * Type of message (payload, channel management). 103 * Type of message (payload, channel management).
@@ -107,7 +107,7 @@ struct MeshReliableMessage
107 /** 107 /**
108 * Tunnel Reliability queue this message is in. 108 * Tunnel Reliability queue this message is in.
109 */ 109 */
110 struct MeshChannelReliability *rel; 110 struct CadetChannelReliability *rel;
111 111
112 /** 112 /**
113 * ID of the message (ACK needed to free) 113 * ID of the message (ACK needed to free)
@@ -117,38 +117,38 @@ struct MeshReliableMessage
117 /** 117 /**
118 * Tunnel Queue. 118 * Tunnel Queue.
119 */ 119 */
120 struct MeshChannelQueue *chq; 120 struct CadetChannelQueue *chq;
121 121
122 /** 122 /**
123 * When was this message issued (to calculate ACK delay) 123 * When was this message issued (to calculate ACK delay)
124 */ 124 */
125 struct GNUNET_TIME_Absolute timestamp; 125 struct GNUNET_TIME_Absolute timestamp;
126 126
127 /* struct GNUNET_MESH_Data with payload */ 127 /* struct GNUNET_CADET_Data with payload */
128}; 128};
129 129
130 130
131/** 131/**
132 * Info about the traffic state for a client in a channel. 132 * Info about the traffic state for a client in a channel.
133 */ 133 */
134struct MeshChannelReliability 134struct CadetChannelReliability
135{ 135{
136 /** 136 /**
137 * Channel this is about. 137 * Channel this is about.
138 */ 138 */
139 struct MeshChannel *ch; 139 struct CadetChannel *ch;
140 140
141 /** 141 /**
142 * DLL of messages sent and not yet ACK'd. 142 * DLL of messages sent and not yet ACK'd.
143 */ 143 */
144 struct MeshReliableMessage *head_sent; 144 struct CadetReliableMessage *head_sent;
145 struct MeshReliableMessage *tail_sent; 145 struct CadetReliableMessage *tail_sent;
146 146
147 /** 147 /**
148 * DLL of messages received out of order. 148 * DLL of messages received out of order.
149 */ 149 */
150 struct MeshReliableMessage *head_recv; 150 struct CadetReliableMessage *head_recv;
151 struct MeshReliableMessage *tail_recv; 151 struct CadetReliableMessage *tail_recv;
152 152
153 /** 153 /**
154 * Messages received. 154 * Messages received.
@@ -168,7 +168,7 @@ struct MeshChannelReliability
168 /** 168 /**
169 * Handle for queued unique data CREATE, DATA_ACK. 169 * Handle for queued unique data CREATE, DATA_ACK.
170 */ 170 */
171 struct MeshChannelQueue *uniq; 171 struct CadetChannelQueue *uniq;
172 172
173 /** 173 /**
174 * Can we send data to the client? 174 * Can we send data to the client?
@@ -200,12 +200,12 @@ struct MeshChannelReliability
200/** 200/**
201 * Struct containing all information regarding a channel to a remote client. 201 * Struct containing all information regarding a channel to a remote client.
202 */ 202 */
203struct MeshChannel 203struct CadetChannel
204{ 204{
205 /** 205 /**
206 * Tunnel this channel is in. 206 * Tunnel this channel is in.
207 */ 207 */
208 struct MeshTunnel3 *t; 208 struct CadetTunnel3 *t;
209 209
210 /** 210 /**
211 * Destination port of the channel. 211 * Destination port of the channel.
@@ -213,26 +213,26 @@ struct MeshChannel
213 uint32_t port; 213 uint32_t port;
214 214
215 /** 215 /**
216 * Global channel number ( < GNUNET_MESH_LOCAL_CHANNEL_ID_CLI) 216 * Global channel number ( < GNUNET_CADET_LOCAL_CHANNEL_ID_CLI)
217 */ 217 */
218 MESH_ChannelNumber gid; 218 CADET_ChannelNumber gid;
219 219
220 /** 220 /**
221 * Local tunnel number for root (owner) client. 221 * Local tunnel number for root (owner) client.
222 * ( >= GNUNET_MESH_LOCAL_CHANNEL_ID_CLI or 0 ) 222 * ( >= GNUNET_CADET_LOCAL_CHANNEL_ID_CLI or 0 )
223 */ 223 */
224 MESH_ChannelNumber lid_root; 224 CADET_ChannelNumber lid_root;
225 225
226 /** 226 /**
227 * Local tunnel number for local destination clients (incoming number) 227 * Local tunnel number for local destination clients (incoming number)
228 * ( >= GNUNET_MESH_LOCAL_CHANNEL_ID_SERV or 0). 228 * ( >= GNUNET_CADET_LOCAL_CHANNEL_ID_SERV or 0).
229 */ 229 */
230 MESH_ChannelNumber lid_dest; 230 CADET_ChannelNumber lid_dest;
231 231
232 /** 232 /**
233 * Channel state. 233 * Channel state.
234 */ 234 */
235 enum MeshChannelState state; 235 enum CadetChannelState state;
236 236
237 /** 237 /**
238 * Is the tunnel bufferless (minimum latency)? 238 * Is the tunnel bufferless (minimum latency)?
@@ -252,12 +252,12 @@ struct MeshChannel
252 /** 252 /**
253 * Client owner of the tunnel, if any 253 * Client owner of the tunnel, if any
254 */ 254 */
255 struct MeshClient *root; 255 struct CadetClient *root;
256 256
257 /** 257 /**
258 * Client destination of the tunnel, if any. 258 * Client destination of the tunnel, if any.
259 */ 259 */
260 struct MeshClient *dest; 260 struct CadetClient *dest;
261 261
262 /** 262 /**
263 * Flag to signal the destruction of the channel. 263 * Flag to signal the destruction of the channel.
@@ -275,13 +275,13 @@ struct MeshChannel
275 * Reliability data. 275 * Reliability data.
276 * Only present (non-NULL) at the owner of a tunnel. 276 * Only present (non-NULL) at the owner of a tunnel.
277 */ 277 */
278 struct MeshChannelReliability *root_rel; 278 struct CadetChannelReliability *root_rel;
279 279
280 /** 280 /**
281 * Reliability data. 281 * Reliability data.
282 * Only present (non-NULL) at the destination of a tunnel. 282 * Only present (non-NULL) at the destination of a tunnel.
283 */ 283 */
284 struct MeshChannelReliability *dest_rel; 284 struct CadetChannelReliability *dest_rel;
285 285
286}; 286};
287 287
@@ -317,7 +317,7 @@ extern GNUNET_PEER_Id myid;
317 * retransmitted message. 317 * retransmitted message.
318 */ 318 */
319static int 319static int
320rel_message_free (struct MeshReliableMessage *copy, int update_time); 320rel_message_free (struct CadetReliableMessage *copy, int update_time);
321 321
322/** 322/**
323 * send a channel create message. 323 * send a channel create message.
@@ -325,7 +325,7 @@ rel_message_free (struct MeshReliableMessage *copy, int update_time);
325 * @param ch Channel for which to send. 325 * @param ch Channel for which to send.
326 */ 326 */
327static void 327static void
328send_create (struct MeshChannel *ch); 328send_create (struct CadetChannel *ch);
329 329
330/** 330/**
331 * Confirm we got a channel create, FWD ack. 331 * Confirm we got a channel create, FWD ack.
@@ -335,7 +335,7 @@ send_create (struct MeshChannel *ch);
335 * @param reaction This ACK is a reaction to a duplicate CREATE, don't save. 335 * @param reaction This ACK is a reaction to a duplicate CREATE, don't save.
336 */ 336 */
337static void 337static void
338send_ack (struct MeshChannel *ch, int fwd, int reaction); 338send_ack (struct CadetChannel *ch, int fwd, int reaction);
339 339
340 340
341 341
@@ -347,7 +347,7 @@ send_ack (struct MeshChannel *ch, int fwd, int reaction);
347 * @return #GNUNET_YES if channel is loopback, #GNUNET_NO otherwise. 347 * @return #GNUNET_YES if channel is loopback, #GNUNET_NO otherwise.
348 */ 348 */
349static int 349static int
350is_loopback (const struct MeshChannel *ch) 350is_loopback (const struct CadetChannel *ch)
351{ 351{
352 if (NULL != ch->t) 352 if (NULL != ch->t)
353 return GMT_is_loopback (ch->t); 353 return GMT_is_loopback (ch->t);
@@ -363,18 +363,18 @@ is_loopback (const struct MeshChannel *ch)
363 * @param mid Message ID. 363 * @param mid Message ID.
364 * @param rel Reliability data for retransmission. 364 * @param rel Reliability data for retransmission.
365 */ 365 */
366static struct MeshReliableMessage * 366static struct CadetReliableMessage *
367copy_message (const struct GNUNET_MESH_Data *msg, uint32_t mid, 367copy_message (const struct GNUNET_CADET_Data *msg, uint32_t mid,
368 struct MeshChannelReliability *rel) 368 struct CadetChannelReliability *rel)
369{ 369{
370 struct MeshReliableMessage *copy; 370 struct CadetReliableMessage *copy;
371 uint16_t size; 371 uint16_t size;
372 372
373 size = ntohs (msg->header.size); 373 size = ntohs (msg->header.size);
374 copy = GNUNET_malloc (sizeof (*copy) + size); 374 copy = GNUNET_malloc (sizeof (*copy) + size);
375 copy->mid = mid; 375 copy->mid = mid;
376 copy->rel = rel; 376 copy->rel = rel;
377 copy->type = GNUNET_MESSAGE_TYPE_MESH_DATA; 377 copy->type = GNUNET_MESSAGE_TYPE_CADET_DATA;
378 memcpy (&copy[1], msg, size); 378 memcpy (&copy[1], msg, size);
379 379
380 return copy; 380 return copy;
@@ -385,15 +385,15 @@ copy_message (const struct GNUNET_MESH_Data *msg, uint32_t mid,
385 * Buffer it until we receive an ACK from the client or the missing 385 * Buffer it until we receive an ACK from the client or the missing
386 * message from the channel. 386 * message from the channel.
387 * 387 *
388 * @param msg Message to buffer (MUST be of type MESH_DATA). 388 * @param msg Message to buffer (MUST be of type CADET_DATA).
389 * @param rel Reliability data to the corresponding direction. 389 * @param rel Reliability data to the corresponding direction.
390 */ 390 */
391static void 391static void
392add_buffered_data (const struct GNUNET_MESH_Data *msg, 392add_buffered_data (const struct GNUNET_CADET_Data *msg,
393 struct MeshChannelReliability *rel) 393 struct CadetChannelReliability *rel)
394{ 394{
395 struct MeshReliableMessage *copy; 395 struct CadetReliableMessage *copy;
396 struct MeshReliableMessage *prev; 396 struct CadetReliableMessage *prev;
397 uint32_t mid; 397 uint32_t mid;
398 398
399 mid = ntohl (msg->mid); 399 mid = ntohl (msg->mid);
@@ -436,7 +436,7 @@ add_buffered_data (const struct GNUNET_MESH_Data *msg,
436 * @param c Client which to add to the channel. 436 * @param c Client which to add to the channel.
437 */ 437 */
438static void 438static void
439add_destination (struct MeshChannel *ch, struct MeshClient *c) 439add_destination (struct CadetChannel *ch, struct CadetClient *c)
440{ 440{
441 if (NULL != ch->dest) 441 if (NULL != ch->dest)
442 { 442 {
@@ -451,10 +451,10 @@ add_destination (struct MeshChannel *ch, struct MeshClient *c)
451 GML_channel_add (c, ch->lid_dest, ch); 451 GML_channel_add (c, ch->lid_dest, ch);
452 452
453 GNUNET_break (NULL == ch->dest_rel); 453 GNUNET_break (NULL == ch->dest_rel);
454 ch->dest_rel = GNUNET_new (struct MeshChannelReliability); 454 ch->dest_rel = GNUNET_new (struct CadetChannelReliability);
455 ch->dest_rel->ch = ch; 455 ch->dest_rel->ch = ch;
456 ch->dest_rel->expected_delay.rel_value_us = 0; 456 ch->dest_rel->expected_delay.rel_value_us = 0;
457 ch->dest_rel->retry_timer = MESH_RETRANSMIT_TIME; 457 ch->dest_rel->retry_timer = CADET_RETRANSMIT_TIME;
458 458
459 ch->dest = c; 459 ch->dest = c;
460} 460}
@@ -467,11 +467,11 @@ add_destination (struct MeshChannel *ch, struct MeshClient *c)
467 * @param options Bit array in host byte order. 467 * @param options Bit array in host byte order.
468 */ 468 */
469static void 469static void
470channel_set_options (struct MeshChannel *ch, uint32_t options) 470channel_set_options (struct CadetChannel *ch, uint32_t options)
471{ 471{
472 ch->nobuffer = (options & GNUNET_MESH_OPTION_NOBUFFER) != 0 ? 472 ch->nobuffer = (options & GNUNET_CADET_OPTION_NOBUFFER) != 0 ?
473 GNUNET_YES : GNUNET_NO; 473 GNUNET_YES : GNUNET_NO;
474 ch->reliable = (options & GNUNET_MESH_OPTION_RELIABLE) != 0 ? 474 ch->reliable = (options & GNUNET_CADET_OPTION_RELIABLE) != 0 ?
475 GNUNET_YES : GNUNET_NO; 475 GNUNET_YES : GNUNET_NO;
476} 476}
477 477
@@ -484,15 +484,15 @@ channel_set_options (struct MeshChannel *ch, uint32_t options)
484 * @return Bit array in host byte order. 484 * @return Bit array in host byte order.
485 */ 485 */
486static uint32_t 486static uint32_t
487channel_get_options (struct MeshChannel *ch) 487channel_get_options (struct CadetChannel *ch)
488{ 488{
489 uint32_t options; 489 uint32_t options;
490 490
491 options = 0; 491 options = 0;
492 if (ch->nobuffer) 492 if (ch->nobuffer)
493 options |= GNUNET_MESH_OPTION_NOBUFFER; 493 options |= GNUNET_CADET_OPTION_NOBUFFER;
494 if (ch->reliable) 494 if (ch->reliable)
495 options |= GNUNET_MESH_OPTION_RELIABLE; 495 options |= GNUNET_CADET_OPTION_RELIABLE;
496 496
497 return options; 497 return options;
498} 498}
@@ -505,11 +505,11 @@ channel_get_options (struct MeshChannel *ch)
505 * @param local_only Should we avoid sending it to other peers? 505 * @param local_only Should we avoid sending it to other peers?
506 */ 506 */
507static void 507static void
508send_destroy (struct MeshChannel *ch, int local_only) 508send_destroy (struct CadetChannel *ch, int local_only)
509{ 509{
510 struct GNUNET_MESH_ChannelManage msg; 510 struct GNUNET_CADET_ChannelManage msg;
511 511
512 msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY); 512 msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY);
513 msg.header.size = htons (sizeof (msg)); 513 msg.header.size = htons (sizeof (msg));
514 msg.chid = htonl (ch->gid); 514 msg.chid = htonl (ch->gid);
515 515
@@ -536,7 +536,7 @@ send_destroy (struct MeshChannel *ch, int local_only)
536 * @param ch Channel that was created. 536 * @param ch Channel that was created.
537 */ 537 */
538static void 538static void
539send_client_create (struct MeshChannel *ch) 539send_client_create (struct CadetChannel *ch)
540{ 540{
541 uint32_t opt; 541 uint32_t opt;
542 542
@@ -544,8 +544,8 @@ send_client_create (struct MeshChannel *ch)
544 return; 544 return;
545 545
546 opt = 0; 546 opt = 0;
547 opt |= GNUNET_YES == ch->reliable ? GNUNET_MESH_OPTION_RELIABLE : 0; 547 opt |= GNUNET_YES == ch->reliable ? GNUNET_CADET_OPTION_RELIABLE : 0;
548 opt |= GNUNET_YES == ch->nobuffer ? GNUNET_MESH_OPTION_NOBUFFER : 0; 548 opt |= GNUNET_YES == ch->nobuffer ? GNUNET_CADET_OPTION_NOBUFFER : 0;
549 GML_send_channel_create (ch->dest, ch->lid_dest, ch->port, opt, 549 GML_send_channel_create (ch->dest, ch->lid_dest, ch->port, opt,
550 GMT_get_destination (ch->t)); 550 GMT_get_destination (ch->t));
551 551
@@ -563,8 +563,8 @@ send_client_create (struct MeshChannel *ch)
563 * @param fwd Is this a fwd (root->dest) message? 563 * @param fwd Is this a fwd (root->dest) message?
564 */ 564 */
565static void 565static void
566send_client_data (struct MeshChannel *ch, 566send_client_data (struct CadetChannel *ch,
567 const struct GNUNET_MESH_Data *msg, 567 const struct GNUNET_CADET_Data *msg,
568 int fwd) 568 int fwd)
569{ 569{
570 if (fwd) 570 if (fwd)
@@ -593,12 +593,12 @@ send_client_data (struct MeshChannel *ch,
593 * @param fwd Is this to send FWD data?. 593 * @param fwd Is this to send FWD data?.
594 */ 594 */
595static void 595static void
596send_client_buffered_data (struct MeshChannel *ch, 596send_client_buffered_data (struct CadetChannel *ch,
597 struct MeshClient *c, 597 struct CadetClient *c,
598 int fwd) 598 int fwd)
599{ 599{
600 struct MeshReliableMessage *copy; 600 struct CadetReliableMessage *copy;
601 struct MeshChannelReliability *rel; 601 struct CadetChannelReliability *rel;
602 602
603 LOG (GNUNET_ERROR_TYPE_DEBUG, "send_buffered_data\n"); 603 LOG (GNUNET_ERROR_TYPE_DEBUG, "send_buffered_data\n");
604 rel = fwd ? ch->dest_rel : ch->root_rel; 604 rel = fwd ? ch->dest_rel : ch->root_rel;
@@ -614,7 +614,7 @@ send_client_buffered_data (struct MeshChannel *ch,
614 { 614 {
615 if (copy->mid == rel->mid_recv || GNUNET_NO == ch->reliable) 615 if (copy->mid == rel->mid_recv || GNUNET_NO == ch->reliable)
616 { 616 {
617 struct GNUNET_MESH_Data *msg = (struct GNUNET_MESH_Data *) &copy[1]; 617 struct GNUNET_CADET_Data *msg = (struct GNUNET_CADET_Data *) &copy[1];
618 618
619 LOG (GNUNET_ERROR_TYPE_DEBUG, 619 LOG (GNUNET_ERROR_TYPE_DEBUG,
620 " have %u! now expecting %u\n", 620 " have %u! now expecting %u\n",
@@ -657,10 +657,10 @@ send_client_buffered_data (struct MeshChannel *ch,
657 * @param fwd Is this a FWD ACK? (FWD ACKs are sent to root) 657 * @param fwd Is this a FWD ACK? (FWD ACKs are sent to root)
658 */ 658 */
659static void 659static void
660send_client_ack (struct MeshChannel *ch, int fwd) 660send_client_ack (struct CadetChannel *ch, int fwd)
661{ 661{
662 struct MeshChannelReliability *rel = fwd ? ch->root_rel : ch->dest_rel; 662 struct CadetChannelReliability *rel = fwd ? ch->root_rel : ch->dest_rel;
663 struct MeshClient *c = fwd ? ch->root : ch->dest; 663 struct CadetClient *c = fwd ? ch->root : ch->dest;
664 664
665 if (NULL == c) 665 if (NULL == c)
666 { 666 {
@@ -694,7 +694,7 @@ send_client_ack (struct MeshChannel *ch, int fwd)
694 * @param ch Rejected channel. 694 * @param ch Rejected channel.
695 */ 695 */
696static void 696static void
697send_client_nack (struct MeshChannel *ch) 697send_client_nack (struct CadetChannel *ch)
698{ 698{
699 if (NULL == ch->root) 699 if (NULL == ch->root)
700 { 700 {
@@ -708,17 +708,17 @@ send_client_nack (struct MeshChannel *ch)
708/** 708/**
709 * We haven't received an ACK after a certain time: restransmit the message. 709 * We haven't received an ACK after a certain time: restransmit the message.
710 * 710 *
711 * @param cls Closure (MeshChannelReliability with the message to restransmit) 711 * @param cls Closure (CadetChannelReliability with the message to restransmit)
712 * @param tc TaskContext. 712 * @param tc TaskContext.
713 */ 713 */
714static void 714static void
715channel_retransmit_message (void *cls, 715channel_retransmit_message (void *cls,
716 const struct GNUNET_SCHEDULER_TaskContext *tc) 716 const struct GNUNET_SCHEDULER_TaskContext *tc)
717{ 717{
718 struct MeshChannelReliability *rel = cls; 718 struct CadetChannelReliability *rel = cls;
719 struct MeshReliableMessage *copy; 719 struct CadetReliableMessage *copy;
720 struct MeshChannel *ch; 720 struct CadetChannel *ch;
721 struct GNUNET_MESH_Data *payload; 721 struct GNUNET_CADET_Data *payload;
722 int fwd; 722 int fwd;
723 723
724 rel->retry_task = GNUNET_SCHEDULER_NO_TASK; 724 rel->retry_task = GNUNET_SCHEDULER_NO_TASK;
@@ -733,7 +733,7 @@ channel_retransmit_message (void *cls,
733 return; 733 return;
734 } 734 }
735 735
736 payload = (struct GNUNET_MESH_Data *) &copy[1]; 736 payload = (struct GNUNET_CADET_Data *) &copy[1];
737 fwd = (rel == ch->root_rel); 737 fwd = (rel == ch->root_rel);
738 738
739 /* Message not found in the queue that we are going to use. */ 739 /* Message not found in the queue that we are going to use. */
@@ -747,13 +747,13 @@ channel_retransmit_message (void *cls,
747/** 747/**
748 * We haven't received an Channel ACK after a certain time: resend the CREATE. 748 * We haven't received an Channel ACK after a certain time: resend the CREATE.
749 * 749 *
750 * @param cls Closure (MeshChannelReliability of the channel to recreate) 750 * @param cls Closure (CadetChannelReliability of the channel to recreate)
751 * @param tc TaskContext. 751 * @param tc TaskContext.
752 */ 752 */
753static void 753static void
754channel_recreate (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 754channel_recreate (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
755{ 755{
756 struct MeshChannelReliability *rel = cls; 756 struct CadetChannelReliability *rel = cls;
757 757
758 rel->retry_task = GNUNET_SCHEDULER_NO_TASK; 758 rel->retry_task = GNUNET_SCHEDULER_NO_TASK;
759 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 759 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
@@ -789,20 +789,20 @@ channel_recreate (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
789 */ 789 */
790static void 790static void
791ch_message_sent (void *cls, 791ch_message_sent (void *cls,
792 struct MeshTunnel3 *t, 792 struct CadetTunnel3 *t,
793 struct MeshTunnel3Queue *q, 793 struct CadetTunnel3Queue *q,
794 uint16_t type, size_t size) 794 uint16_t type, size_t size)
795{ 795{
796 struct MeshChannelQueue *chq = cls; 796 struct CadetChannelQueue *chq = cls;
797 struct MeshReliableMessage *copy = chq->copy; 797 struct CadetReliableMessage *copy = chq->copy;
798 struct MeshChannelReliability *rel; 798 struct CadetChannelReliability *rel;
799 799
800 LOG (GNUNET_ERROR_TYPE_DEBUG, "channel message sent callback %s\n", 800 LOG (GNUNET_ERROR_TYPE_DEBUG, "channel message sent callback %s\n",
801 GM_m2s (chq->type)); 801 GM_m2s (chq->type));
802 802
803 switch (chq->type) 803 switch (chq->type)
804 { 804 {
805 case GNUNET_MESSAGE_TYPE_MESH_DATA: 805 case GNUNET_MESSAGE_TYPE_CADET_DATA:
806 LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SENT DATA MID %u\n", copy->mid); 806 LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SENT DATA MID %u\n", copy->mid);
807 GNUNET_assert (chq == copy->chq); 807 GNUNET_assert (chq == copy->chq);
808 copy->timestamp = GNUNET_TIME_absolute_get (); 808 copy->timestamp = GNUNET_TIME_absolute_get ();
@@ -817,12 +817,12 @@ ch_message_sent (void *cls,
817 LOG (GNUNET_ERROR_TYPE_DEBUG, "!! delay != 0\n"); 817 LOG (GNUNET_ERROR_TYPE_DEBUG, "!! delay != 0\n");
818 rel->retry_timer = 818 rel->retry_timer =
819 GNUNET_TIME_relative_multiply (rel->expected_delay, 819 GNUNET_TIME_relative_multiply (rel->expected_delay,
820 MESH_RETRANSMIT_MARGIN); 820 CADET_RETRANSMIT_MARGIN);
821 } 821 }
822 else 822 else
823 { 823 {
824 LOG (GNUNET_ERROR_TYPE_DEBUG, "!! delay reset\n"); 824 LOG (GNUNET_ERROR_TYPE_DEBUG, "!! delay reset\n");
825 rel->retry_timer = MESH_RETRANSMIT_TIME; 825 rel->retry_timer = CADET_RETRANSMIT_TIME;
826 } 826 }
827 LOG (GNUNET_ERROR_TYPE_DEBUG, "!! using delay %s\n", 827 LOG (GNUNET_ERROR_TYPE_DEBUG, "!! using delay %s\n",
828 GNUNET_STRINGS_relative_time_to_string (rel->retry_timer, 828 GNUNET_STRINGS_relative_time_to_string (rel->retry_timer,
@@ -839,16 +839,16 @@ ch_message_sent (void *cls,
839 break; 839 break;
840 840
841 841
842 case GNUNET_MESSAGE_TYPE_MESH_DATA_ACK: 842 case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK:
843 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE: 843 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE:
844 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK: 844 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK:
845 LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SENT %s\n", GM_m2s (chq->type)); 845 LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SENT %s\n", GM_m2s (chq->type));
846 rel = chq->rel; 846 rel = chq->rel;
847 GNUNET_assert (rel->uniq == chq); 847 GNUNET_assert (rel->uniq == chq);
848 rel->uniq = NULL; 848 rel->uniq = NULL;
849 849
850 if (MESH_CHANNEL_READY != rel->ch->state 850 if (CADET_CHANNEL_READY != rel->ch->state
851 && GNUNET_MESSAGE_TYPE_MESH_DATA_ACK != type 851 && GNUNET_MESSAGE_TYPE_CADET_DATA_ACK != type
852 && GNUNET_NO == rel->ch->destroy) 852 && GNUNET_NO == rel->ch->destroy)
853 { 853 {
854 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == rel->retry_task); 854 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == rel->retry_task);
@@ -875,12 +875,12 @@ ch_message_sent (void *cls,
875 * @param ch Channel for which to send. 875 * @param ch Channel for which to send.
876 */ 876 */
877static void 877static void
878send_create (struct MeshChannel *ch) 878send_create (struct CadetChannel *ch)
879{ 879{
880 struct GNUNET_MESH_ChannelCreate msgcc; 880 struct GNUNET_CADET_ChannelCreate msgcc;
881 881
882 msgcc.header.size = htons (sizeof (msgcc)); 882 msgcc.header.size = htons (sizeof (msgcc));
883 msgcc.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE); 883 msgcc.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE);
884 msgcc.chid = htonl (ch->gid); 884 msgcc.chid = htonl (ch->gid);
885 msgcc.port = htonl (ch->port); 885 msgcc.port = htonl (ch->port);
886 msgcc.opt = htonl (channel_get_options (ch)); 886 msgcc.opt = htonl (channel_get_options (ch));
@@ -897,12 +897,12 @@ send_create (struct MeshChannel *ch)
897 * @param reaction This ACK is a reaction to a duplicate CREATE, don't save. 897 * @param reaction This ACK is a reaction to a duplicate CREATE, don't save.
898 */ 898 */
899static void 899static void
900send_ack (struct MeshChannel *ch, int fwd, int reaction) 900send_ack (struct CadetChannel *ch, int fwd, int reaction)
901{ 901{
902 struct GNUNET_MESH_ChannelManage msg; 902 struct GNUNET_CADET_ChannelManage msg;
903 903
904 msg.header.size = htons (sizeof (msg)); 904 msg.header.size = htons (sizeof (msg));
905 msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK); 905 msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK);
906 LOG (GNUNET_ERROR_TYPE_DEBUG, " sending channel %s ack for channel %s\n", 906 LOG (GNUNET_ERROR_TYPE_DEBUG, " sending channel %s ack for channel %s\n",
907 GM_f2s (fwd), GMCH_2s (ch)); 907 GM_f2s (fwd), GMCH_2s (ch));
908 908
@@ -921,7 +921,7 @@ send_ack (struct MeshChannel *ch, int fwd, int reaction)
921 */ 921 */
922static void 922static void
923fire_and_forget (const struct GNUNET_MessageHeader *msg, 923fire_and_forget (const struct GNUNET_MessageHeader *msg,
924 struct MeshChannel *ch, 924 struct CadetChannel *ch,
925 int force) 925 int force)
926{ 926{
927 GNUNET_break (NULL == GMT_send_prebuilt_message (msg, ch->t, NULL, 927 GNUNET_break (NULL == GMT_send_prebuilt_message (msg, ch->t, NULL,
@@ -935,12 +935,12 @@ fire_and_forget (const struct GNUNET_MessageHeader *msg,
935 * @param ch The channel to reject. 935 * @param ch The channel to reject.
936 */ 936 */
937static void 937static void
938send_nack (struct MeshChannel *ch) 938send_nack (struct CadetChannel *ch)
939{ 939{
940 struct GNUNET_MESH_ChannelManage msg; 940 struct GNUNET_CADET_ChannelManage msg;
941 941
942 msg.header.size = htons (sizeof (msg)); 942 msg.header.size = htons (sizeof (msg));
943 msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_NACK); 943 msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK);
944 LOG (GNUNET_ERROR_TYPE_DEBUG, 944 LOG (GNUNET_ERROR_TYPE_DEBUG,
945 " sending channel NACK for channel %s\n", 945 " sending channel NACK for channel %s\n",
946 GMCH_2s (ch)); 946 GMCH_2s (ch));
@@ -958,10 +958,10 @@ send_nack (struct MeshChannel *ch)
958 * @param rel Reliability data for a channel. 958 * @param rel Reliability data for a channel.
959 */ 959 */
960static void 960static void
961channel_rel_free_all (struct MeshChannelReliability *rel) 961channel_rel_free_all (struct CadetChannelReliability *rel)
962{ 962{
963 struct MeshReliableMessage *copy; 963 struct CadetReliableMessage *copy;
964 struct MeshReliableMessage *next; 964 struct CadetReliableMessage *next;
965 965
966 if (NULL == rel) 966 if (NULL == rel)
967 return; 967 return;
@@ -1015,11 +1015,11 @@ channel_rel_free_all (struct MeshChannelReliability *rel)
1015 * @param msg DataACK message with a bitfield of future ACK'd messages. 1015 * @param msg DataACK message with a bitfield of future ACK'd messages.
1016 */ 1016 */
1017static void 1017static void
1018channel_rel_free_sent (struct MeshChannelReliability *rel, 1018channel_rel_free_sent (struct CadetChannelReliability *rel,
1019 const struct GNUNET_MESH_DataACK *msg) 1019 const struct GNUNET_CADET_DataACK *msg)
1020{ 1020{
1021 struct MeshReliableMessage *copy; 1021 struct CadetReliableMessage *copy;
1022 struct MeshReliableMessage *next; 1022 struct CadetReliableMessage *next;
1023 uint64_t bitfield; 1023 uint64_t bitfield;
1024 uint64_t mask; 1024 uint64_t mask;
1025 uint32_t mid; 1025 uint32_t mid;
@@ -1094,9 +1094,9 @@ channel_rel_free_sent (struct MeshChannelReliability *rel,
1094 * #GNUNET_NO otherwise. 1094 * #GNUNET_NO otherwise.
1095 */ 1095 */
1096static int 1096static int
1097rel_message_free (struct MeshReliableMessage *copy, int update_time) 1097rel_message_free (struct CadetReliableMessage *copy, int update_time)
1098{ 1098{
1099 struct MeshChannelReliability *rel; 1099 struct CadetChannelReliability *rel;
1100 struct GNUNET_TIME_Relative time; 1100 struct GNUNET_TIME_Relative time;
1101 1101
1102 rel = copy->rel; 1102 rel = copy->rel;
@@ -1148,10 +1148,10 @@ rel_message_free (struct MeshReliableMessage *copy, int update_time)
1148 * @param fwd Was the ACK message a FWD ACK? (dest->root, SYNACK) 1148 * @param fwd Was the ACK message a FWD ACK? (dest->root, SYNACK)
1149 */ 1149 */
1150static void 1150static void
1151channel_confirm (struct MeshChannel *ch, int fwd) 1151channel_confirm (struct CadetChannel *ch, int fwd)
1152{ 1152{
1153 struct MeshChannelReliability *rel; 1153 struct CadetChannelReliability *rel;
1154 enum MeshChannelState oldstate; 1154 enum CadetChannelState oldstate;
1155 1155
1156 rel = fwd ? ch->root_rel : ch->dest_rel; 1156 rel = fwd ? ch->root_rel : ch->dest_rel;
1157 if (NULL == rel) 1157 if (NULL == rel)
@@ -1162,9 +1162,9 @@ channel_confirm (struct MeshChannel *ch, int fwd)
1162 LOG (GNUNET_ERROR_TYPE_DEBUG, " channel confirm %s %s\n", 1162 LOG (GNUNET_ERROR_TYPE_DEBUG, " channel confirm %s %s\n",
1163 GM_f2s (fwd), GMCH_2s (ch)); 1163 GM_f2s (fwd), GMCH_2s (ch));
1164 oldstate = ch->state; 1164 oldstate = ch->state;
1165 ch->state = MESH_CHANNEL_READY; 1165 ch->state = CADET_CHANNEL_READY;
1166 1166
1167 if (MESH_CHANNEL_READY != oldstate || GNUNET_YES == is_loopback (ch)) 1167 if (CADET_CHANNEL_READY != oldstate || GNUNET_YES == is_loopback (ch))
1168 { 1168 {
1169 rel->client_ready = GNUNET_YES; 1169 rel->client_ready = GNUNET_YES;
1170 rel->expected_delay = rel->retry_timer; 1170 rel->expected_delay = rel->retry_timer;
@@ -1208,13 +1208,13 @@ channel_confirm (struct MeshChannel *ch, int fwd)
1208 * @param msg Message to copy. 1208 * @param msg Message to copy.
1209 * @param fwd Is this fwd traffic? 1209 * @param fwd Is this fwd traffic?
1210 */ 1210 */
1211static struct MeshReliableMessage * 1211static struct CadetReliableMessage *
1212channel_save_copy (struct MeshChannel *ch, 1212channel_save_copy (struct CadetChannel *ch,
1213 const struct GNUNET_MessageHeader *msg, 1213 const struct GNUNET_MessageHeader *msg,
1214 int fwd) 1214 int fwd)
1215{ 1215{
1216 struct MeshChannelReliability *rel; 1216 struct CadetChannelReliability *rel;
1217 struct MeshReliableMessage *copy; 1217 struct CadetReliableMessage *copy;
1218 uint32_t mid; 1218 uint32_t mid;
1219 uint16_t type; 1219 uint16_t type;
1220 uint16_t size; 1220 uint16_t size;
@@ -1225,7 +1225,7 @@ channel_save_copy (struct MeshChannel *ch,
1225 size = ntohs (msg->size); 1225 size = ntohs (msg->size);
1226 1226
1227 LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SAVE %u %s\n", mid, GM_m2s (type)); 1227 LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SAVE %u %s\n", mid, GM_m2s (type));
1228 copy = GNUNET_malloc (sizeof (struct MeshReliableMessage) + size); 1228 copy = GNUNET_malloc (sizeof (struct CadetReliableMessage) + size);
1229 LOG (GNUNET_ERROR_TYPE_DEBUG, " at %p\n", copy); 1229 LOG (GNUNET_ERROR_TYPE_DEBUG, " at %p\n", copy);
1230 copy->mid = mid; 1230 copy->mid = mid;
1231 copy->rel = rel; 1231 copy->rel = rel;
@@ -1247,14 +1247,14 @@ channel_save_copy (struct MeshChannel *ch,
1247 * 1247 *
1248 * @return A new initialized channel. NULL on error. 1248 * @return A new initialized channel. NULL on error.
1249 */ 1249 */
1250static struct MeshChannel * 1250static struct CadetChannel *
1251channel_new (struct MeshTunnel3 *t, 1251channel_new (struct CadetTunnel3 *t,
1252 struct MeshClient *owner, 1252 struct CadetClient *owner,
1253 MESH_ChannelNumber lid_root) 1253 CADET_ChannelNumber lid_root)
1254{ 1254{
1255 struct MeshChannel *ch; 1255 struct CadetChannel *ch;
1256 1256
1257 ch = GNUNET_new (struct MeshChannel); 1257 ch = GNUNET_new (struct CadetChannel);
1258 ch->root = owner; 1258 ch->root = owner;
1259 ch->lid_root = lid_root; 1259 ch->lid_root = lid_root;
1260 ch->t = t; 1260 ch->t = t;
@@ -1280,7 +1280,7 @@ channel_new (struct MeshTunnel3 *t,
1280 * @param fwd Is this FWD traffic? 1280 * @param fwd Is this FWD traffic?
1281 */ 1281 */
1282void 1282void
1283handle_loopback (struct MeshChannel *ch, 1283handle_loopback (struct CadetChannel *ch,
1284 const struct GNUNET_MessageHeader *msgh, 1284 const struct GNUNET_MessageHeader *msgh,
1285 int fwd) 1285 int fwd)
1286{ 1286{
@@ -1293,35 +1293,35 @@ handle_loopback (struct MeshChannel *ch,
1293 1293
1294 switch (type) 1294 switch (type)
1295 { 1295 {
1296 case GNUNET_MESSAGE_TYPE_MESH_DATA: 1296 case GNUNET_MESSAGE_TYPE_CADET_DATA:
1297 /* Don't send hop ACK, wait for client to ACK */ 1297 /* Don't send hop ACK, wait for client to ACK */
1298 LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SEND loopback %u (%u)\n", 1298 LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SEND loopback %u (%u)\n",
1299 ntohl (((struct GNUNET_MESH_Data *) msgh)->mid), ntohs (msgh->size)); 1299 ntohl (((struct GNUNET_CADET_Data *) msgh)->mid), ntohs (msgh->size));
1300 GMCH_handle_data (ch, (struct GNUNET_MESH_Data *) msgh, fwd); 1300 GMCH_handle_data (ch, (struct GNUNET_CADET_Data *) msgh, fwd);
1301 break; 1301 break;
1302 1302
1303 case GNUNET_MESSAGE_TYPE_MESH_DATA_ACK: 1303 case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK:
1304 GMCH_handle_data_ack (ch, (struct GNUNET_MESH_DataACK *) msgh, fwd); 1304 GMCH_handle_data_ack (ch, (struct GNUNET_CADET_DataACK *) msgh, fwd);
1305 break; 1305 break;
1306 1306
1307 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE: 1307 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE:
1308 GMCH_handle_create (ch->t, 1308 GMCH_handle_create (ch->t,
1309 (struct GNUNET_MESH_ChannelCreate *) msgh); 1309 (struct GNUNET_CADET_ChannelCreate *) msgh);
1310 break; 1310 break;
1311 1311
1312 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK: 1312 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK:
1313 GMCH_handle_ack (ch, 1313 GMCH_handle_ack (ch,
1314 (struct GNUNET_MESH_ChannelManage *) msgh, 1314 (struct GNUNET_CADET_ChannelManage *) msgh,
1315 fwd); 1315 fwd);
1316 break; 1316 break;
1317 1317
1318 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_NACK: 1318 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK:
1319 GMCH_handle_nack (ch); 1319 GMCH_handle_nack (ch);
1320 break; 1320 break;
1321 1321
1322 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY: 1322 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY:
1323 GMCH_handle_destroy (ch, 1323 GMCH_handle_destroy (ch,
1324 (struct GNUNET_MESH_ChannelManage *) msgh, 1324 (struct GNUNET_CADET_ChannelManage *) msgh,
1325 fwd); 1325 fwd);
1326 break; 1326 break;
1327 1327
@@ -1345,10 +1345,10 @@ handle_loopback (struct MeshChannel *ch,
1345 * @param ch Channel to destroy. 1345 * @param ch Channel to destroy.
1346 */ 1346 */
1347void 1347void
1348GMCH_destroy (struct MeshChannel *ch) 1348GMCH_destroy (struct CadetChannel *ch)
1349{ 1349{
1350 struct MeshClient *c; 1350 struct CadetClient *c;
1351 struct MeshTunnel3 *t; 1351 struct CadetTunnel3 *t;
1352 1352
1353 if (NULL == ch) 1353 if (NULL == ch)
1354 return; 1354 return;
@@ -1391,8 +1391,8 @@ GMCH_destroy (struct MeshChannel *ch)
1391 * 1391 *
1392 * @return ID used to identify the channel with the remote peer. 1392 * @return ID used to identify the channel with the remote peer.
1393 */ 1393 */
1394MESH_ChannelNumber 1394CADET_ChannelNumber
1395GMCH_get_id (const struct MeshChannel *ch) 1395GMCH_get_id (const struct CadetChannel *ch)
1396{ 1396{
1397 return ch->gid; 1397 return ch->gid;
1398} 1398}
@@ -1405,8 +1405,8 @@ GMCH_get_id (const struct MeshChannel *ch)
1405 * 1405 *
1406 * @return tunnel of the channel. 1406 * @return tunnel of the channel.
1407 */ 1407 */
1408struct MeshTunnel3 * 1408struct CadetTunnel3 *
1409GMCH_get_tunnel (const struct MeshChannel *ch) 1409GMCH_get_tunnel (const struct CadetChannel *ch)
1410{ 1410{
1411 return ch->t; 1411 return ch->t;
1412} 1412}
@@ -1421,9 +1421,9 @@ GMCH_get_tunnel (const struct MeshChannel *ch)
1421 * @return Free buffer space [0 - 64] 1421 * @return Free buffer space [0 - 64]
1422 */ 1422 */
1423unsigned int 1423unsigned int
1424GMCH_get_buffer (struct MeshChannel *ch, int fwd) 1424GMCH_get_buffer (struct CadetChannel *ch, int fwd)
1425{ 1425{
1426 struct MeshChannelReliability *rel; 1426 struct CadetChannelReliability *rel;
1427 1427
1428 rel = fwd ? ch->dest_rel : ch->root_rel; 1428 rel = fwd ? ch->dest_rel : ch->root_rel;
1429 1429
@@ -1447,9 +1447,9 @@ GMCH_get_buffer (struct MeshChannel *ch, int fwd)
1447 * @return #GNUNET_YES if client is allowed to send us data. 1447 * @return #GNUNET_YES if client is allowed to send us data.
1448 */ 1448 */
1449int 1449int
1450GMCH_get_allowed (struct MeshChannel *ch, int fwd) 1450GMCH_get_allowed (struct CadetChannel *ch, int fwd)
1451{ 1451{
1452 struct MeshChannelReliability *rel; 1452 struct CadetChannelReliability *rel;
1453 1453
1454 rel = fwd ? ch->root_rel : ch->dest_rel; 1454 rel = fwd ? ch->root_rel : ch->dest_rel;
1455 1455
@@ -1473,9 +1473,9 @@ GMCH_get_allowed (struct MeshChannel *ch, int fwd)
1473 * @return #GNUNET_YES in case it is. 1473 * @return #GNUNET_YES in case it is.
1474 */ 1474 */
1475int 1475int
1476GMCH_is_origin (struct MeshChannel *ch, int fwd) 1476GMCH_is_origin (struct CadetChannel *ch, int fwd)
1477{ 1477{
1478 struct MeshClient *c; 1478 struct CadetClient *c;
1479 1479
1480 c = fwd ? ch->root : ch->dest; 1480 c = fwd ? ch->root : ch->dest;
1481 return NULL != c; 1481 return NULL != c;
@@ -1491,9 +1491,9 @@ GMCH_is_origin (struct MeshChannel *ch, int fwd)
1491 * @return #GNUNET_YES in case it is. 1491 * @return #GNUNET_YES in case it is.
1492 */ 1492 */
1493int 1493int
1494GMCH_is_terminal (struct MeshChannel *ch, int fwd) 1494GMCH_is_terminal (struct CadetChannel *ch, int fwd)
1495{ 1495{
1496 struct MeshClient *c; 1496 struct CadetClient *c;
1497 1497
1498 c = fwd ? ch->dest : ch->root; 1498 c = fwd ? ch->dest : ch->root;
1499 return NULL != c; 1499 return NULL != c;
@@ -1509,11 +1509,11 @@ GMCH_is_terminal (struct MeshChannel *ch, int fwd)
1509 * @param fwd Is for FWD traffic? (ACK dest->owner) 1509 * @param fwd Is for FWD traffic? (ACK dest->owner)
1510 */ 1510 */
1511void 1511void
1512GMCH_send_data_ack (struct MeshChannel *ch, int fwd) 1512GMCH_send_data_ack (struct CadetChannel *ch, int fwd)
1513{ 1513{
1514 struct GNUNET_MESH_DataACK msg; 1514 struct GNUNET_CADET_DataACK msg;
1515 struct MeshChannelReliability *rel; 1515 struct CadetChannelReliability *rel;
1516 struct MeshReliableMessage *copy; 1516 struct CadetReliableMessage *copy;
1517 unsigned int delta; 1517 unsigned int delta;
1518 uint64_t mask; 1518 uint64_t mask;
1519 uint32_t ack; 1519 uint32_t ack;
@@ -1526,13 +1526,13 @@ GMCH_send_data_ack (struct MeshChannel *ch, int fwd)
1526 ack = rel->mid_recv - 1; 1526 ack = rel->mid_recv - 1;
1527 LOG (GNUNET_ERROR_TYPE_INFO, "===> DATA_ACK for %u\n", ack); 1527 LOG (GNUNET_ERROR_TYPE_INFO, "===> DATA_ACK for %u\n", ack);
1528 1528
1529 msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_DATA_ACK); 1529 msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_DATA_ACK);
1530 msg.header.size = htons (sizeof (msg)); 1530 msg.header.size = htons (sizeof (msg));
1531 msg.chid = htonl (ch->gid); 1531 msg.chid = htonl (ch->gid);
1532 msg.futures = 0; 1532 msg.futures = 0;
1533 for (copy = rel->head_recv; NULL != copy; copy = copy->next) 1533 for (copy = rel->head_recv; NULL != copy; copy = copy->next)
1534 { 1534 {
1535 if (copy->type != GNUNET_MESSAGE_TYPE_MESH_DATA) 1535 if (copy->type != GNUNET_MESSAGE_TYPE_CADET_DATA)
1536 { 1536 {
1537 LOG (GNUNET_ERROR_TYPE_DEBUG, 1537 LOG (GNUNET_ERROR_TYPE_DEBUG,
1538 "!! Type %s, expected DATA\n", 1538 "!! Type %s, expected DATA\n",
@@ -1570,14 +1570,14 @@ GMCH_send_data_ack (struct MeshChannel *ch, int fwd)
1570 * @param fwd Is this about FWD traffic? (Root client). 1570 * @param fwd Is this about FWD traffic? (Root client).
1571 */ 1571 */
1572void 1572void
1573GMCH_allow_client (struct MeshChannel *ch, int fwd) 1573GMCH_allow_client (struct CadetChannel *ch, int fwd)
1574{ 1574{
1575 struct MeshChannelReliability *rel; 1575 struct CadetChannelReliability *rel;
1576 unsigned int buffer; 1576 unsigned int buffer;
1577 1577
1578 LOG (GNUNET_ERROR_TYPE_DEBUG, "GMCH allow\n"); 1578 LOG (GNUNET_ERROR_TYPE_DEBUG, "GMCH allow\n");
1579 1579
1580 if (MESH_CHANNEL_READY != ch->state) 1580 if (CADET_CHANNEL_READY != ch->state)
1581 { 1581 {
1582 LOG (GNUNET_ERROR_TYPE_DEBUG, " channel not ready yet!\n"); 1582 LOG (GNUNET_ERROR_TYPE_DEBUG, " channel not ready yet!\n");
1583 return; 1583 return;
@@ -1630,7 +1630,7 @@ GMCH_allow_client (struct MeshChannel *ch, int fwd)
1630 * @param ch Channel. 1630 * @param ch Channel.
1631 */ 1631 */
1632void 1632void
1633GMCH_debug (struct MeshChannel *ch) 1633GMCH_debug (struct CadetChannel *ch)
1634{ 1634{
1635 if (NULL == ch) 1635 if (NULL == ch)
1636 { 1636 {
@@ -1669,10 +1669,10 @@ GMCH_debug (struct MeshChannel *ch)
1669 * @param fwd Is this a "FWD ACK"? (FWD ACKs are sent by dest and go BCK) 1669 * @param fwd Is this a "FWD ACK"? (FWD ACKs are sent by dest and go BCK)
1670 */ 1670 */
1671void 1671void
1672GMCH_handle_local_ack (struct MeshChannel *ch, int fwd) 1672GMCH_handle_local_ack (struct CadetChannel *ch, int fwd)
1673{ 1673{
1674 struct MeshChannelReliability *rel; 1674 struct CadetChannelReliability *rel;
1675 struct MeshClient *c; 1675 struct CadetClient *c;
1676 1676
1677 rel = fwd ? ch->dest_rel : ch->root_rel; 1677 rel = fwd ? ch->dest_rel : ch->root_rel;
1678 c = fwd ? ch->dest : ch->root; 1678 c = fwd ? ch->dest : ch->root;
@@ -1717,15 +1717,15 @@ GMCH_handle_local_ack (struct MeshChannel *ch, int fwd)
1717 * @return GNUNET_OK if everything goes well, GNUNET_SYSERR in case of en error. 1717 * @return GNUNET_OK if everything goes well, GNUNET_SYSERR in case of en error.
1718 */ 1718 */
1719int 1719int
1720GMCH_handle_local_data (struct MeshChannel *ch, 1720GMCH_handle_local_data (struct CadetChannel *ch,
1721 struct MeshClient *c, 1721 struct CadetClient *c,
1722 struct GNUNET_MessageHeader *message, 1722 struct GNUNET_MessageHeader *message,
1723 int fwd) 1723 int fwd)
1724{ 1724{
1725 struct MeshChannelReliability *rel; 1725 struct CadetChannelReliability *rel;
1726 struct GNUNET_MESH_Data *payload; 1726 struct GNUNET_CADET_Data *payload;
1727 size_t size = ntohs (message->size); 1727 size_t size = ntohs (message->size);
1728 uint16_t p2p_size = sizeof(struct GNUNET_MESH_Data) + size; 1728 uint16_t p2p_size = sizeof(struct GNUNET_CADET_Data) + size;
1729 unsigned char cbuf[p2p_size]; 1729 unsigned char cbuf[p2p_size];
1730 1730
1731 /* Is the client in the channel? */ 1731 /* Is the client in the channel? */
@@ -1750,12 +1750,12 @@ GMCH_handle_local_data (struct MeshChannel *ch,
1750 rel->client_allowed = GNUNET_NO; 1750 rel->client_allowed = GNUNET_NO;
1751 1751
1752 /* Ok, everything is correct, send the message. */ 1752 /* Ok, everything is correct, send the message. */
1753 payload = (struct GNUNET_MESH_Data *) cbuf; 1753 payload = (struct GNUNET_CADET_Data *) cbuf;
1754 payload->mid = htonl (rel->mid_send); 1754 payload->mid = htonl (rel->mid_send);
1755 rel->mid_send++; 1755 rel->mid_send++;
1756 memcpy (&payload[1], message, size); 1756 memcpy (&payload[1], message, size);
1757 payload->header.size = htons (p2p_size); 1757 payload->header.size = htons (p2p_size);
1758 payload->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_DATA); 1758 payload->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_DATA);
1759 payload->chid = htonl (ch->gid); 1759 payload->chid = htonl (ch->gid);
1760 LOG (GNUNET_ERROR_TYPE_DEBUG, " sending on channel...\n"); 1760 LOG (GNUNET_ERROR_TYPE_DEBUG, " sending on channel...\n");
1761 GMCH_send_prebuilt_message (&payload->header, ch, fwd, NULL); 1761 GMCH_send_prebuilt_message (&payload->header, ch, fwd, NULL);
@@ -1787,8 +1787,8 @@ GMCH_handle_local_data (struct MeshChannel *ch,
1787 * @param is_root Is the request coming from root? 1787 * @param is_root Is the request coming from root?
1788 */ 1788 */
1789void 1789void
1790GMCH_handle_local_destroy (struct MeshChannel *ch, 1790GMCH_handle_local_destroy (struct CadetChannel *ch,
1791 struct MeshClient *c, 1791 struct CadetClient *c,
1792 int is_root) 1792 int is_root)
1793{ 1793{
1794 ch->destroy = GNUNET_YES; 1794 ch->destroy = GNUNET_YES;
@@ -1823,13 +1823,13 @@ GMCH_handle_local_destroy (struct MeshChannel *ch,
1823 * @return GNUNET_OK if everything went fine, GNUNET_SYSERR otherwise. 1823 * @return GNUNET_OK if everything went fine, GNUNET_SYSERR otherwise.
1824 */ 1824 */
1825int 1825int
1826GMCH_handle_local_create (struct MeshClient *c, 1826GMCH_handle_local_create (struct CadetClient *c,
1827 struct GNUNET_MESH_ChannelMessage *msg) 1827 struct GNUNET_CADET_ChannelMessage *msg)
1828{ 1828{
1829 struct MeshChannel *ch; 1829 struct CadetChannel *ch;
1830 struct MeshTunnel3 *t; 1830 struct CadetTunnel3 *t;
1831 struct MeshPeer *peer; 1831 struct CadetPeer *peer;
1832 MESH_ChannelNumber chid; 1832 CADET_ChannelNumber chid;
1833 1833
1834 LOG (GNUNET_ERROR_TYPE_DEBUG, " towards %s:%u\n", 1834 LOG (GNUNET_ERROR_TYPE_DEBUG, " towards %s:%u\n",
1835 GNUNET_i2s (&msg->peer), ntohl (msg->port)); 1835 GNUNET_i2s (&msg->peer), ntohl (msg->port));
@@ -1848,7 +1848,7 @@ GMCH_handle_local_create (struct MeshClient *c,
1848 1848
1849 if (GMP_get_short_id (peer) == myid) 1849 if (GMP_get_short_id (peer) == myid)
1850 { 1850 {
1851 GMT_change_cstate (t, MESH_TUNNEL3_READY); 1851 GMT_change_cstate (t, CADET_TUNNEL3_READY);
1852 } 1852 }
1853 else 1853 else
1854 { 1854 {
@@ -1867,9 +1867,9 @@ GMCH_handle_local_create (struct MeshClient *c,
1867 channel_set_options (ch, ntohl (msg->opt)); 1867 channel_set_options (ch, ntohl (msg->opt));
1868 1868
1869 /* In unreliable channels, we'll use the DLL to buffer BCK data */ 1869 /* In unreliable channels, we'll use the DLL to buffer BCK data */
1870 ch->root_rel = GNUNET_new (struct MeshChannelReliability); 1870 ch->root_rel = GNUNET_new (struct CadetChannelReliability);
1871 ch->root_rel->ch = ch; 1871 ch->root_rel->ch = ch;
1872 ch->root_rel->retry_timer = MESH_RETRANSMIT_TIME; 1872 ch->root_rel->retry_timer = CADET_RETRANSMIT_TIME;
1873 ch->root_rel->expected_delay.rel_value_us = 0; 1873 ch->root_rel->expected_delay.rel_value_us = 0;
1874 1874
1875 LOG (GNUNET_ERROR_TYPE_DEBUG, "CREATED CHANNEL %s\n", GMCH_2s (ch)); 1875 LOG (GNUNET_ERROR_TYPE_DEBUG, "CREATED CHANNEL %s\n", GMCH_2s (ch));
@@ -1881,7 +1881,7 @@ GMCH_handle_local_create (struct MeshClient *c,
1881 1881
1882 1882
1883/** 1883/**
1884 * Handler for mesh network payload traffic. 1884 * Handler for cadet network payload traffic.
1885 * 1885 *
1886 * @param ch Channel for the message. 1886 * @param ch Channel for the message.
1887 * @param msg Unencryted data message. 1887 * @param msg Unencryted data message.
@@ -1891,12 +1891,12 @@ GMCH_handle_local_create (struct MeshClient *c,
1891 * #GNUNET_SYSERR if message on a one-ended channel (remote) 1891 * #GNUNET_SYSERR if message on a one-ended channel (remote)
1892 */ 1892 */
1893void 1893void
1894GMCH_handle_data (struct MeshChannel *ch, 1894GMCH_handle_data (struct CadetChannel *ch,
1895 const struct GNUNET_MESH_Data *msg, 1895 const struct GNUNET_CADET_Data *msg,
1896 int fwd) 1896 int fwd)
1897{ 1897{
1898 struct MeshChannelReliability *rel; 1898 struct CadetChannelReliability *rel;
1899 struct MeshClient *c; 1899 struct CadetClient *c;
1900 uint32_t mid; 1900 uint32_t mid;
1901 1901
1902 /* If this is a remote (non-loopback) channel, find 'fwd'. */ 1902 /* If this is a remote (non-loopback) channel, find 'fwd'. */
@@ -1921,7 +1921,7 @@ GMCH_handle_data (struct MeshChannel *ch,
1921 return; 1921 return;
1922 } 1922 }
1923 1923
1924 if (MESH_CHANNEL_READY != ch->state) 1924 if (CADET_CHANNEL_READY != ch->state)
1925 { 1925 {
1926 if (GNUNET_NO == fwd) 1926 if (GNUNET_NO == fwd)
1927 { 1927 {
@@ -1986,7 +1986,7 @@ GMCH_handle_data (struct MeshChannel *ch,
1986 1986
1987 1987
1988/** 1988/**
1989 * Handler for mesh network traffic end-to-end ACKs. 1989 * Handler for cadet network traffic end-to-end ACKs.
1990 * 1990 *
1991 * @param ch Channel on which we got this message. 1991 * @param ch Channel on which we got this message.
1992 * @param msg Data message. 1992 * @param msg Data message.
@@ -1996,13 +1996,13 @@ GMCH_handle_data (struct MeshChannel *ch,
1996 * #GNUNET_SYSERR if message on a one-ended channel (remote) 1996 * #GNUNET_SYSERR if message on a one-ended channel (remote)
1997 */ 1997 */
1998void 1998void
1999GMCH_handle_data_ack (struct MeshChannel *ch, 1999GMCH_handle_data_ack (struct CadetChannel *ch,
2000 const struct GNUNET_MESH_DataACK *msg, 2000 const struct GNUNET_CADET_DataACK *msg,
2001 int fwd) 2001 int fwd)
2002{ 2002{
2003 struct MeshChannelReliability *rel; 2003 struct CadetChannelReliability *rel;
2004 struct MeshReliableMessage *copy; 2004 struct CadetReliableMessage *copy;
2005 struct MeshReliableMessage *next; 2005 struct CadetReliableMessage *next;
2006 uint32_t ack; 2006 uint32_t ack;
2007 int work; 2007 int work;
2008 2008
@@ -2068,7 +2068,7 @@ GMCH_handle_data_ack (struct MeshChannel *ch,
2068 struct GNUNET_TIME_Relative delay; 2068 struct GNUNET_TIME_Relative delay;
2069 2069
2070 delay = GNUNET_TIME_relative_multiply (rel->retry_timer, 2070 delay = GNUNET_TIME_relative_multiply (rel->retry_timer,
2071 MESH_RETRANSMIT_MARGIN); 2071 CADET_RETRANSMIT_MARGIN);
2072 new_target = GNUNET_TIME_absolute_add (rel->head_sent->timestamp, 2072 new_target = GNUNET_TIME_absolute_add (rel->head_sent->timestamp,
2073 delay); 2073 delay);
2074 delay = GNUNET_TIME_absolute_get_remaining (new_target); 2074 delay = GNUNET_TIME_absolute_get_remaining (new_target);
@@ -2095,13 +2095,13 @@ GMCH_handle_data_ack (struct MeshChannel *ch,
2095 * @param t Tunnel this channel will be in. 2095 * @param t Tunnel this channel will be in.
2096 * @param msg Channel crate message. 2096 * @param msg Channel crate message.
2097 */ 2097 */
2098struct MeshChannel * 2098struct CadetChannel *
2099GMCH_handle_create (struct MeshTunnel3 *t, 2099GMCH_handle_create (struct CadetTunnel3 *t,
2100 const struct GNUNET_MESH_ChannelCreate *msg) 2100 const struct GNUNET_CADET_ChannelCreate *msg)
2101{ 2101{
2102 MESH_ChannelNumber chid; 2102 CADET_ChannelNumber chid;
2103 struct MeshChannel *ch; 2103 struct CadetChannel *ch;
2104 struct MeshClient *c; 2104 struct CadetClient *c;
2105 int new_channel; 2105 int new_channel;
2106 int reaction; 2106 int reaction;
2107 2107
@@ -2155,7 +2155,7 @@ GMCH_handle_create (struct MeshTunnel3 *t,
2155 LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! Not Reliable\n"); 2155 LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! Not Reliable\n");
2156 2156
2157 send_client_create (ch); 2157 send_client_create (ch);
2158 ch->state = MESH_CHANNEL_SENT; 2158 ch->state = CADET_CHANNEL_SENT;
2159 } 2159 }
2160 else 2160 else
2161 { 2161 {
@@ -2183,7 +2183,7 @@ GMCH_handle_create (struct MeshTunnel3 *t,
2183 * @param ch Channel. 2183 * @param ch Channel.
2184 */ 2184 */
2185void 2185void
2186GMCH_handle_nack (struct MeshChannel *ch) 2186GMCH_handle_nack (struct CadetChannel *ch)
2187{ 2187{
2188 send_client_nack (ch); 2188 send_client_nack (ch);
2189 GMCH_destroy (ch); 2189 GMCH_destroy (ch);
@@ -2201,8 +2201,8 @@ GMCH_handle_nack (struct MeshChannel *ch)
2201 * #GNUNET_SYSERR if message on a one-ended channel (remote) 2201 * #GNUNET_SYSERR if message on a one-ended channel (remote)
2202 */ 2202 */
2203void 2203void
2204GMCH_handle_ack (struct MeshChannel *ch, 2204GMCH_handle_ack (struct CadetChannel *ch,
2205 const struct GNUNET_MESH_ChannelManage *msg, 2205 const struct GNUNET_CADET_ChannelManage *msg,
2206 int fwd) 2206 int fwd)
2207{ 2207{
2208 /* If this is a remote (non-loopback) channel, find 'fwd'. */ 2208 /* If this is a remote (non-loopback) channel, find 'fwd'. */
@@ -2232,11 +2232,11 @@ GMCH_handle_ack (struct MeshChannel *ch,
2232 * #GNUNET_SYSERR if message on a one-ended channel (remote) 2232 * #GNUNET_SYSERR if message on a one-ended channel (remote)
2233 */ 2233 */
2234void 2234void
2235GMCH_handle_destroy (struct MeshChannel *ch, 2235GMCH_handle_destroy (struct CadetChannel *ch,
2236 const struct GNUNET_MESH_ChannelManage *msg, 2236 const struct GNUNET_CADET_ChannelManage *msg,
2237 int fwd) 2237 int fwd)
2238{ 2238{
2239 struct MeshChannelReliability *rel; 2239 struct CadetChannelReliability *rel;
2240 2240
2241 /* If this is a remote (non-loopback) channel, find 'fwd'. */ 2241 /* If this is a remote (non-loopback) channel, find 'fwd'. */
2242 if (GNUNET_SYSERR == fwd) 2242 if (GNUNET_SYSERR == fwd)
@@ -2288,10 +2288,10 @@ GMCH_handle_destroy (struct MeshChannel *ch,
2288 */ 2288 */
2289void 2289void
2290GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, 2290GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
2291 struct MeshChannel *ch, int fwd, 2291 struct CadetChannel *ch, int fwd,
2292 void *existing_copy) 2292 void *existing_copy)
2293{ 2293{
2294 struct MeshChannelQueue *chq; 2294 struct CadetChannelQueue *chq;
2295 uint16_t type; 2295 uint16_t type;
2296 2296
2297 type = ntohs (message->type); 2297 type = ntohs (message->type);
@@ -2306,21 +2306,21 @@ GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
2306 2306
2307 switch (type) 2307 switch (type)
2308 { 2308 {
2309 struct GNUNET_MESH_Data *payload; 2309 struct GNUNET_CADET_Data *payload;
2310 case GNUNET_MESSAGE_TYPE_MESH_DATA: 2310 case GNUNET_MESSAGE_TYPE_CADET_DATA:
2311 2311
2312 payload = (struct GNUNET_MESH_Data *) message; 2312 payload = (struct GNUNET_CADET_Data *) message;
2313 LOG (GNUNET_ERROR_TYPE_INFO, "===> %s %u\n", 2313 LOG (GNUNET_ERROR_TYPE_INFO, "===> %s %u\n",
2314 GM_m2s (type), ntohl (payload->mid)); 2314 GM_m2s (type), ntohl (payload->mid));
2315 if (GNUNET_YES == ch->reliable) 2315 if (GNUNET_YES == ch->reliable)
2316 { 2316 {
2317 chq = GNUNET_new (struct MeshChannelQueue); 2317 chq = GNUNET_new (struct CadetChannelQueue);
2318 chq->type = type; 2318 chq->type = type;
2319 if (NULL == existing_copy) 2319 if (NULL == existing_copy)
2320 chq->copy = channel_save_copy (ch, message, fwd); 2320 chq->copy = channel_save_copy (ch, message, fwd);
2321 else 2321 else
2322 { 2322 {
2323 chq->copy = (struct MeshReliableMessage *) existing_copy; 2323 chq->copy = (struct CadetReliableMessage *) existing_copy;
2324 if (NULL != chq->copy->chq) 2324 if (NULL != chq->copy->chq)
2325 { 2325 {
2326 /* Last retransmission was queued but not yet sent! 2326 /* Last retransmission was queued but not yet sent!
@@ -2357,7 +2357,7 @@ GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
2357 break; 2357 break;
2358 2358
2359 2359
2360 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK: 2360 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK:
2361 if (GNUNET_YES == fwd || NULL != existing_copy) 2361 if (GNUNET_YES == fwd || NULL != existing_copy)
2362 { 2362 {
2363 /* BCK ACK (going FWD) is just a response for a SYNACK, don't keep*/ 2363 /* BCK ACK (going FWD) is just a response for a SYNACK, don't keep*/
@@ -2365,9 +2365,9 @@ GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
2365 return; 2365 return;
2366 } 2366 }
2367 /* fall-trough */ 2367 /* fall-trough */
2368 case GNUNET_MESSAGE_TYPE_MESH_DATA_ACK: 2368 case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK:
2369 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE: 2369 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE:
2370 chq = GNUNET_new (struct MeshChannelQueue); 2370 chq = GNUNET_new (struct CadetChannelQueue);
2371 chq->type = type; 2371 chq->type = type;
2372 chq->rel = fwd ? ch->root_rel : ch->dest_rel; 2372 chq->rel = fwd ? ch->root_rel : ch->dest_rel;
2373 if (NULL != chq->rel->uniq) 2373 if (NULL != chq->rel->uniq)
@@ -2396,8 +2396,8 @@ GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
2396 break; 2396 break;
2397 2397
2398 2398
2399 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY: 2399 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY:
2400 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_NACK: 2400 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK:
2401 fire_and_forget (message, ch, GNUNET_YES); 2401 fire_and_forget (message, ch, GNUNET_YES);
2402 break; 2402 break;
2403 2403
@@ -2418,7 +2418,7 @@ GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
2418 * @return Static string with the channel IDs. 2418 * @return Static string with the channel IDs.
2419 */ 2419 */
2420const char * 2420const char *
2421GMCH_2s (const struct MeshChannel *ch) 2421GMCH_2s (const struct CadetChannel *ch)
2422{ 2422{
2423 static char buf[64]; 2423 static char buf[64];
2424 2424
diff --git a/src/mesh/gnunet-service-mesh_channel.h b/src/mesh/gnunet-service-mesh_channel.h
index e1d5d4876..f5a89a423 100644
--- a/src/mesh/gnunet-service-mesh_channel.h
+++ b/src/mesh/gnunet-service-mesh_channel.h
@@ -19,15 +19,15 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file mesh/gnunet-service-mesh_channel.h 22 * @file cadet/gnunet-service-cadet_channel.h
23 * @brief mesh service; dealing with end-to-end channels 23 * @brief cadet service; dealing with end-to-end channels
24 * @author Bartlomiej Polot 24 * @author Bartlomiej Polot
25 * 25 *
26 * All functions in this file should use the prefix GMCH (Gnunet Mesh CHannel) 26 * All functions in this file should use the prefix GMCH (Gnunet Cadet CHannel)
27 */ 27 */
28 28
29#ifndef GNUNET_SERVICE_MESH_CHANNEL_H 29#ifndef GNUNET_SERVICE_CADET_CHANNEL_H
30#define GNUNET_SERVICE_MESH_CHANNEL_H 30#define GNUNET_SERVICE_CADET_CHANNEL_H
31 31
32#ifdef __cplusplus 32#ifdef __cplusplus
33extern "C" 33extern "C"
@@ -40,17 +40,17 @@ extern "C"
40#include "platform.h" 40#include "platform.h"
41#include "gnunet_util_lib.h" 41#include "gnunet_util_lib.h"
42 42
43#include "mesh_protocol.h" 43#include "cadet_protocol.h"
44#include "mesh.h" 44#include "cadet.h"
45 45
46/** 46/**
47 * Struct containing all information regarding a channel to a remote client. 47 * Struct containing all information regarding a channel to a remote client.
48 */ 48 */
49struct MeshChannel; 49struct CadetChannel;
50 50
51 51
52#include "gnunet-service-mesh_tunnel.h" 52#include "gnunet-service-cadet_tunnel.h"
53#include "gnunet-service-mesh_local.h" 53#include "gnunet-service-cadet_local.h"
54 54
55 55
56/** 56/**
@@ -59,7 +59,7 @@ struct MeshChannel;
59 * @param ch Channel to destroy. 59 * @param ch Channel to destroy.
60 */ 60 */
61void 61void
62GMCH_destroy (struct MeshChannel *ch); 62GMCH_destroy (struct CadetChannel *ch);
63 63
64 64
65/** 65/**
@@ -69,8 +69,8 @@ GMCH_destroy (struct MeshChannel *ch);
69 * 69 *
70 * @return ID used to identify the channel with the remote peer. 70 * @return ID used to identify the channel with the remote peer.
71 */ 71 */
72MESH_ChannelNumber 72CADET_ChannelNumber
73GMCH_get_id (const struct MeshChannel *ch); 73GMCH_get_id (const struct CadetChannel *ch);
74 74
75/** 75/**
76 * Get the channel tunnel. 76 * Get the channel tunnel.
@@ -79,8 +79,8 @@ GMCH_get_id (const struct MeshChannel *ch);
79 * 79 *
80 * @return tunnel of the channel. 80 * @return tunnel of the channel.
81 */ 81 */
82struct MeshTunnel3 * 82struct CadetTunnel3 *
83GMCH_get_tunnel (const struct MeshChannel *ch); 83GMCH_get_tunnel (const struct CadetChannel *ch);
84 84
85/** 85/**
86 * Get free buffer space towards the client on a specific channel. 86 * Get free buffer space towards the client on a specific channel.
@@ -91,7 +91,7 @@ GMCH_get_tunnel (const struct MeshChannel *ch);
91 * @return Free buffer space [0 - 64] 91 * @return Free buffer space [0 - 64]
92 */ 92 */
93unsigned int 93unsigned int
94GMCH_get_buffer (struct MeshChannel *ch, int fwd); 94GMCH_get_buffer (struct CadetChannel *ch, int fwd);
95 95
96 96
97/** 97/**
@@ -103,7 +103,7 @@ GMCH_get_buffer (struct MeshChannel *ch, int fwd);
103 * @return #GNUNET_YES if client is allowed to send us data. 103 * @return #GNUNET_YES if client is allowed to send us data.
104 */ 104 */
105int 105int
106GMCH_get_allowed (struct MeshChannel *ch, int fwd); 106GMCH_get_allowed (struct CadetChannel *ch, int fwd);
107 107
108 108
109/** 109/**
@@ -115,7 +115,7 @@ GMCH_get_allowed (struct MeshChannel *ch, int fwd);
115 * @return #GNUNET_YES in case it is. 115 * @return #GNUNET_YES in case it is.
116 */ 116 */
117int 117int
118GMCH_is_origin (struct MeshChannel *ch, int fwd); 118GMCH_is_origin (struct CadetChannel *ch, int fwd);
119 119
120/** 120/**
121 * Is the destination client for this channel on this peer? 121 * Is the destination client for this channel on this peer?
@@ -126,7 +126,7 @@ GMCH_is_origin (struct MeshChannel *ch, int fwd);
126 * @return #GNUNET_YES in case it is. 126 * @return #GNUNET_YES in case it is.
127 */ 127 */
128int 128int
129GMCH_is_terminal (struct MeshChannel *ch, int fwd); 129GMCH_is_terminal (struct CadetChannel *ch, int fwd);
130 130
131/** 131/**
132 * Send an end-to-end ACK message for the most recent in-sequence payload. 132 * Send an end-to-end ACK message for the most recent in-sequence payload.
@@ -137,7 +137,7 @@ GMCH_is_terminal (struct MeshChannel *ch, int fwd);
137 * @param fwd Is for FWD traffic? (ACK dest->owner) 137 * @param fwd Is for FWD traffic? (ACK dest->owner)
138 */ 138 */
139void 139void
140GMCH_send_data_ack (struct MeshChannel *ch, int fwd); 140GMCH_send_data_ack (struct CadetChannel *ch, int fwd);
141 141
142/** 142/**
143 * Notify the destination client that a new incoming channel was created. 143 * Notify the destination client that a new incoming channel was created.
@@ -145,7 +145,7 @@ GMCH_send_data_ack (struct MeshChannel *ch, int fwd);
145 * @param ch Channel that was created. 145 * @param ch Channel that was created.
146 */ 146 */
147void 147void
148GMCH_send_create (struct MeshChannel *ch); 148GMCH_send_create (struct CadetChannel *ch);
149 149
150/** 150/**
151 * Allow a client to send us more data, in case it was choked. 151 * Allow a client to send us more data, in case it was choked.
@@ -154,7 +154,7 @@ GMCH_send_create (struct MeshChannel *ch);
154 * @param fwd Is this about FWD traffic? (Root client). 154 * @param fwd Is this about FWD traffic? (Root client).
155 */ 155 */
156void 156void
157GMCH_allow_client (struct MeshChannel *ch, int fwd); 157GMCH_allow_client (struct CadetChannel *ch, int fwd);
158 158
159/** 159/**
160 * Log channel info. 160 * Log channel info.
@@ -162,7 +162,7 @@ GMCH_allow_client (struct MeshChannel *ch, int fwd);
162 * @param ch Channel. 162 * @param ch Channel.
163 */ 163 */
164void 164void
165GMCH_debug (struct MeshChannel *ch); 165GMCH_debug (struct CadetChannel *ch);
166 166
167/** 167/**
168 * Handle an ACK given by a client. 168 * Handle an ACK given by a client.
@@ -173,7 +173,7 @@ GMCH_debug (struct MeshChannel *ch);
173 * @param fwd Is this a "FWD ACK"? (FWD ACKs are sent by root and go BCK) 173 * @param fwd Is this a "FWD ACK"? (FWD ACKs are sent by root and go BCK)
174 */ 174 */
175void 175void
176GMCH_handle_local_ack (struct MeshChannel *ch, int fwd); 176GMCH_handle_local_ack (struct CadetChannel *ch, int fwd);
177 177
178/** 178/**
179 * Handle data given by a client. 179 * Handle data given by a client.
@@ -190,8 +190,8 @@ GMCH_handle_local_ack (struct MeshChannel *ch, int fwd);
190 * @return GNUNET_OK if everything goes well, GNUNET_SYSERR in case of en error. 190 * @return GNUNET_OK if everything goes well, GNUNET_SYSERR in case of en error.
191 */ 191 */
192int 192int
193GMCH_handle_local_data (struct MeshChannel *ch, 193GMCH_handle_local_data (struct CadetChannel *ch,
194 struct MeshClient *c, 194 struct CadetClient *c,
195 struct GNUNET_MessageHeader *message, 195 struct GNUNET_MessageHeader *message,
196 int fwd); 196 int fwd);
197 197
@@ -205,8 +205,8 @@ GMCH_handle_local_data (struct MeshChannel *ch,
205 * @param is_root Is the request coming from root? 205 * @param is_root Is the request coming from root?
206 */ 206 */
207void 207void
208GMCH_handle_local_destroy (struct MeshChannel *ch, 208GMCH_handle_local_destroy (struct CadetChannel *ch,
209 struct MeshClient *c, 209 struct CadetClient *c,
210 int is_root); 210 int is_root);
211 211
212/** 212/**
@@ -220,11 +220,11 @@ GMCH_handle_local_destroy (struct MeshChannel *ch,
220 * @return GNUNET_OK if everything went fine, GNUNET_SYSERR otherwise. 220 * @return GNUNET_OK if everything went fine, GNUNET_SYSERR otherwise.
221 */ 221 */
222int 222int
223GMCH_handle_local_create (struct MeshClient *c, 223GMCH_handle_local_create (struct CadetClient *c,
224 struct GNUNET_MESH_ChannelMessage *msg); 224 struct GNUNET_CADET_ChannelMessage *msg);
225 225
226/** 226/**
227 * Handler for mesh network payload traffic. 227 * Handler for cadet network payload traffic.
228 * 228 *
229 * @param ch Channel for the message. 229 * @param ch Channel for the message.
230 * @param msg Unencryted data message. 230 * @param msg Unencryted data message.
@@ -234,12 +234,12 @@ GMCH_handle_local_create (struct MeshClient *c,
234 * #GNUNET_SYSERR if message on a one-ended channel (remote) 234 * #GNUNET_SYSERR if message on a one-ended channel (remote)
235 */ 235 */
236void 236void
237GMCH_handle_data (struct MeshChannel *ch, 237GMCH_handle_data (struct CadetChannel *ch,
238 const struct GNUNET_MESH_Data *msg, 238 const struct GNUNET_CADET_Data *msg,
239 int fwd); 239 int fwd);
240 240
241/** 241/**
242 * Handler for mesh network traffic end-to-end ACKs. 242 * Handler for cadet network traffic end-to-end ACKs.
243 * 243 *
244 * @param ch Channel on which we got this message. 244 * @param ch Channel on which we got this message.
245 * @param msg Data message. 245 * @param msg Data message.
@@ -249,8 +249,8 @@ GMCH_handle_data (struct MeshChannel *ch,
249 * #GNUNET_SYSERR if message on a one-ended channel (remote) 249 * #GNUNET_SYSERR if message on a one-ended channel (remote)
250 */ 250 */
251void 251void
252GMCH_handle_data_ack (struct MeshChannel *ch, 252GMCH_handle_data_ack (struct CadetChannel *ch,
253 const struct GNUNET_MESH_DataACK *msg, 253 const struct GNUNET_CADET_DataACK *msg,
254 int fwd); 254 int fwd);
255 255
256/** 256/**
@@ -261,9 +261,9 @@ GMCH_handle_data_ack (struct MeshChannel *ch,
261 * @param t Tunnel this channel will be in. 261 * @param t Tunnel this channel will be in.
262 * @param msg Channel crate message. 262 * @param msg Channel crate message.
263 */ 263 */
264struct MeshChannel * 264struct CadetChannel *
265GMCH_handle_create (struct MeshTunnel3 *t, 265GMCH_handle_create (struct CadetTunnel3 *t,
266 const struct GNUNET_MESH_ChannelCreate *msg); 266 const struct GNUNET_CADET_ChannelCreate *msg);
267 267
268/** 268/**
269 * Handler for channel NACK messages. 269 * Handler for channel NACK messages.
@@ -273,7 +273,7 @@ GMCH_handle_create (struct MeshTunnel3 *t,
273 * @param ch Channel. 273 * @param ch Channel.
274 */ 274 */
275void 275void
276GMCH_handle_nack (struct MeshChannel *ch); 276GMCH_handle_nack (struct CadetChannel *ch);
277 277
278/** 278/**
279 * Handler for channel ack messages. 279 * Handler for channel ack messages.
@@ -286,8 +286,8 @@ GMCH_handle_nack (struct MeshChannel *ch);
286 * #GNUNET_SYSERR if message on a one-ended channel (remote) 286 * #GNUNET_SYSERR if message on a one-ended channel (remote)
287 */ 287 */
288void 288void
289GMCH_handle_ack (struct MeshChannel *ch, 289GMCH_handle_ack (struct CadetChannel *ch,
290 const struct GNUNET_MESH_ChannelManage *msg, 290 const struct GNUNET_CADET_ChannelManage *msg,
291 int fwd); 291 int fwd);
292 292
293/** 293/**
@@ -301,8 +301,8 @@ GMCH_handle_ack (struct MeshChannel *ch,
301 * #GNUNET_SYSERR if message on a one-ended channel (remote) 301 * #GNUNET_SYSERR if message on a one-ended channel (remote)
302 */ 302 */
303void 303void
304GMCH_handle_destroy (struct MeshChannel *ch, 304GMCH_handle_destroy (struct CadetChannel *ch,
305 const struct GNUNET_MESH_ChannelManage *msg, 305 const struct GNUNET_CADET_ChannelManage *msg,
306 int fwd); 306 int fwd);
307 307
308/** 308/**
@@ -323,7 +323,7 @@ GMCH_handle_destroy (struct MeshChannel *ch,
323 */ 323 */
324void 324void
325GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, 325GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
326 struct MeshChannel *ch, int fwd, 326 struct CadetChannel *ch, int fwd,
327 void *existing_copy); 327 void *existing_copy);
328 328
329/** 329/**
@@ -334,7 +334,7 @@ GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
334 * @return Static string with the channel IDs. 334 * @return Static string with the channel IDs.
335 */ 335 */
336const char * 336const char *
337GMCH_2s (const struct MeshChannel *ch); 337GMCH_2s (const struct CadetChannel *ch);
338 338
339 339
340#if 0 /* keep Emacsens' auto-indent happy */ 340#if 0 /* keep Emacsens' auto-indent happy */
@@ -344,6 +344,6 @@ GMCH_2s (const struct MeshChannel *ch);
344} 344}
345#endif 345#endif
346 346
347/* ifndef GNUNET_SERVICE_MESH_CHANNEL_H */ 347/* ifndef GNUNET_SERVICE_CADET_CHANNEL_H */
348#endif 348#endif
349/* end of gnunet-service-mesh_channel.h */ 349/* end of gnunet-service-cadet_channel.h */
diff --git a/src/mesh/gnunet-service-mesh_connection.c b/src/mesh/gnunet-service-mesh_connection.c
index 31c225ee9..9c07e006b 100644
--- a/src/mesh/gnunet-service-mesh_connection.c
+++ b/src/mesh/gnunet-service-mesh_connection.c
@@ -19,8 +19,8 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file mesh/gnunet-service-mesh_connection.c 22 * @file cadet/gnunet-service-cadet_connection.c
23 * @brief GNUnet MESH service connection handling 23 * @brief GNUnet CADET service connection handling
24 * @author Bartlomiej Polot 24 * @author Bartlomiej Polot
25 */ 25 */
26 26
@@ -29,17 +29,17 @@
29 29
30#include "gnunet_statistics_service.h" 30#include "gnunet_statistics_service.h"
31 31
32#include "mesh_path.h" 32#include "cadet_path.h"
33#include "mesh_protocol.h" 33#include "cadet_protocol.h"
34#include "mesh.h" 34#include "cadet.h"
35#include "gnunet-service-mesh_connection.h" 35#include "gnunet-service-cadet_connection.h"
36#include "gnunet-service-mesh_peer.h" 36#include "gnunet-service-cadet_peer.h"
37#include "gnunet-service-mesh_tunnel.h" 37#include "gnunet-service-cadet_tunnel.h"
38 38
39 39
40#define LOG(level, ...) GNUNET_log_from (level,"mesh-con",__VA_ARGS__) 40#define LOG(level, ...) GNUNET_log_from (level,"cadet-con",__VA_ARGS__)
41 41
42#define MESH_MAX_POLL_TIME GNUNET_TIME_relative_multiply (\ 42#define CADET_MAX_POLL_TIME GNUNET_TIME_relative_multiply (\
43 GNUNET_TIME_UNIT_MINUTES,\ 43 GNUNET_TIME_UNIT_MINUTES,\
44 10) 44 10)
45#define AVG_MSGS 32 45#define AVG_MSGS 32
@@ -53,12 +53,12 @@
53 * Struct to encapsulate all the Flow Control information to a peer to which 53 * Struct to encapsulate all the Flow Control information to a peer to which
54 * we are directly connected (on a core level). 54 * we are directly connected (on a core level).
55 */ 55 */
56struct MeshFlowControl 56struct CadetFlowControl
57{ 57{
58 /** 58 /**
59 * Connection this controls. 59 * Connection this controls.
60 */ 60 */
61 struct MeshConnection *c; 61 struct CadetConnection *c;
62 62
63 /** 63 /**
64 * How many messages are in the queue on this connection. 64 * How many messages are in the queue on this connection.
@@ -103,18 +103,18 @@ struct MeshFlowControl
103 /** 103 /**
104 * Queued poll message, to cancel if not necessary anymore (got ACK). 104 * Queued poll message, to cancel if not necessary anymore (got ACK).
105 */ 105 */
106 struct MeshConnectionQueue *poll_msg; 106 struct CadetConnectionQueue *poll_msg;
107 107
108 /** 108 /**
109 * Queued poll message, to cancel if not necessary anymore (got ACK). 109 * Queued poll message, to cancel if not necessary anymore (got ACK).
110 */ 110 */
111 struct MeshConnectionQueue *ack_msg; 111 struct CadetConnectionQueue *ack_msg;
112}; 112};
113 113
114/** 114/**
115 * Keep a record of the last messages sent on this connection. 115 * Keep a record of the last messages sent on this connection.
116 */ 116 */
117struct MeshConnectionPerformance 117struct CadetConnectionPerformance
118{ 118{
119 /** 119 /**
120 * Circular buffer for storing measurements. 120 * Circular buffer for storing measurements.
@@ -141,43 +141,43 @@ struct MeshConnectionPerformance
141/** 141/**
142 * Struct containing all information regarding a connection to a peer. 142 * Struct containing all information regarding a connection to a peer.
143 */ 143 */
144struct MeshConnection 144struct CadetConnection
145{ 145{
146 /** 146 /**
147 * Tunnel this connection is part of. 147 * Tunnel this connection is part of.
148 */ 148 */
149 struct MeshTunnel3 *t; 149 struct CadetTunnel3 *t;
150 150
151 /** 151 /**
152 * Flow control information for traffic fwd. 152 * Flow control information for traffic fwd.
153 */ 153 */
154 struct MeshFlowControl fwd_fc; 154 struct CadetFlowControl fwd_fc;
155 155
156 /** 156 /**
157 * Flow control information for traffic bck. 157 * Flow control information for traffic bck.
158 */ 158 */
159 struct MeshFlowControl bck_fc; 159 struct CadetFlowControl bck_fc;
160 160
161 /** 161 /**
162 * Measure connection performance on the endpoint. 162 * Measure connection performance on the endpoint.
163 */ 163 */
164 struct MeshConnectionPerformance *perf; 164 struct CadetConnectionPerformance *perf;
165 165
166 /** 166 /**
167 * ID of the connection. 167 * ID of the connection.
168 */ 168 */
169 struct GNUNET_MESH_Hash id; 169 struct GNUNET_CADET_Hash id;
170 170
171 /** 171 /**
172 * State of the connection. 172 * State of the connection.
173 */ 173 */
174 enum MeshConnectionState state; 174 enum CadetConnectionState state;
175 175
176 /** 176 /**
177 * Path being used for the tunnel. At the origin of the connection 177 * Path being used for the tunnel. At the origin of the connection
178 * it's a pointer to the destination's path pool, otherwise just a copy. 178 * it's a pointer to the destination's path pool, otherwise just a copy.
179 */ 179 */
180 struct MeshPeerPath *path; 180 struct CadetPeerPath *path;
181 181
182 /** 182 /**
183 * Position of the local peer in the path. 183 * Position of the local peer in the path.
@@ -200,7 +200,7 @@ struct MeshConnection
200 * Queue handle for maintainance traffic. One handle for FWD and BCK since 200 * Queue handle for maintainance traffic. One handle for FWD and BCK since
201 * one peer never needs to maintain both directions (no loopback connections). 201 * one peer never needs to maintain both directions (no loopback connections).
202 */ 202 */
203 struct MeshPeerQueue *maintenance_q; 203 struct CadetPeerQueue *maintenance_q;
204 204
205 /** 205 /**
206 * Counter to do exponential backoff when creating a connection (max 64). 206 * Counter to do exponential backoff when creating a connection (max 64).
@@ -221,12 +221,12 @@ struct MeshConnection
221/** 221/**
222 * Handle for messages queued but not yet sent. 222 * Handle for messages queued but not yet sent.
223 */ 223 */
224struct MeshConnectionQueue 224struct CadetConnectionQueue
225{ 225{
226 /** 226 /**
227 * Peer queue handle, to cancel if necessary. 227 * Peer queue handle, to cancel if necessary.
228 */ 228 */
229 struct MeshPeerQueue *q; 229 struct CadetPeerQueue *q;
230 230
231 /** 231 /**
232 * Was this a forced message? (Do not account for it) 232 * Was this a forced message? (Do not account for it)
@@ -264,7 +264,7 @@ extern GNUNET_PEER_Id myid;
264extern struct GNUNET_PeerIdentity my_full_id; 264extern struct GNUNET_PeerIdentity my_full_id;
265 265
266/** 266/**
267 * Connections known, indexed by cid (MeshConnection). 267 * Connections known, indexed by cid (CadetConnection).
268 */ 268 */
269static struct GNUNET_CONTAINER_MultiHashMap *connections; 269static struct GNUNET_CONTAINER_MultiHashMap *connections;
270 270
@@ -297,7 +297,7 @@ static struct GNUNET_TIME_Relative create_connection_time;
297 297
298#if 0 // avoid compiler warning for unused static function 298#if 0 // avoid compiler warning for unused static function
299static void 299static void
300fc_debug (struct MeshFlowControl *fc) 300fc_debug (struct CadetFlowControl *fc)
301{ 301{
302 LOG (GNUNET_ERROR_TYPE_DEBUG, " IN: %u/%u\n", 302 LOG (GNUNET_ERROR_TYPE_DEBUG, " IN: %u/%u\n",
303 fc->last_pid_recv, fc->last_ack_sent); 303 fc->last_pid_recv, fc->last_ack_sent);
@@ -308,7 +308,7 @@ fc_debug (struct MeshFlowControl *fc)
308} 308}
309 309
310static void 310static void
311connection_debug (struct MeshConnection *c) 311connection_debug (struct CadetConnection *c)
312{ 312{
313 if (NULL == c) 313 if (NULL == c)
314 { 314 {
@@ -335,7 +335,7 @@ connection_debug (struct MeshConnection *c)
335 * @param fwd Direction for the next keepalive. 335 * @param fwd Direction for the next keepalive.
336 */ 336 */
337static void 337static void
338schedule_next_keepalive (struct MeshConnection *c, int fwd); 338schedule_next_keepalive (struct CadetConnection *c, int fwd);
339 339
340 340
341/** 341/**
@@ -351,7 +351,7 @@ schedule_next_keepalive (struct MeshConnection *c, int fwd);
351 * @param fwd Is this forward? 351 * @param fwd Is this forward?
352 */ 352 */
353static void 353static void
354connection_reset_timeout (struct MeshConnection *c, int fwd); 354connection_reset_timeout (struct CadetConnection *c, int fwd);
355 355
356 356
357/** 357/**
@@ -362,22 +362,22 @@ connection_reset_timeout (struct MeshConnection *c, int fwd);
362 * @return String representation. 362 * @return String representation.
363 */ 363 */
364static const char * 364static const char *
365GMC_state2s (enum MeshConnectionState s) 365GMC_state2s (enum CadetConnectionState s)
366{ 366{
367 switch (s) 367 switch (s)
368 { 368 {
369 case MESH_CONNECTION_NEW: 369 case CADET_CONNECTION_NEW:
370 return "MESH_CONNECTION_NEW"; 370 return "CADET_CONNECTION_NEW";
371 case MESH_CONNECTION_SENT: 371 case CADET_CONNECTION_SENT:
372 return "MESH_CONNECTION_SENT"; 372 return "CADET_CONNECTION_SENT";
373 case MESH_CONNECTION_ACK: 373 case CADET_CONNECTION_ACK:
374 return "MESH_CONNECTION_ACK"; 374 return "CADET_CONNECTION_ACK";
375 case MESH_CONNECTION_READY: 375 case CADET_CONNECTION_READY:
376 return "MESH_CONNECTION_READY"; 376 return "CADET_CONNECTION_READY";
377 case MESH_CONNECTION_DESTROYED: 377 case CADET_CONNECTION_DESTROYED:
378 return "MESH_CONNECTION_DESTROYED"; 378 return "CADET_CONNECTION_DESTROYED";
379 default: 379 default:
380 return "MESH_CONNECTION_STATE_ERROR"; 380 return "CADET_CONNECTION_STATE_ERROR";
381 } 381 }
382} 382}
383 383
@@ -388,7 +388,7 @@ GMC_state2s (enum MeshConnectionState s)
388 * @param fc Flow Control structure to initialize. 388 * @param fc Flow Control structure to initialize.
389 */ 389 */
390static void 390static void
391fc_init (struct MeshFlowControl *fc) 391fc_init (struct CadetFlowControl *fc)
392{ 392{
393 fc->last_pid_sent = (uint32_t) -1; /* Next (expected) = 0 */ 393 fc->last_pid_sent = (uint32_t) -1; /* Next (expected) = 0 */
394 fc->last_pid_recv = (uint32_t) -1; 394 fc->last_pid_recv = (uint32_t) -1;
@@ -406,27 +406,27 @@ fc_init (struct MeshFlowControl *fc)
406 * 406 *
407 * @param cid Connection ID. 407 * @param cid Connection ID.
408 */ 408 */
409static struct MeshConnection * 409static struct CadetConnection *
410connection_get (const struct GNUNET_MESH_Hash *cid) 410connection_get (const struct GNUNET_CADET_Hash *cid)
411{ 411{
412 return GNUNET_CONTAINER_multihashmap_get (connections, GM_h2hc (cid)); 412 return GNUNET_CONTAINER_multihashmap_get (connections, GM_h2hc (cid));
413} 413}
414 414
415 415
416static void 416static void
417connection_change_state (struct MeshConnection* c, 417connection_change_state (struct CadetConnection* c,
418 enum MeshConnectionState state) 418 enum CadetConnectionState state)
419{ 419{
420 LOG (GNUNET_ERROR_TYPE_DEBUG, 420 LOG (GNUNET_ERROR_TYPE_DEBUG,
421 "Connection %s state %s -> %s\n", 421 "Connection %s state %s -> %s\n",
422 GMC_2s (c), GMC_state2s (c->state), GMC_state2s (state)); 422 GMC_2s (c), GMC_state2s (c->state), GMC_state2s (state));
423 if (MESH_CONNECTION_DESTROYED == c->state) 423 if (CADET_CONNECTION_DESTROYED == c->state)
424 { 424 {
425 LOG (GNUNET_ERROR_TYPE_DEBUG, "state not changing anymore\n"); 425 LOG (GNUNET_ERROR_TYPE_DEBUG, "state not changing anymore\n");
426 return; 426 return;
427 } 427 }
428 c->state = state; 428 c->state = state;
429 if (MESH_CONNECTION_READY == state) 429 if (CADET_CONNECTION_READY == state)
430 c->create_retry = 1; 430 c->create_retry = 1;
431} 431}
432 432
@@ -443,11 +443,11 @@ connection_change_state (struct MeshConnection* c,
443 */ 443 */
444static void 444static void
445ack_sent (void *cls, 445ack_sent (void *cls,
446 struct MeshConnection *c, 446 struct CadetConnection *c,
447 struct MeshConnectionQueue *q, 447 struct CadetConnectionQueue *q,
448 uint16_t type, int fwd, size_t size) 448 uint16_t type, int fwd, size_t size)
449{ 449{
450 struct MeshFlowControl *fc = cls; 450 struct CadetFlowControl *fc = cls;
451 451
452 fc->ack_msg = NULL; 452 fc->ack_msg = NULL;
453} 453}
@@ -467,11 +467,11 @@ ack_sent (void *cls,
467 * @param force Don't optimize out. 467 * @param force Don't optimize out.
468 */ 468 */
469static void 469static void
470send_ack (struct MeshConnection *c, unsigned int buffer, int fwd, int force) 470send_ack (struct CadetConnection *c, unsigned int buffer, int fwd, int force)
471{ 471{
472 struct MeshFlowControl *next_fc; 472 struct CadetFlowControl *next_fc;
473 struct MeshFlowControl *prev_fc; 473 struct CadetFlowControl *prev_fc;
474 struct GNUNET_MESH_ACK msg; 474 struct GNUNET_CADET_ACK msg;
475 uint32_t ack; 475 uint32_t ack;
476 int delta; 476 int delta;
477 477
@@ -534,12 +534,12 @@ send_ack (struct MeshConnection *c, unsigned int buffer, int fwd, int force)
534 534
535 /* Build ACK message and send on connection */ 535 /* Build ACK message and send on connection */
536 msg.header.size = htons (sizeof (msg)); 536 msg.header.size = htons (sizeof (msg));
537 msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_ACK); 537 msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_ACK);
538 msg.ack = htonl (ack); 538 msg.ack = htonl (ack);
539 msg.cid = c->id; 539 msg.cid = c->id;
540 540
541 prev_fc->ack_msg = GMC_send_prebuilt_message (&msg.header, 541 prev_fc->ack_msg = GMC_send_prebuilt_message (&msg.header,
542 GNUNET_MESSAGE_TYPE_MESH_ACK, 542 GNUNET_MESSAGE_TYPE_CADET_ACK,
543 ack, c, !fwd, GNUNET_YES, 543 ack, c, !fwd, GNUNET_YES,
544 &ack_sent, prev_fc); 544 &ack_sent, prev_fc);
545} 545}
@@ -561,13 +561,13 @@ send_ack (struct MeshConnection *c, unsigned int buffer, int fwd, int force)
561 */ 561 */
562static void 562static void
563conn_message_sent (void *cls, 563conn_message_sent (void *cls,
564 struct MeshConnection *c, int sent, 564 struct CadetConnection *c, int sent,
565 uint16_t type, uint32_t pid, int fwd, size_t size, 565 uint16_t type, uint32_t pid, int fwd, size_t size,
566 struct GNUNET_TIME_Relative wait) 566 struct GNUNET_TIME_Relative wait)
567{ 567{
568 struct MeshConnectionPerformance *p; 568 struct CadetConnectionPerformance *p;
569 struct MeshFlowControl *fc; 569 struct CadetFlowControl *fc;
570 struct MeshConnectionQueue *q = cls; 570 struct CadetConnectionQueue *q = cls;
571 double usecsperbyte; 571 double usecsperbyte;
572 int forced; 572 int forced;
573 573
@@ -586,7 +586,7 @@ conn_message_sent (void *cls,
586 } 586 }
587 GNUNET_free (q); 587 GNUNET_free (q);
588 } 588 }
589 else if (type == GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED) 589 else if (type == GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED)
590 { 590 {
591 /* If NULL == q and ENCRYPTED == type, message must have been ch_mngmnt */ 591 /* If NULL == q and ENCRYPTED == type, message must have been ch_mngmnt */
592 forced = GNUNET_YES; 592 forced = GNUNET_YES;
@@ -597,8 +597,8 @@ conn_message_sent (void *cls,
597 } 597 }
598 if (NULL == c) 598 if (NULL == c)
599 { 599 {
600 GNUNET_break (type == GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN || 600 GNUNET_break (type == GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN ||
601 type == GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY); 601 type == GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY);
602 LOG (GNUNET_ERROR_TYPE_ERROR, "Message %s sent on NULL connection!\n", 602 LOG (GNUNET_ERROR_TYPE_ERROR, "Message %s sent on NULL connection!\n",
603 GM_m2s (type)); 603 GM_m2s (type));
604 return; 604 return;
@@ -614,15 +614,15 @@ conn_message_sent (void *cls,
614 /* Send ACK if needed, after accounting for sent ID in fc->queue_n */ 614 /* Send ACK if needed, after accounting for sent ID in fc->queue_n */
615 switch (type) 615 switch (type)
616 { 616 {
617 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE: 617 case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE:
618 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK: 618 case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK:
619 c->maintenance_q = NULL; 619 c->maintenance_q = NULL;
620 /* Don't trigger a keepalive for sent ACKs, only SYN and SYNACKs */ 620 /* Don't trigger a keepalive for sent ACKs, only SYN and SYNACKs */
621 if (GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE == type || !fwd) 621 if (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE == type || !fwd)
622 schedule_next_keepalive (c, fwd); 622 schedule_next_keepalive (c, fwd);
623 break; 623 break;
624 624
625 case GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED: 625 case GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED:
626 if (GNUNET_YES == sent) 626 if (GNUNET_YES == sent)
627 { 627 {
628 GNUNET_assert (NULL != q); 628 GNUNET_assert (NULL != q);
@@ -647,16 +647,16 @@ conn_message_sent (void *cls,
647 } 647 }
648 break; 648 break;
649 649
650 case GNUNET_MESSAGE_TYPE_MESH_KX: 650 case GNUNET_MESSAGE_TYPE_CADET_KX:
651 if (GNUNET_YES == sent) 651 if (GNUNET_YES == sent)
652 connection_reset_timeout (c, fwd); 652 connection_reset_timeout (c, fwd);
653 break; 653 break;
654 654
655 case GNUNET_MESSAGE_TYPE_MESH_POLL: 655 case GNUNET_MESSAGE_TYPE_CADET_POLL:
656 fc->poll_msg = NULL; 656 fc->poll_msg = NULL;
657 break; 657 break;
658 658
659 case GNUNET_MESSAGE_TYPE_MESH_ACK: 659 case GNUNET_MESSAGE_TYPE_CADET_ACK:
660 fc->ack_msg = NULL; 660 fc->ack_msg = NULL;
661 break; 661 break;
662 662
@@ -697,8 +697,8 @@ conn_message_sent (void *cls,
697 * 697 *
698 * @return Previous peer in the connection. 698 * @return Previous peer in the connection.
699 */ 699 */
700static struct MeshPeer * 700static struct CadetPeer *
701get_prev_hop (const struct MeshConnection *c) 701get_prev_hop (const struct CadetConnection *c)
702{ 702{
703 GNUNET_PEER_Id id; 703 GNUNET_PEER_Id id;
704 704
@@ -723,8 +723,8 @@ get_prev_hop (const struct MeshConnection *c)
723 * 723 *
724 * @return Next peer in the connection. 724 * @return Next peer in the connection.
725 */ 725 */
726static struct MeshPeer * 726static struct CadetPeer *
727get_next_hop (const struct MeshConnection *c) 727get_next_hop (const struct CadetConnection *c)
728{ 728{
729 GNUNET_PEER_Id id; 729 GNUNET_PEER_Id id;
730 730
@@ -750,8 +750,8 @@ get_next_hop (const struct MeshConnection *c)
750 * 750 *
751 * @return Next peer in the connection. 751 * @return Next peer in the connection.
752 */ 752 */
753static struct MeshPeer * 753static struct CadetPeer *
754get_hop (struct MeshConnection *c, int fwd) 754get_hop (struct CadetConnection *c, int fwd)
755{ 755{
756 if (fwd) 756 if (fwd)
757 return get_next_hop (c); 757 return get_next_hop (c);
@@ -771,7 +771,7 @@ get_hop (struct MeshConnection *c, int fwd)
771 * #GNUNET_SYSERR for errors. 771 * #GNUNET_SYSERR for errors.
772 */ 772 */
773static int 773static int
774is_fwd (const struct MeshConnection *c, 774is_fwd (const struct CadetConnection *c,
775 const struct GNUNET_PeerIdentity *sender) 775 const struct GNUNET_PeerIdentity *sender)
776{ 776{
777 GNUNET_PEER_Id id; 777 GNUNET_PEER_Id id;
@@ -797,23 +797,23 @@ is_fwd (const struct MeshConnection *c,
797 * (First (~SYNACK) goes BCK, second (~ACK) goes FWD) 797 * (First (~SYNACK) goes BCK, second (~ACK) goes FWD)
798 */ 798 */
799static void 799static void
800send_connection_ack (struct MeshConnection *connection, int fwd) 800send_connection_ack (struct CadetConnection *connection, int fwd)
801{ 801{
802 struct MeshTunnel3 *t; 802 struct CadetTunnel3 *t;
803 803
804 t = connection->t; 804 t = connection->t;
805 LOG (GNUNET_ERROR_TYPE_INFO, "===> {%14s ACK} on connection %s\n", 805 LOG (GNUNET_ERROR_TYPE_INFO, "===> {%14s ACK} on connection %s\n",
806 GM_f2s (!fwd), GMC_2s (connection)); 806 GM_f2s (!fwd), GMC_2s (connection));
807 GMP_queue_add (get_hop (connection, fwd), NULL, 807 GMP_queue_add (get_hop (connection, fwd), NULL,
808 GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK, 808 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK,
809 GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK, 0, 809 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK, 0,
810 sizeof (struct GNUNET_MESH_ConnectionACK), 810 sizeof (struct GNUNET_CADET_ConnectionACK),
811 connection, fwd, &conn_message_sent, NULL); 811 connection, fwd, &conn_message_sent, NULL);
812 connection->pending_messages++; 812 connection->pending_messages++;
813 if (MESH_TUNNEL3_NEW == GMT_get_cstate (t)) 813 if (CADET_TUNNEL3_NEW == GMT_get_cstate (t))
814 GMT_change_cstate (t, MESH_TUNNEL3_WAITING); 814 GMT_change_cstate (t, CADET_TUNNEL3_WAITING);
815 if (MESH_CONNECTION_READY != connection->state) 815 if (CADET_CONNECTION_READY != connection->state)
816 connection_change_state (connection, MESH_CONNECTION_SENT); 816 connection_change_state (connection, CADET_CONNECTION_SENT);
817} 817}
818 818
819 819
@@ -826,20 +826,20 @@ send_connection_ack (struct MeshConnection *connection, int fwd)
826 * @param fwd Direction towards which to send it. 826 * @param fwd Direction towards which to send it.
827 */ 827 */
828static void 828static void
829send_broken (struct MeshConnection *c, 829send_broken (struct CadetConnection *c,
830 const struct GNUNET_PeerIdentity *id1, 830 const struct GNUNET_PeerIdentity *id1,
831 const struct GNUNET_PeerIdentity *id2, 831 const struct GNUNET_PeerIdentity *id2,
832 int fwd) 832 int fwd)
833{ 833{
834 struct GNUNET_MESH_ConnectionBroken msg; 834 struct GNUNET_CADET_ConnectionBroken msg;
835 835
836 msg.header.size = htons (sizeof (struct GNUNET_MESH_ConnectionBroken)); 836 msg.header.size = htons (sizeof (struct GNUNET_CADET_ConnectionBroken));
837 msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN); 837 msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN);
838 msg.cid = c->id; 838 msg.cid = c->id;
839 msg.peer1 = *id1; 839 msg.peer1 = *id1;
840 msg.peer2 = *id2; 840 msg.peer2 = *id2;
841 GMC_send_prebuilt_message (&msg.header, 841 GMC_send_prebuilt_message (&msg.header,
842 GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN, 0, 842 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN, 0,
843 c, fwd, GNUNET_YES, NULL, NULL); 843 c, fwd, GNUNET_YES, NULL, NULL);
844} 844}
845 845
@@ -854,20 +854,20 @@ send_broken (struct MeshConnection *c,
854 * @param peer Peer to notify (neighbor who sent the connection). 854 * @param peer Peer to notify (neighbor who sent the connection).
855 */ 855 */
856static void 856static void
857send_broken_unknown (const struct GNUNET_MESH_Hash *connection_id, 857send_broken_unknown (const struct GNUNET_CADET_Hash *connection_id,
858 const struct GNUNET_PeerIdentity *id1, 858 const struct GNUNET_PeerIdentity *id1,
859 const struct GNUNET_PeerIdentity *id2, 859 const struct GNUNET_PeerIdentity *id2,
860 const struct GNUNET_PeerIdentity *peer_id) 860 const struct GNUNET_PeerIdentity *peer_id)
861{ 861{
862 struct GNUNET_MESH_ConnectionBroken *msg; 862 struct GNUNET_CADET_ConnectionBroken *msg;
863 struct MeshPeer *neighbor; 863 struct CadetPeer *neighbor;
864 864
865 LOG (GNUNET_ERROR_TYPE_INFO, "===> BROKEN on unknown connection %s\n", 865 LOG (GNUNET_ERROR_TYPE_INFO, "===> BROKEN on unknown connection %s\n",
866 GNUNET_h2s (GM_h2hc (connection_id))); 866 GNUNET_h2s (GM_h2hc (connection_id)));
867 867
868 msg = GNUNET_new (struct GNUNET_MESH_ConnectionBroken); 868 msg = GNUNET_new (struct GNUNET_CADET_ConnectionBroken);
869 msg->header.size = htons (sizeof (struct GNUNET_MESH_ConnectionBroken)); 869 msg->header.size = htons (sizeof (struct GNUNET_CADET_ConnectionBroken));
870 msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN); 870 msg->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN);
871 msg->cid = *connection_id; 871 msg->cid = *connection_id;
872 msg->peer1 = *id1; 872 msg->peer1 = *id1;
873 if (NULL != id2) 873 if (NULL != id2)
@@ -876,9 +876,9 @@ send_broken_unknown (const struct GNUNET_MESH_Hash *connection_id,
876 memset (&msg->peer2, 0, sizeof (msg->peer2)); 876 memset (&msg->peer2, 0, sizeof (msg->peer2));
877 neighbor = GMP_get (peer_id); 877 neighbor = GMP_get (peer_id);
878 GMP_queue_add (neighbor, msg, 878 GMP_queue_add (neighbor, msg,
879 GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN, 879 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN,
880 GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN, 2, 880 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN, 2,
881 sizeof (struct GNUNET_MESH_ConnectionBroken), 881 sizeof (struct GNUNET_CADET_ConnectionBroken),
882 NULL, GNUNET_SYSERR, /* connection, fwd */ 882 NULL, GNUNET_SYSERR, /* connection, fwd */
883 NULL, NULL); /* continuation */ 883 NULL, NULL); /* continuation */
884} 884}
@@ -891,10 +891,10 @@ send_broken_unknown (const struct GNUNET_MESH_Hash *connection_id,
891 * @param fwd Is this a FWD keepalive? (owner -> dest). 891 * @param fwd Is this a FWD keepalive? (owner -> dest).
892 */ 892 */
893static void 893static void
894send_connection_keepalive (struct MeshConnection *c, int fwd) 894send_connection_keepalive (struct CadetConnection *c, int fwd)
895{ 895{
896 struct GNUNET_MessageHeader msg; 896 struct GNUNET_MessageHeader msg;
897 struct MeshFlowControl *fc; 897 struct CadetFlowControl *fc;
898 898
899 LOG (GNUNET_ERROR_TYPE_INFO, 899 LOG (GNUNET_ERROR_TYPE_INFO,
900 "keepalive %s for connection %s\n", 900 "keepalive %s for connection %s\n",
@@ -910,7 +910,7 @@ send_connection_keepalive (struct MeshConnection *c, int fwd)
910 910
911 GNUNET_assert (NULL != c->t); 911 GNUNET_assert (NULL != c->t);
912 msg.size = htons (sizeof (msg)); 912 msg.size = htons (sizeof (msg));
913 msg.type = htons (GNUNET_MESSAGE_TYPE_MESH_KEEPALIVE); 913 msg.type = htons (GNUNET_MESSAGE_TYPE_CADET_KEEPALIVE);
914 914
915 GNUNET_assert (NULL == 915 GNUNET_assert (NULL ==
916 GMT_send_prebuilt_message (&msg, c->t, c, 916 GMT_send_prebuilt_message (&msg, c->t, c,
@@ -925,7 +925,7 @@ send_connection_keepalive (struct MeshConnection *c, int fwd)
925 * @param fwd If #GNUNET_YES, send CREATE, otherwise send ACK. 925 * @param fwd If #GNUNET_YES, send CREATE, otherwise send ACK.
926 */ 926 */
927static void 927static void
928connection_recreate (struct MeshConnection *c, int fwd) 928connection_recreate (struct CadetConnection *c, int fwd)
929{ 929{
930 LOG (GNUNET_ERROR_TYPE_DEBUG, "sending connection recreate\n"); 930 LOG (GNUNET_ERROR_TYPE_DEBUG, "sending connection recreate\n");
931 if (fwd) 931 if (fwd)
@@ -944,25 +944,25 @@ connection_recreate (struct MeshConnection *c, int fwd)
944 * @param fwd Is FWD? 944 * @param fwd Is FWD?
945 */ 945 */
946static void 946static void
947connection_maintain (struct MeshConnection *c, int fwd) 947connection_maintain (struct CadetConnection *c, int fwd)
948{ 948{
949 if (GNUNET_NO != c->destroy) 949 if (GNUNET_NO != c->destroy)
950 return; 950 return;
951 951
952 if (MESH_TUNNEL3_SEARCHING == GMT_get_cstate (c->t)) 952 if (CADET_TUNNEL3_SEARCHING == GMT_get_cstate (c->t))
953 { 953 {
954 /* TODO DHT GET with RO_BART */ 954 /* TODO DHT GET with RO_BART */
955 return; 955 return;
956 } 956 }
957 switch (c->state) 957 switch (c->state)
958 { 958 {
959 case MESH_CONNECTION_NEW: 959 case CADET_CONNECTION_NEW:
960 GNUNET_break (0); 960 GNUNET_break (0);
961 /* fall-through */ 961 /* fall-through */
962 case MESH_CONNECTION_SENT: 962 case CADET_CONNECTION_SENT:
963 connection_recreate (c, fwd); 963 connection_recreate (c, fwd);
964 break; 964 break;
965 case MESH_CONNECTION_READY: 965 case CADET_CONNECTION_READY:
966 send_connection_keepalive (c, fwd); 966 send_connection_keepalive (c, fwd);
967 break; 967 break;
968 default: 968 default:
@@ -981,7 +981,7 @@ connection_maintain (struct MeshConnection *c, int fwd)
981 * Non-zero value for true, not necessarily GNUNET_YES. 981 * Non-zero value for true, not necessarily GNUNET_YES.
982 */ 982 */
983static void 983static void
984connection_keepalive (struct MeshConnection *c, int fwd, int shutdown) 984connection_keepalive (struct CadetConnection *c, int fwd, int shutdown)
985{ 985{
986 LOG (GNUNET_ERROR_TYPE_DEBUG, "%s keepalive for %s\n", 986 LOG (GNUNET_ERROR_TYPE_DEBUG, "%s keepalive for %s\n",
987 GM_f2s (fwd), GMC_2s (c)); 987 GM_f2s (fwd), GMC_2s (c));
@@ -1010,7 +1010,7 @@ static void
1010connection_fwd_keepalive (void *cls, 1010connection_fwd_keepalive (void *cls,
1011 const struct GNUNET_SCHEDULER_TaskContext *tc) 1011 const struct GNUNET_SCHEDULER_TaskContext *tc)
1012{ 1012{
1013 connection_keepalive ((struct MeshConnection *) cls, 1013 connection_keepalive ((struct CadetConnection *) cls,
1014 GNUNET_YES, 1014 GNUNET_YES,
1015 tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN); 1015 tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN);
1016} 1016}
@@ -1026,7 +1026,7 @@ static void
1026connection_bck_keepalive (void *cls, 1026connection_bck_keepalive (void *cls,
1027 const struct GNUNET_SCHEDULER_TaskContext *tc) 1027 const struct GNUNET_SCHEDULER_TaskContext *tc)
1028{ 1028{
1029 connection_keepalive ((struct MeshConnection *) cls, 1029 connection_keepalive ((struct CadetConnection *) cls,
1030 GNUNET_NO, 1030 GNUNET_NO,
1031 tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN); 1031 tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN);
1032} 1032}
@@ -1042,7 +1042,7 @@ connection_bck_keepalive (void *cls,
1042 * @param fwd Direction for the next keepalive. 1042 * @param fwd Direction for the next keepalive.
1043 */ 1043 */
1044static void 1044static void
1045schedule_next_keepalive (struct MeshConnection *c, int fwd) 1045schedule_next_keepalive (struct CadetConnection *c, int fwd)
1046{ 1046{
1047 struct GNUNET_TIME_Relative delay; 1047 struct GNUNET_TIME_Relative delay;
1048 GNUNET_SCHEDULER_TaskIdentifier *task_id; 1048 GNUNET_SCHEDULER_TaskIdentifier *task_id;
@@ -1052,7 +1052,7 @@ schedule_next_keepalive (struct MeshConnection *c, int fwd)
1052 return; 1052 return;
1053 1053
1054 /* Calculate delay to use, depending on the state of the connection */ 1054 /* Calculate delay to use, depending on the state of the connection */
1055 if (MESH_CONNECTION_READY == c->state) 1055 if (CADET_CONNECTION_READY == c->state)
1056 { 1056 {
1057 delay = refresh_connection_time; 1057 delay = refresh_connection_time;
1058 } 1058 }
@@ -1104,9 +1104,9 @@ schedule_next_keepalive (struct MeshConnection *c, int fwd)
1104 * @param fwd Is this about fwd traffic? 1104 * @param fwd Is this about fwd traffic?
1105 */ 1105 */
1106static void 1106static void
1107connection_unlock_queue (struct MeshConnection *c, int fwd) 1107connection_unlock_queue (struct CadetConnection *c, int fwd)
1108{ 1108{
1109 struct MeshPeer *peer; 1109 struct CadetPeer *peer;
1110 1110
1111 LOG (GNUNET_ERROR_TYPE_DEBUG, 1111 LOG (GNUNET_ERROR_TYPE_DEBUG,
1112 "connection_unlock_queue %s on %s\n", 1112 "connection_unlock_queue %s on %s\n",
@@ -1133,10 +1133,10 @@ connection_unlock_queue (struct MeshConnection *c, int fwd)
1133 * @param fwd Cancel fwd traffic? 1133 * @param fwd Cancel fwd traffic?
1134 */ 1134 */
1135static void 1135static void
1136connection_cancel_queues (struct MeshConnection *c, int fwd) 1136connection_cancel_queues (struct CadetConnection *c, int fwd)
1137{ 1137{
1138 struct MeshFlowControl *fc; 1138 struct CadetFlowControl *fc;
1139 struct MeshPeer *peer; 1139 struct CadetPeer *peer;
1140 1140
1141 LOG (GNUNET_ERROR_TYPE_DEBUG, 1141 LOG (GNUNET_ERROR_TYPE_DEBUG,
1142 " *** Cancel %s queues for connection %s\n", 1142 " *** Cancel %s queues for connection %s\n",
@@ -1182,11 +1182,11 @@ connection_poll (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
1182 */ 1182 */
1183static void 1183static void
1184poll_sent (void *cls, 1184poll_sent (void *cls,
1185 struct MeshConnection *c, 1185 struct CadetConnection *c,
1186 struct MeshConnectionQueue *q, 1186 struct CadetConnectionQueue *q,
1187 uint16_t type, int fwd, size_t size) 1187 uint16_t type, int fwd, size_t size)
1188{ 1188{
1189 struct MeshFlowControl *fc = cls; 1189 struct CadetFlowControl *fc = cls;
1190 1190
1191 if (2 == c->destroy) 1191 if (2 == c->destroy)
1192 { 1192 {
@@ -1213,9 +1213,9 @@ poll_sent (void *cls,
1213static void 1213static void
1214connection_poll (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 1214connection_poll (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1215{ 1215{
1216 struct MeshFlowControl *fc = cls; 1216 struct CadetFlowControl *fc = cls;
1217 struct GNUNET_MESH_Poll msg; 1217 struct GNUNET_CADET_Poll msg;
1218 struct MeshConnection *c; 1218 struct CadetConnection *c;
1219 1219
1220 fc->poll_task = GNUNET_SCHEDULER_NO_TASK; 1220 fc->poll_task = GNUNET_SCHEDULER_NO_TASK;
1221 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 1221 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
@@ -1227,13 +1227,13 @@ connection_poll (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1227 LOG (GNUNET_ERROR_TYPE_DEBUG, " *** Polling connection %s %s\n", 1227 LOG (GNUNET_ERROR_TYPE_DEBUG, " *** Polling connection %s %s\n",
1228 GMC_2s (c), fc == &c->fwd_fc ? "FWD" : "BCK"); 1228 GMC_2s (c), fc == &c->fwd_fc ? "FWD" : "BCK");
1229 1229
1230 msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_POLL); 1230 msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_POLL);
1231 msg.header.size = htons (sizeof (msg)); 1231 msg.header.size = htons (sizeof (msg));
1232 msg.pid = htonl (fc->last_pid_sent); 1232 msg.pid = htonl (fc->last_pid_sent);
1233 LOG (GNUNET_ERROR_TYPE_DEBUG, " *** last pid sent: %u!\n", fc->last_pid_sent); 1233 LOG (GNUNET_ERROR_TYPE_DEBUG, " *** last pid sent: %u!\n", fc->last_pid_sent);
1234 fc->poll_msg = 1234 fc->poll_msg =
1235 GMC_send_prebuilt_message (&msg.header, 1235 GMC_send_prebuilt_message (&msg.header,
1236 GNUNET_MESSAGE_TYPE_MESH_POLL, 1236 GNUNET_MESSAGE_TYPE_CADET_POLL,
1237 fc->last_pid_sent, 1237 fc->last_pid_sent,
1238 c, fc == &c->fwd_fc, GNUNET_YES, 1238 c, fc == &c->fwd_fc, GNUNET_YES,
1239 &poll_sent, fc); 1239 &poll_sent, fc);
@@ -1251,7 +1251,7 @@ static void
1251connection_fwd_timeout (void *cls, 1251connection_fwd_timeout (void *cls,
1252 const struct GNUNET_SCHEDULER_TaskContext *tc) 1252 const struct GNUNET_SCHEDULER_TaskContext *tc)
1253{ 1253{
1254 struct MeshConnection *c = cls; 1254 struct CadetConnection *c = cls;
1255 1255
1256 c->fwd_maintenance_task = GNUNET_SCHEDULER_NO_TASK; 1256 c->fwd_maintenance_task = GNUNET_SCHEDULER_NO_TASK;
1257 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 1257 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
@@ -1280,7 +1280,7 @@ static void
1280connection_bck_timeout (void *cls, 1280connection_bck_timeout (void *cls,
1281 const struct GNUNET_SCHEDULER_TaskContext *tc) 1281 const struct GNUNET_SCHEDULER_TaskContext *tc)
1282{ 1282{
1283 struct MeshConnection *c = cls; 1283 struct CadetConnection *c = cls;
1284 1284
1285 c->bck_maintenance_task = GNUNET_SCHEDULER_NO_TASK; 1285 c->bck_maintenance_task = GNUNET_SCHEDULER_NO_TASK;
1286 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 1286 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
@@ -1314,7 +1314,7 @@ connection_bck_timeout (void *cls,
1314 * TODO use heap to improve efficiency of scheduler. 1314 * TODO use heap to improve efficiency of scheduler.
1315 */ 1315 */
1316static void 1316static void
1317connection_reset_timeout (struct MeshConnection *c, int fwd) 1317connection_reset_timeout (struct CadetConnection *c, int fwd)
1318{ 1318{
1319 LOG (GNUNET_ERROR_TYPE_DEBUG, "Connection %s reset timeout\n", GM_f2s (fwd)); 1319 LOG (GNUNET_ERROR_TYPE_DEBUG, "Connection %s reset timeout\n", GM_f2s (fwd));
1320 1320
@@ -1348,10 +1348,10 @@ connection_reset_timeout (struct MeshConnection *c, int fwd)
1348 * #GNUNET_SYSERR if the was an error and @c c is malformed. 1348 * #GNUNET_SYSERR if the was an error and @c c is malformed.
1349 */ 1349 */
1350static int 1350static int
1351register_neighbors (struct MeshConnection *c) 1351register_neighbors (struct CadetConnection *c)
1352{ 1352{
1353 struct MeshPeer *next_peer; 1353 struct CadetPeer *next_peer;
1354 struct MeshPeer *prev_peer; 1354 struct CadetPeer *prev_peer;
1355 1355
1356 next_peer = get_next_hop (c); 1356 next_peer = get_next_hop (c);
1357 prev_peer = get_prev_hop (c); 1357 prev_peer = get_prev_hop (c);
@@ -1395,15 +1395,15 @@ register_neighbors (struct MeshConnection *c)
1395 * @param c Connection. 1395 * @param c Connection.
1396 */ 1396 */
1397static void 1397static void
1398unregister_neighbors (struct MeshConnection *c) 1398unregister_neighbors (struct CadetConnection *c)
1399{ 1399{
1400 struct MeshPeer *peer; 1400 struct CadetPeer *peer;
1401 1401
1402 peer = get_next_hop (c); 1402 peer = get_next_hop (c);
1403 if (GNUNET_OK != GMP_remove_connection (peer, c)) 1403 if (GNUNET_OK != GMP_remove_connection (peer, c))
1404 { 1404 {
1405 GNUNET_assert (MESH_CONNECTION_NEW == c->state 1405 GNUNET_assert (CADET_CONNECTION_NEW == c->state
1406 || MESH_CONNECTION_DESTROYED == c->state); 1406 || CADET_CONNECTION_DESTROYED == c->state);
1407 LOG (GNUNET_ERROR_TYPE_DEBUG, " cstate: %u\n", c->state); 1407 LOG (GNUNET_ERROR_TYPE_DEBUG, " cstate: %u\n", c->state);
1408 if (NULL != c->t) GMT_debug (c->t); 1408 if (NULL != c->t) GMT_debug (c->t);
1409 } 1409 }
@@ -1411,8 +1411,8 @@ unregister_neighbors (struct MeshConnection *c)
1411 peer = get_prev_hop (c); 1411 peer = get_prev_hop (c);
1412 if (GNUNET_OK != GMP_remove_connection (peer, c)) 1412 if (GNUNET_OK != GMP_remove_connection (peer, c))
1413 { 1413 {
1414 GNUNET_assert (MESH_CONNECTION_NEW == c->state 1414 GNUNET_assert (CADET_CONNECTION_NEW == c->state
1415 || MESH_CONNECTION_DESTROYED == c->state); 1415 || CADET_CONNECTION_DESTROYED == c->state);
1416 LOG (GNUNET_ERROR_TYPE_DEBUG, " cstate: %u\n", c->state); 1416 LOG (GNUNET_ERROR_TYPE_DEBUG, " cstate: %u\n", c->state);
1417 if (NULL != c->t) GMT_debug (c->t); 1417 if (NULL != c->t) GMT_debug (c->t);
1418 } 1418 }
@@ -1429,7 +1429,7 @@ unregister_neighbors (struct MeshConnection *c)
1429 * @param peer Peer. 1429 * @param peer Peer.
1430 */ 1430 */
1431static void 1431static void
1432add_to_peer (struct MeshConnection *c, struct MeshPeer *peer) 1432add_to_peer (struct CadetConnection *c, struct CadetPeer *peer)
1433{ 1433{
1434 GMP_add_tunnel (peer); 1434 GMP_add_tunnel (peer);
1435 c->t = GMP_get_tunnel (peer); 1435 c->t = GMP_get_tunnel (peer);
@@ -1446,12 +1446,12 @@ add_to_peer (struct MeshConnection *c, struct MeshPeer *peer)
1446 * 1446 *
1447 * @return Fixed and shortened path. 1447 * @return Fixed and shortened path.
1448 */ 1448 */
1449static struct MeshPeerPath * 1449static struct CadetPeerPath *
1450build_path_from_peer_ids (struct GNUNET_PeerIdentity *peers, 1450build_path_from_peer_ids (struct GNUNET_PeerIdentity *peers,
1451 unsigned int size, 1451 unsigned int size,
1452 unsigned int *own_pos) 1452 unsigned int *own_pos)
1453{ 1453{
1454 struct MeshPeerPath *path; 1454 struct CadetPeerPath *path;
1455 GNUNET_PEER_Id shortid; 1455 GNUNET_PEER_Id shortid;
1456 unsigned int i; 1456 unsigned int i;
1457 unsigned int j; 1457 unsigned int j;
@@ -1508,7 +1508,7 @@ build_path_from_peer_ids (struct GNUNET_PeerIdentity *peers,
1508static void 1508static void
1509log_message (const struct GNUNET_MessageHeader *message, 1509log_message (const struct GNUNET_MessageHeader *message,
1510 const struct GNUNET_PeerIdentity *peer, 1510 const struct GNUNET_PeerIdentity *peer,
1511 const struct GNUNET_MESH_Hash *hash) 1511 const struct GNUNET_CADET_Hash *hash)
1512{ 1512{
1513 LOG (GNUNET_ERROR_TYPE_INFO, "<-- %s on connection %s from %s\n", 1513 LOG (GNUNET_ERROR_TYPE_INFO, "<-- %s on connection %s from %s\n",
1514 GM_m2s (ntohs (message->type)), GNUNET_h2s (GM_h2hc (hash)), 1514 GM_m2s (ntohs (message->type)), GNUNET_h2s (GM_h2hc (hash)),
@@ -1533,26 +1533,26 @@ int
1533GMC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer, 1533GMC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer,
1534 const struct GNUNET_MessageHeader *message) 1534 const struct GNUNET_MessageHeader *message)
1535{ 1535{
1536 struct GNUNET_MESH_ConnectionCreate *msg; 1536 struct GNUNET_CADET_ConnectionCreate *msg;
1537 struct GNUNET_PeerIdentity *id; 1537 struct GNUNET_PeerIdentity *id;
1538 struct GNUNET_MESH_Hash *cid; 1538 struct GNUNET_CADET_Hash *cid;
1539 struct MeshPeerPath *path; 1539 struct CadetPeerPath *path;
1540 struct MeshPeer *dest_peer; 1540 struct CadetPeer *dest_peer;
1541 struct MeshPeer *orig_peer; 1541 struct CadetPeer *orig_peer;
1542 struct MeshConnection *c; 1542 struct CadetConnection *c;
1543 unsigned int own_pos; 1543 unsigned int own_pos;
1544 uint16_t size; 1544 uint16_t size;
1545 1545
1546 /* Check size */ 1546 /* Check size */
1547 size = ntohs (message->size); 1547 size = ntohs (message->size);
1548 if (size < sizeof (struct GNUNET_MESH_ConnectionCreate)) 1548 if (size < sizeof (struct GNUNET_CADET_ConnectionCreate))
1549 { 1549 {
1550 GNUNET_break_op (0); 1550 GNUNET_break_op (0);
1551 return GNUNET_OK; 1551 return GNUNET_OK;
1552 } 1552 }
1553 1553
1554 /* Calculate hops */ 1554 /* Calculate hops */
1555 size -= sizeof (struct GNUNET_MESH_ConnectionCreate); 1555 size -= sizeof (struct GNUNET_CADET_ConnectionCreate);
1556 if (size % sizeof (struct GNUNET_PeerIdentity)) 1556 if (size % sizeof (struct GNUNET_PeerIdentity))
1557 { 1557 {
1558 GNUNET_break_op (0); 1558 GNUNET_break_op (0);
@@ -1567,7 +1567,7 @@ GMC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer,
1567 LOG (GNUNET_ERROR_TYPE_DEBUG, " path has %u hops.\n", size); 1567 LOG (GNUNET_ERROR_TYPE_DEBUG, " path has %u hops.\n", size);
1568 1568
1569 /* Get parameters */ 1569 /* Get parameters */
1570 msg = (struct GNUNET_MESH_ConnectionCreate *) message; 1570 msg = (struct GNUNET_CADET_ConnectionCreate *) message;
1571 cid = &msg->cid; 1571 cid = &msg->cid;
1572 log_message (message, peer, cid); 1572 log_message (message, peer, cid);
1573 id = (struct GNUNET_PeerIdentity *) &msg[1]; 1573 id = (struct GNUNET_PeerIdentity *) &msg[1];
@@ -1611,8 +1611,8 @@ GMC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer,
1611 { 1611 {
1612 path = path_duplicate (c->path); 1612 path = path_duplicate (c->path);
1613 } 1613 }
1614 if (MESH_CONNECTION_NEW == c->state) 1614 if (CADET_CONNECTION_NEW == c->state)
1615 connection_change_state (c, MESH_CONNECTION_SENT); 1615 connection_change_state (c, CADET_CONNECTION_SENT);
1616 1616
1617 /* Remember peers */ 1617 /* Remember peers */
1618 dest_peer = GMP_get (&id[size - 1]); 1618 dest_peer = GMP_get (&id[size - 1]);
@@ -1625,12 +1625,12 @@ GMC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer,
1625 GMP_add_path_to_origin (orig_peer, path_duplicate (path), GNUNET_YES); 1625 GMP_add_path_to_origin (orig_peer, path_duplicate (path), GNUNET_YES);
1626 1626
1627 add_to_peer (c, orig_peer); 1627 add_to_peer (c, orig_peer);
1628 if (MESH_TUNNEL3_NEW == GMT_get_cstate (c->t)) 1628 if (CADET_TUNNEL3_NEW == GMT_get_cstate (c->t))
1629 GMT_change_cstate (c->t, MESH_TUNNEL3_WAITING); 1629 GMT_change_cstate (c->t, CADET_TUNNEL3_WAITING);
1630 1630
1631 send_connection_ack (c, GNUNET_NO); 1631 send_connection_ack (c, GNUNET_NO);
1632 if (MESH_CONNECTION_SENT == c->state) 1632 if (CADET_CONNECTION_SENT == c->state)
1633 connection_change_state (c, MESH_CONNECTION_ACK); 1633 connection_change_state (c, CADET_CONNECTION_ACK);
1634 } 1634 }
1635 else 1635 else
1636 { 1636 {
@@ -1639,7 +1639,7 @@ GMC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer,
1639 GMP_add_path (dest_peer, path_duplicate (path), GNUNET_NO); 1639 GMP_add_path (dest_peer, path_duplicate (path), GNUNET_NO);
1640 GMP_add_path_to_origin (orig_peer, path_duplicate (path), GNUNET_NO); 1640 GMP_add_path_to_origin (orig_peer, path_duplicate (path), GNUNET_NO);
1641 GMC_send_prebuilt_message (message, 1641 GMC_send_prebuilt_message (message,
1642 GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE, 0, 1642 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE, 0,
1643 c, GNUNET_YES, GNUNET_YES, 1643 c, GNUNET_YES, GNUNET_YES,
1644 NULL, NULL); 1644 NULL, NULL);
1645 } 1645 }
@@ -1662,14 +1662,14 @@ int
1662GMC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer, 1662GMC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer,
1663 const struct GNUNET_MessageHeader *message) 1663 const struct GNUNET_MessageHeader *message)
1664{ 1664{
1665 struct GNUNET_MESH_ConnectionACK *msg; 1665 struct GNUNET_CADET_ConnectionACK *msg;
1666 struct MeshConnection *c; 1666 struct CadetConnection *c;
1667 struct MeshPeerPath *p; 1667 struct CadetPeerPath *p;
1668 struct MeshPeer *pi; 1668 struct CadetPeer *pi;
1669 enum MeshConnectionState oldstate; 1669 enum CadetConnectionState oldstate;
1670 int fwd; 1670 int fwd;
1671 1671
1672 msg = (struct GNUNET_MESH_ConnectionACK *) message; 1672 msg = (struct GNUNET_CADET_ConnectionACK *) message;
1673 log_message (message, peer, &msg->cid); 1673 log_message (message, peer, &msg->cid);
1674 c = connection_get (&msg->cid); 1674 c = connection_get (&msg->cid);
1675 if (NULL == c) 1675 if (NULL == c)
@@ -1694,14 +1694,14 @@ GMC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer,
1694 { 1694 {
1695 LOG (GNUNET_ERROR_TYPE_DEBUG, " SYNACK\n"); 1695 LOG (GNUNET_ERROR_TYPE_DEBUG, " SYNACK\n");
1696 fwd = GNUNET_NO; 1696 fwd = GNUNET_NO;
1697 if (MESH_CONNECTION_SENT == oldstate) 1697 if (CADET_CONNECTION_SENT == oldstate)
1698 connection_change_state (c, MESH_CONNECTION_ACK); 1698 connection_change_state (c, CADET_CONNECTION_ACK);
1699 } 1699 }
1700 else if (get_prev_hop (c) == pi) 1700 else if (get_prev_hop (c) == pi)
1701 { 1701 {
1702 LOG (GNUNET_ERROR_TYPE_DEBUG, " ACK\n"); 1702 LOG (GNUNET_ERROR_TYPE_DEBUG, " ACK\n");
1703 fwd = GNUNET_YES; 1703 fwd = GNUNET_YES;
1704 connection_change_state (c, MESH_CONNECTION_READY); 1704 connection_change_state (c, CADET_CONNECTION_READY);
1705 } 1705 }
1706 else 1706 else
1707 { 1707 {
@@ -1733,16 +1733,16 @@ GMC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer,
1733 LOG (GNUNET_ERROR_TYPE_DEBUG, " Connection (SYN)ACK for us!\n"); 1733 LOG (GNUNET_ERROR_TYPE_DEBUG, " Connection (SYN)ACK for us!\n");
1734 1734
1735 /* If just created, cancel the short timeout and start a long one */ 1735 /* If just created, cancel the short timeout and start a long one */
1736 if (MESH_CONNECTION_SENT == oldstate) 1736 if (CADET_CONNECTION_SENT == oldstate)
1737 connection_reset_timeout (c, GNUNET_YES); 1737 connection_reset_timeout (c, GNUNET_YES);
1738 1738
1739 /* Change connection state */ 1739 /* Change connection state */
1740 connection_change_state (c, MESH_CONNECTION_READY); 1740 connection_change_state (c, CADET_CONNECTION_READY);
1741 send_connection_ack (c, GNUNET_YES); 1741 send_connection_ack (c, GNUNET_YES);
1742 1742
1743 /* Change tunnel state, trigger KX */ 1743 /* Change tunnel state, trigger KX */
1744 if (MESH_TUNNEL3_WAITING == GMT_get_cstate (c->t)) 1744 if (CADET_TUNNEL3_WAITING == GMT_get_cstate (c->t))
1745 GMT_change_cstate (c->t, MESH_TUNNEL3_READY); 1745 GMT_change_cstate (c->t, CADET_TUNNEL3_READY);
1746 1746
1747 return GNUNET_OK; 1747 return GNUNET_OK;
1748 } 1748 }
@@ -1758,19 +1758,19 @@ GMC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer,
1758 LOG (GNUNET_ERROR_TYPE_DEBUG, " Connection ACK for us!\n"); 1758 LOG (GNUNET_ERROR_TYPE_DEBUG, " Connection ACK for us!\n");
1759 1759
1760 /* If just created, cancel the short timeout and start a long one */ 1760 /* If just created, cancel the short timeout and start a long one */
1761 if (MESH_CONNECTION_ACK == oldstate) 1761 if (CADET_CONNECTION_ACK == oldstate)
1762 connection_reset_timeout (c, GNUNET_NO); 1762 connection_reset_timeout (c, GNUNET_NO);
1763 1763
1764 /* Change tunnel state */ 1764 /* Change tunnel state */
1765 if (MESH_TUNNEL3_WAITING == GMT_get_cstate (c->t)) 1765 if (CADET_TUNNEL3_WAITING == GMT_get_cstate (c->t))
1766 GMT_change_cstate (c->t, MESH_TUNNEL3_READY); 1766 GMT_change_cstate (c->t, CADET_TUNNEL3_READY);
1767 1767
1768 return GNUNET_OK; 1768 return GNUNET_OK;
1769 } 1769 }
1770 1770
1771 LOG (GNUNET_ERROR_TYPE_DEBUG, " not for us, retransmitting...\n"); 1771 LOG (GNUNET_ERROR_TYPE_DEBUG, " not for us, retransmitting...\n");
1772 GMC_send_prebuilt_message (message, 1772 GMC_send_prebuilt_message (message,
1773 GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK, 0, 1773 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK, 0,
1774 c, fwd, GNUNET_YES, NULL, NULL); 1774 c, fwd, GNUNET_YES, NULL, NULL);
1775 return GNUNET_OK; 1775 return GNUNET_OK;
1776} 1776}
@@ -1791,11 +1791,11 @@ GMC_handle_broken (void* cls,
1791 const struct GNUNET_PeerIdentity* id, 1791 const struct GNUNET_PeerIdentity* id,
1792 const struct GNUNET_MessageHeader* message) 1792 const struct GNUNET_MessageHeader* message)
1793{ 1793{
1794 struct GNUNET_MESH_ConnectionBroken *msg; 1794 struct GNUNET_CADET_ConnectionBroken *msg;
1795 struct MeshConnection *c; 1795 struct CadetConnection *c;
1796 int fwd; 1796 int fwd;
1797 1797
1798 msg = (struct GNUNET_MESH_ConnectionBroken *) message; 1798 msg = (struct GNUNET_CADET_ConnectionBroken *) message;
1799 log_message (message, id, &msg->cid); 1799 log_message (message, id, &msg->cid);
1800 LOG (GNUNET_ERROR_TYPE_DEBUG, " regarding %s\n", 1800 LOG (GNUNET_ERROR_TYPE_DEBUG, " regarding %s\n",
1801 GNUNET_i2s (&msg->peer1)); 1801 GNUNET_i2s (&msg->peer1));
@@ -1812,14 +1812,14 @@ GMC_handle_broken (void* cls,
1812 if (GMC_is_terminal (c, fwd)) 1812 if (GMC_is_terminal (c, fwd))
1813 { 1813 {
1814 struct GNUNET_MessageHeader *out_msg; 1814 struct GNUNET_MessageHeader *out_msg;
1815 struct MeshPeer *neighbor; 1815 struct CadetPeer *neighbor;
1816 struct MeshPeer *endpoint; 1816 struct CadetPeer *endpoint;
1817 1817
1818 neighbor = get_hop (c, !fwd); 1818 neighbor = get_hop (c, !fwd);
1819 endpoint = GMP_get_short (c->path->peers[c->path->length - 1]); 1819 endpoint = GMP_get_short (c->path->peers[c->path->length - 1]);
1820 path_invalidate (c->path); 1820 path_invalidate (c->path);
1821 GMP_notify_broken_link (endpoint, &msg->peer1, &msg->peer2); 1821 GMP_notify_broken_link (endpoint, &msg->peer1, &msg->peer2);
1822 c->state = MESH_CONNECTION_DESTROYED; 1822 c->state = CADET_CONNECTION_DESTROYED;
1823 while (NULL != (out_msg = GMP_connection_pop (neighbor, c))) 1823 while (NULL != (out_msg = GMP_connection_pop (neighbor, c)))
1824 { 1824 {
1825 GNUNET_assert (NULL == 1825 GNUNET_assert (NULL ==
@@ -1832,7 +1832,7 @@ GMC_handle_broken (void* cls,
1832 else 1832 else
1833 { 1833 {
1834 GMC_send_prebuilt_message (message, 1834 GMC_send_prebuilt_message (message,
1835 GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN, 0, 1835 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN, 0,
1836 c, fwd, GNUNET_YES, NULL, NULL); 1836 c, fwd, GNUNET_YES, NULL, NULL);
1837 c->destroy = GNUNET_YES; 1837 c->destroy = GNUNET_YES;
1838 connection_cancel_queues (c, !fwd); 1838 connection_cancel_queues (c, !fwd);
@@ -1857,11 +1857,11 @@ int
1857GMC_handle_destroy (void *cls, const struct GNUNET_PeerIdentity *peer, 1857GMC_handle_destroy (void *cls, const struct GNUNET_PeerIdentity *peer,
1858 const struct GNUNET_MessageHeader *message) 1858 const struct GNUNET_MessageHeader *message)
1859{ 1859{
1860 struct GNUNET_MESH_ConnectionDestroy *msg; 1860 struct GNUNET_CADET_ConnectionDestroy *msg;
1861 struct MeshConnection *c; 1861 struct CadetConnection *c;
1862 int fwd; 1862 int fwd;
1863 1863
1864 msg = (struct GNUNET_MESH_ConnectionDestroy *) message; 1864 msg = (struct GNUNET_CADET_ConnectionDestroy *) message;
1865 log_message (message, peer, &msg->cid); 1865 log_message (message, peer, &msg->cid);
1866 c = connection_get (&msg->cid); 1866 c = connection_get (&msg->cid);
1867 if (NULL == c) 1867 if (NULL == c)
@@ -1883,7 +1883,7 @@ GMC_handle_destroy (void *cls, const struct GNUNET_PeerIdentity *peer,
1883 } 1883 }
1884 if (GNUNET_NO == GMC_is_terminal (c, fwd)) 1884 if (GNUNET_NO == GMC_is_terminal (c, fwd))
1885 GMC_send_prebuilt_message (message, 1885 GMC_send_prebuilt_message (message,
1886 GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY, 0, 1886 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY, 0,
1887 c, fwd, GNUNET_YES, NULL, NULL); 1887 c, fwd, GNUNET_YES, NULL, NULL);
1888 else if (0 == c->pending_messages) 1888 else if (0 == c->pending_messages)
1889 { 1889 {
@@ -1892,7 +1892,7 @@ GMC_handle_destroy (void *cls, const struct GNUNET_PeerIdentity *peer,
1892 return GNUNET_OK; 1892 return GNUNET_OK;
1893 } 1893 }
1894 c->destroy = GNUNET_YES; 1894 c->destroy = GNUNET_YES;
1895 c->state = MESH_CONNECTION_DESTROYED; 1895 c->state = CADET_CONNECTION_DESTROYED;
1896 if (NULL != c->t) 1896 if (NULL != c->t)
1897 { 1897 {
1898 GMT_remove_connection (c->t, c); 1898 GMT_remove_connection (c->t, c);
@@ -1903,7 +1903,7 @@ GMC_handle_destroy (void *cls, const struct GNUNET_PeerIdentity *peer,
1903} 1903}
1904 1904
1905/** 1905/**
1906 * Generic handler for mesh network encrypted traffic. 1906 * Generic handler for cadet network encrypted traffic.
1907 * 1907 *
1908 * @param peer Peer identity this notification is about. 1908 * @param peer Peer identity this notification is about.
1909 * @param msg Encrypted message. 1909 * @param msg Encrypted message.
@@ -1912,12 +1912,12 @@ GMC_handle_destroy (void *cls, const struct GNUNET_PeerIdentity *peer,
1912 * GNUNET_SYSERR to close it (signal serious error) 1912 * GNUNET_SYSERR to close it (signal serious error)
1913 */ 1913 */
1914static int 1914static int
1915handle_mesh_encrypted (const struct GNUNET_PeerIdentity *peer, 1915handle_cadet_encrypted (const struct GNUNET_PeerIdentity *peer,
1916 const struct GNUNET_MESH_Encrypted *msg) 1916 const struct GNUNET_CADET_Encrypted *msg)
1917{ 1917{
1918 struct MeshConnection *c; 1918 struct CadetConnection *c;
1919 struct MeshPeer *neighbor; 1919 struct CadetPeer *neighbor;
1920 struct MeshFlowControl *fc; 1920 struct CadetFlowControl *fc;
1921 GNUNET_PEER_Id peer_id; 1921 GNUNET_PEER_Id peer_id;
1922 uint32_t pid; 1922 uint32_t pid;
1923 uint32_t ttl; 1923 uint32_t ttl;
@@ -1929,7 +1929,7 @@ handle_mesh_encrypted (const struct GNUNET_PeerIdentity *peer,
1929 /* Check size */ 1929 /* Check size */
1930 size = ntohs (msg->header.size); 1930 size = ntohs (msg->header.size);
1931 if (size < 1931 if (size <
1932 sizeof (struct GNUNET_MESH_Encrypted) + 1932 sizeof (struct GNUNET_CADET_Encrypted) +
1933 sizeof (struct GNUNET_MessageHeader)) 1933 sizeof (struct GNUNET_MessageHeader))
1934 { 1934 {
1935 GNUNET_break_op (0); 1935 GNUNET_break_op (0);
@@ -1993,8 +1993,8 @@ handle_mesh_encrypted (const struct GNUNET_PeerIdentity *peer,
1993 pid, fc->last_pid_recv + 1); 1993 pid, fc->last_pid_recv + 1);
1994 return GNUNET_OK; 1994 return GNUNET_OK;
1995 } 1995 }
1996 if (MESH_CONNECTION_SENT == c->state || MESH_CONNECTION_ACK == c->state) 1996 if (CADET_CONNECTION_SENT == c->state || CADET_CONNECTION_ACK == c->state)
1997 connection_change_state (c, MESH_CONNECTION_READY); 1997 connection_change_state (c, CADET_CONNECTION_READY);
1998 connection_reset_timeout (c, fwd); 1998 connection_reset_timeout (c, fwd);
1999 fc->last_pid_recv = pid; 1999 fc->last_pid_recv = pid;
2000 2000
@@ -2029,14 +2029,14 @@ handle_mesh_encrypted (const struct GNUNET_PeerIdentity *peer,
2029 2029
2030 GNUNET_STATISTICS_update (stats, "# messages forwarded", 1, GNUNET_NO); 2030 GNUNET_STATISTICS_update (stats, "# messages forwarded", 1, GNUNET_NO);
2031 GMC_send_prebuilt_message (&msg->header, 2031 GMC_send_prebuilt_message (&msg->header,
2032 GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED, 0, 2032 GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED, 0,
2033 c, fwd, GNUNET_NO, NULL, NULL); 2033 c, fwd, GNUNET_NO, NULL, NULL);
2034 2034
2035 return GNUNET_OK; 2035 return GNUNET_OK;
2036} 2036}
2037 2037
2038/** 2038/**
2039 * Generic handler for mesh network encrypted traffic. 2039 * Generic handler for cadet network encrypted traffic.
2040 * 2040 *
2041 * @param peer Peer identity this notification is about. 2041 * @param peer Peer identity this notification is about.
2042 * @param msg Encrypted message. 2042 * @param msg Encrypted message.
@@ -2045,11 +2045,11 @@ handle_mesh_encrypted (const struct GNUNET_PeerIdentity *peer,
2045 * GNUNET_SYSERR to close it (signal serious error) 2045 * GNUNET_SYSERR to close it (signal serious error)
2046 */ 2046 */
2047static int 2047static int
2048handle_mesh_kx (const struct GNUNET_PeerIdentity *peer, 2048handle_cadet_kx (const struct GNUNET_PeerIdentity *peer,
2049 const struct GNUNET_MESH_KX *msg) 2049 const struct GNUNET_CADET_KX *msg)
2050{ 2050{
2051 struct MeshConnection *c; 2051 struct CadetConnection *c;
2052 struct MeshPeer *neighbor; 2052 struct CadetPeer *neighbor;
2053 GNUNET_PEER_Id peer_id; 2053 GNUNET_PEER_Id peer_id;
2054 size_t size; 2054 size_t size;
2055 int fwd; 2055 int fwd;
@@ -2059,7 +2059,7 @@ handle_mesh_kx (const struct GNUNET_PeerIdentity *peer,
2059 /* Check size */ 2059 /* Check size */
2060 size = ntohs (msg->header.size); 2060 size = ntohs (msg->header.size);
2061 if (size < 2061 if (size <
2062 sizeof (struct GNUNET_MESH_KX) + 2062 sizeof (struct GNUNET_CADET_KX) +
2063 sizeof (struct GNUNET_MessageHeader)) 2063 sizeof (struct GNUNET_MessageHeader))
2064 { 2064 {
2065 GNUNET_break_op (0); 2065 GNUNET_break_op (0);
@@ -2101,13 +2101,13 @@ handle_mesh_kx (const struct GNUNET_PeerIdentity *peer,
2101 } 2101 }
2102 2102
2103 /* Count as connection confirmation. */ 2103 /* Count as connection confirmation. */
2104 if (MESH_CONNECTION_SENT == c->state || MESH_CONNECTION_ACK == c->state) 2104 if (CADET_CONNECTION_SENT == c->state || CADET_CONNECTION_ACK == c->state)
2105 { 2105 {
2106 connection_change_state (c, MESH_CONNECTION_READY); 2106 connection_change_state (c, CADET_CONNECTION_READY);
2107 if (NULL != c->t) 2107 if (NULL != c->t)
2108 { 2108 {
2109 if (MESH_TUNNEL3_WAITING == GMT_get_cstate (c->t)) 2109 if (CADET_TUNNEL3_WAITING == GMT_get_cstate (c->t))
2110 GMT_change_cstate (c->t, MESH_TUNNEL3_READY); 2110 GMT_change_cstate (c->t, CADET_TUNNEL3_READY);
2111 } 2111 }
2112 } 2112 }
2113 connection_reset_timeout (c, fwd); 2113 connection_reset_timeout (c, fwd);
@@ -2129,7 +2129,7 @@ handle_mesh_kx (const struct GNUNET_PeerIdentity *peer,
2129 /* Message not for us: forward to next hop */ 2129 /* Message not for us: forward to next hop */
2130 LOG (GNUNET_ERROR_TYPE_DEBUG, " not for us, retransmitting...\n"); 2130 LOG (GNUNET_ERROR_TYPE_DEBUG, " not for us, retransmitting...\n");
2131 GNUNET_STATISTICS_update (stats, "# messages forwarded", 1, GNUNET_NO); 2131 GNUNET_STATISTICS_update (stats, "# messages forwarded", 1, GNUNET_NO);
2132 GMC_send_prebuilt_message (&msg->header, GNUNET_MESSAGE_TYPE_MESH_KX, 0, 2132 GMC_send_prebuilt_message (&msg->header, GNUNET_MESSAGE_TYPE_CADET_KX, 0,
2133 c, fwd, GNUNET_NO, NULL, NULL); 2133 c, fwd, GNUNET_NO, NULL, NULL);
2134 2134
2135 return GNUNET_OK; 2135 return GNUNET_OK;
@@ -2137,7 +2137,7 @@ handle_mesh_kx (const struct GNUNET_PeerIdentity *peer,
2137 2137
2138 2138
2139/** 2139/**
2140 * Core handler for encrypted mesh network traffic (channel mgmt, data). 2140 * Core handler for encrypted cadet network traffic (channel mgmt, data).
2141 * 2141 *
2142 * @param cls Closure (unused). 2142 * @param cls Closure (unused).
2143 * @param message Message received. 2143 * @param message Message received.
@@ -2150,8 +2150,8 @@ int
2150GMC_handle_encrypted (void *cls, const struct GNUNET_PeerIdentity *peer, 2150GMC_handle_encrypted (void *cls, const struct GNUNET_PeerIdentity *peer,
2151 const struct GNUNET_MessageHeader *message) 2151 const struct GNUNET_MessageHeader *message)
2152{ 2152{
2153 return handle_mesh_encrypted (peer, 2153 return handle_cadet_encrypted (peer,
2154 (struct GNUNET_MESH_Encrypted *)message); 2154 (struct GNUNET_CADET_Encrypted *)message);
2155} 2155}
2156 2156
2157 2157
@@ -2169,13 +2169,13 @@ int
2169GMC_handle_kx (void *cls, const struct GNUNET_PeerIdentity *peer, 2169GMC_handle_kx (void *cls, const struct GNUNET_PeerIdentity *peer,
2170 const struct GNUNET_MessageHeader *message) 2170 const struct GNUNET_MessageHeader *message)
2171{ 2171{
2172 return handle_mesh_kx (peer, 2172 return handle_cadet_kx (peer,
2173 (struct GNUNET_MESH_KX *) message); 2173 (struct GNUNET_CADET_KX *) message);
2174} 2174}
2175 2175
2176 2176
2177/** 2177/**
2178 * Core handler for mesh network traffic point-to-point acks. 2178 * Core handler for cadet network traffic point-to-point acks.
2179 * 2179 *
2180 * @param cls closure 2180 * @param cls closure
2181 * @param message message 2181 * @param message message
@@ -2188,14 +2188,14 @@ int
2188GMC_handle_ack (void *cls, const struct GNUNET_PeerIdentity *peer, 2188GMC_handle_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
2189 const struct GNUNET_MessageHeader *message) 2189 const struct GNUNET_MessageHeader *message)
2190{ 2190{
2191 struct GNUNET_MESH_ACK *msg; 2191 struct GNUNET_CADET_ACK *msg;
2192 struct MeshConnection *c; 2192 struct CadetConnection *c;
2193 struct MeshFlowControl *fc; 2193 struct CadetFlowControl *fc;
2194 GNUNET_PEER_Id id; 2194 GNUNET_PEER_Id id;
2195 uint32_t ack; 2195 uint32_t ack;
2196 int fwd; 2196 int fwd;
2197 2197
2198 msg = (struct GNUNET_MESH_ACK *) message; 2198 msg = (struct GNUNET_CADET_ACK *) message;
2199 log_message (message, peer, &msg->cid); 2199 log_message (message, peer, &msg->cid);
2200 c = connection_get (&msg->cid); 2200 c = connection_get (&msg->cid);
2201 if (NULL == c) 2201 if (NULL == c)
@@ -2249,7 +2249,7 @@ GMC_handle_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
2249 2249
2250 2250
2251/** 2251/**
2252 * Core handler for mesh network traffic point-to-point ack polls. 2252 * Core handler for cadet network traffic point-to-point ack polls.
2253 * 2253 *
2254 * @param cls closure 2254 * @param cls closure
2255 * @param message message 2255 * @param message message
@@ -2262,14 +2262,14 @@ int
2262GMC_handle_poll (void *cls, const struct GNUNET_PeerIdentity *peer, 2262GMC_handle_poll (void *cls, const struct GNUNET_PeerIdentity *peer,
2263 const struct GNUNET_MessageHeader *message) 2263 const struct GNUNET_MessageHeader *message)
2264{ 2264{
2265 struct GNUNET_MESH_Poll *msg; 2265 struct GNUNET_CADET_Poll *msg;
2266 struct MeshConnection *c; 2266 struct CadetConnection *c;
2267 struct MeshFlowControl *fc; 2267 struct CadetFlowControl *fc;
2268 GNUNET_PEER_Id id; 2268 GNUNET_PEER_Id id;
2269 uint32_t pid; 2269 uint32_t pid;
2270 int fwd; 2270 int fwd;
2271 2271
2272 msg = (struct GNUNET_MESH_Poll *) message; 2272 msg = (struct GNUNET_CADET_Poll *) message;
2273 log_message (message, peer, &msg->cid); 2273 log_message (message, peer, &msg->cid);
2274 c = connection_get (&msg->cid); 2274 c = connection_get (&msg->cid);
2275 if (NULL == c) 2275 if (NULL == c)
@@ -2323,7 +2323,7 @@ GMC_handle_poll (void *cls, const struct GNUNET_PeerIdentity *peer,
2323 * @param force Send the ACK even if suboptimal (e.g. requested by POLL). 2323 * @param force Send the ACK even if suboptimal (e.g. requested by POLL).
2324 */ 2324 */
2325void 2325void
2326GMC_send_ack (struct MeshConnection *c, int fwd, int force) 2326GMC_send_ack (struct CadetConnection *c, int fwd, int force)
2327{ 2327{
2328 unsigned int buffer; 2328 unsigned int buffer;
2329 2329
@@ -2383,31 +2383,31 @@ GMC_init (const struct GNUNET_CONFIGURATION_Handle *c)
2383{ 2383{
2384 LOG (GNUNET_ERROR_TYPE_DEBUG, "init\n"); 2384 LOG (GNUNET_ERROR_TYPE_DEBUG, "init\n");
2385 if (GNUNET_OK != 2385 if (GNUNET_OK !=
2386 GNUNET_CONFIGURATION_get_value_number (c, "MESH", "MAX_MSGS_QUEUE", 2386 GNUNET_CONFIGURATION_get_value_number (c, "CADET", "MAX_MSGS_QUEUE",
2387 &max_msgs_queue)) 2387 &max_msgs_queue))
2388 { 2388 {
2389 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, 2389 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
2390 "MESH", "MAX_MSGS_QUEUE", "MISSING"); 2390 "CADET", "MAX_MSGS_QUEUE", "MISSING");
2391 GNUNET_SCHEDULER_shutdown (); 2391 GNUNET_SCHEDULER_shutdown ();
2392 return; 2392 return;
2393 } 2393 }
2394 2394
2395 if (GNUNET_OK != 2395 if (GNUNET_OK !=
2396 GNUNET_CONFIGURATION_get_value_number (c, "MESH", "MAX_CONNECTIONS", 2396 GNUNET_CONFIGURATION_get_value_number (c, "CADET", "MAX_CONNECTIONS",
2397 &max_connections)) 2397 &max_connections))
2398 { 2398 {
2399 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, 2399 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
2400 "MESH", "MAX_CONNECTIONS", "MISSING"); 2400 "CADET", "MAX_CONNECTIONS", "MISSING");
2401 GNUNET_SCHEDULER_shutdown (); 2401 GNUNET_SCHEDULER_shutdown ();
2402 return; 2402 return;
2403 } 2403 }
2404 2404
2405 if (GNUNET_OK != 2405 if (GNUNET_OK !=
2406 GNUNET_CONFIGURATION_get_value_time (c, "MESH", "REFRESH_CONNECTION_TIME", 2406 GNUNET_CONFIGURATION_get_value_time (c, "CADET", "REFRESH_CONNECTION_TIME",
2407 &refresh_connection_time)) 2407 &refresh_connection_time))
2408 { 2408 {
2409 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, 2409 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
2410 "MESH", "REFRESH_CONNECTION_TIME", "MISSING"); 2410 "CADET", "REFRESH_CONNECTION_TIME", "MISSING");
2411 GNUNET_SCHEDULER_shutdown (); 2411 GNUNET_SCHEDULER_shutdown ();
2412 return; 2412 return;
2413 } 2413 }
@@ -2430,7 +2430,7 @@ shutdown_iterator (void *cls,
2430 const struct GNUNET_HashCode *key, 2430 const struct GNUNET_HashCode *key,
2431 void *value) 2431 void *value)
2432{ 2432{
2433 struct MeshConnection *c = value; 2433 struct CadetConnection *c = value;
2434 2434
2435 GMC_destroy (c); 2435 GMC_destroy (c);
2436 return GNUNET_YES; 2436 return GNUNET_YES;
@@ -2449,15 +2449,15 @@ GMC_shutdown (void)
2449} 2449}
2450 2450
2451 2451
2452struct MeshConnection * 2452struct CadetConnection *
2453GMC_new (const struct GNUNET_MESH_Hash *cid, 2453GMC_new (const struct GNUNET_CADET_Hash *cid,
2454 struct MeshTunnel3 *t, 2454 struct CadetTunnel3 *t,
2455 struct MeshPeerPath *p, 2455 struct CadetPeerPath *p,
2456 unsigned int own_pos) 2456 unsigned int own_pos)
2457{ 2457{
2458 struct MeshConnection *c; 2458 struct CadetConnection *c;
2459 2459
2460 c = GNUNET_new (struct MeshConnection); 2460 c = GNUNET_new (struct CadetConnection);
2461 c->id = *cid; 2461 c->id = *cid;
2462 GNUNET_assert (GNUNET_OK == 2462 GNUNET_assert (GNUNET_OK ==
2463 GNUNET_CONTAINER_multihashmap_put (connections, 2463 GNUNET_CONTAINER_multihashmap_put (connections,
@@ -2491,7 +2491,7 @@ GMC_new (const struct GNUNET_MESH_Hash *cid,
2491 2491
2492 2492
2493void 2493void
2494GMC_destroy (struct MeshConnection *c) 2494GMC_destroy (struct CadetConnection *c)
2495{ 2495{
2496 if (NULL == c) 2496 if (NULL == c)
2497 { 2497 {
@@ -2568,8 +2568,8 @@ GMC_destroy (struct MeshConnection *c)
2568 * 2568 *
2569 * @return ID of the connection. 2569 * @return ID of the connection.
2570 */ 2570 */
2571const struct GNUNET_MESH_Hash * 2571const struct GNUNET_CADET_Hash *
2572GMC_get_id (const struct MeshConnection *c) 2572GMC_get_id (const struct CadetConnection *c)
2573{ 2573{
2574 return &c->id; 2574 return &c->id;
2575} 2575}
@@ -2583,7 +2583,7 @@ GMC_get_id (const struct MeshConnection *c)
2583 * @return ID of the connection. 2583 * @return ID of the connection.
2584 */ 2584 */
2585const struct GNUNET_HashCode * 2585const struct GNUNET_HashCode *
2586GMC_get_h (const struct MeshConnection *c) 2586GMC_get_h (const struct CadetConnection *c)
2587{ 2587{
2588 return GM_h2hc (&c->id); 2588 return GM_h2hc (&c->id);
2589} 2589}
@@ -2596,8 +2596,8 @@ GMC_get_h (const struct MeshConnection *c)
2596 * 2596 *
2597 * @return path used by the connection. 2597 * @return path used by the connection.
2598 */ 2598 */
2599const struct MeshPeerPath * 2599const struct CadetPeerPath *
2600GMC_get_path (const struct MeshConnection *c) 2600GMC_get_path (const struct CadetConnection *c)
2601{ 2601{
2602 if (GNUNET_NO == c->destroy) 2602 if (GNUNET_NO == c->destroy)
2603 return c->path; 2603 return c->path;
@@ -2612,8 +2612,8 @@ GMC_get_path (const struct MeshConnection *c)
2612 * 2612 *
2613 * @return state of the connection. 2613 * @return state of the connection.
2614 */ 2614 */
2615enum MeshConnectionState 2615enum CadetConnectionState
2616GMC_get_state (const struct MeshConnection *c) 2616GMC_get_state (const struct CadetConnection *c)
2617{ 2617{
2618 return c->state; 2618 return c->state;
2619} 2619}
@@ -2625,8 +2625,8 @@ GMC_get_state (const struct MeshConnection *c)
2625 * 2625 *
2626 * @return tunnel of the connection. 2626 * @return tunnel of the connection.
2627 */ 2627 */
2628struct MeshTunnel3 * 2628struct CadetTunnel3 *
2629GMC_get_tunnel (const struct MeshConnection *c) 2629GMC_get_tunnel (const struct CadetConnection *c)
2630{ 2630{
2631 return c->t; 2631 return c->t;
2632} 2632}
@@ -2641,9 +2641,9 @@ GMC_get_tunnel (const struct MeshConnection *c)
2641 * @return Free buffer space [0 - max_msgs_queue/max_connections] 2641 * @return Free buffer space [0 - max_msgs_queue/max_connections]
2642 */ 2642 */
2643unsigned int 2643unsigned int
2644GMC_get_buffer (struct MeshConnection *c, int fwd) 2644GMC_get_buffer (struct CadetConnection *c, int fwd)
2645{ 2645{
2646 struct MeshFlowControl *fc; 2646 struct CadetFlowControl *fc;
2647 2647
2648 fc = fwd ? &c->fwd_fc : &c->bck_fc; 2648 fc = fwd ? &c->fwd_fc : &c->bck_fc;
2649 2649
@@ -2659,9 +2659,9 @@ GMC_get_buffer (struct MeshConnection *c, int fwd)
2659 * @return last_ack_sent - last_pid_recv 2659 * @return last_ack_sent - last_pid_recv
2660 */ 2660 */
2661unsigned int 2661unsigned int
2662GMC_get_allowed (struct MeshConnection *c, int fwd) 2662GMC_get_allowed (struct CadetConnection *c, int fwd)
2663{ 2663{
2664 struct MeshFlowControl *fc; 2664 struct CadetFlowControl *fc;
2665 2665
2666 fc = fwd ? &c->fwd_fc : &c->bck_fc; 2666 fc = fwd ? &c->fwd_fc : &c->bck_fc;
2667 if (GM_is_pid_bigger(fc->last_pid_recv, fc->last_ack_sent)) 2667 if (GM_is_pid_bigger(fc->last_pid_recv, fc->last_ack_sent))
@@ -2680,9 +2680,9 @@ GMC_get_allowed (struct MeshConnection *c, int fwd)
2680 * @return Number of messages queued. 2680 * @return Number of messages queued.
2681 */ 2681 */
2682unsigned int 2682unsigned int
2683GMC_get_qn (struct MeshConnection *c, int fwd) 2683GMC_get_qn (struct CadetConnection *c, int fwd)
2684{ 2684{
2685 struct MeshFlowControl *fc; 2685 struct CadetFlowControl *fc;
2686 2686
2687 fc = fwd ? &c->fwd_fc : &c->bck_fc; 2687 fc = fwd ? &c->fwd_fc : &c->bck_fc;
2688 2688
@@ -2699,9 +2699,9 @@ GMC_get_qn (struct MeshConnection *c, int fwd)
2699 * @return Last PID used + 1. 2699 * @return Last PID used + 1.
2700 */ 2700 */
2701unsigned int 2701unsigned int
2702GMC_get_pid (struct MeshConnection *c, int fwd) 2702GMC_get_pid (struct CadetConnection *c, int fwd)
2703{ 2703{
2704 struct MeshFlowControl *fc; 2704 struct CadetFlowControl *fc;
2705 2705
2706 fc = fwd ? &c->fwd_fc : &c->bck_fc; 2706 fc = fwd ? &c->fwd_fc : &c->bck_fc;
2707 2707
@@ -2720,7 +2720,7 @@ GMC_get_pid (struct MeshConnection *c, int fwd)
2720 * @param fwd Is this about FWD traffic? (The ack will go dest->root). 2720 * @param fwd Is this about FWD traffic? (The ack will go dest->root).
2721 */ 2721 */
2722void 2722void
2723GMC_allow (struct MeshConnection *c, unsigned int buffer, int fwd) 2723GMC_allow (struct CadetConnection *c, unsigned int buffer, int fwd)
2724{ 2724{
2725 LOG (GNUNET_ERROR_TYPE_DEBUG, " allowing %s %u messages %s\n", 2725 LOG (GNUNET_ERROR_TYPE_DEBUG, " allowing %s %u messages %s\n",
2726 GMC_2s (c), buffer, GM_f2s (fwd)); 2726 GMC_2s (c), buffer, GM_f2s (fwd));
@@ -2736,8 +2736,8 @@ GMC_allow (struct MeshConnection *c, unsigned int buffer, int fwd)
2736 * @param peer Peer that disconnected. 2736 * @param peer Peer that disconnected.
2737 */ 2737 */
2738void 2738void
2739GMC_notify_broken (struct MeshConnection *c, 2739GMC_notify_broken (struct CadetConnection *c,
2740 struct MeshPeer *peer) 2740 struct CadetPeer *peer)
2741{ 2741{
2742 int fwd; 2742 int fwd;
2743 2743
@@ -2760,7 +2760,7 @@ GMC_notify_broken (struct MeshConnection *c,
2760 * (the one we just scheduled), so no point in checking whether to 2760 * (the one we just scheduled), so no point in checking whether to
2761 * destroy immediately. */ 2761 * destroy immediately. */
2762 c->destroy = GNUNET_YES; 2762 c->destroy = GNUNET_YES;
2763 c->state = MESH_CONNECTION_DESTROYED; 2763 c->state = CADET_CONNECTION_DESTROYED;
2764 2764
2765 /** 2765 /**
2766 * Cancel all queues, if no message is left, connection will be destroyed. 2766 * Cancel all queues, if no message is left, connection will be destroyed.
@@ -2780,7 +2780,7 @@ GMC_notify_broken (struct MeshConnection *c,
2780 * @return #GNUNET_YES if origin, #GNUNET_NO if relay/terminal. 2780 * @return #GNUNET_YES if origin, #GNUNET_NO if relay/terminal.
2781 */ 2781 */
2782int 2782int
2783GMC_is_origin (struct MeshConnection *c, int fwd) 2783GMC_is_origin (struct CadetConnection *c, int fwd)
2784{ 2784{
2785 if (!fwd && c->path->length - 1 == c->own_pos ) 2785 if (!fwd && c->path->length - 1 == c->own_pos )
2786 return GNUNET_YES; 2786 return GNUNET_YES;
@@ -2800,7 +2800,7 @@ GMC_is_origin (struct MeshConnection *c, int fwd)
2800 * @return #GNUNET_YES if terminal, #GNUNET_NO if relay/origin. 2800 * @return #GNUNET_YES if terminal, #GNUNET_NO if relay/origin.
2801 */ 2801 */
2802int 2802int
2803GMC_is_terminal (struct MeshConnection *c, int fwd) 2803GMC_is_terminal (struct CadetConnection *c, int fwd)
2804{ 2804{
2805 return GMC_is_origin (c, !fwd); 2805 return GMC_is_origin (c, !fwd);
2806} 2806}
@@ -2815,9 +2815,9 @@ GMC_is_terminal (struct MeshConnection *c, int fwd)
2815 * @return #GNUNET_YES in case it's OK to send. 2815 * @return #GNUNET_YES in case it's OK to send.
2816 */ 2816 */
2817int 2817int
2818GMC_is_sendable (struct MeshConnection *c, int fwd) 2818GMC_is_sendable (struct CadetConnection *c, int fwd)
2819{ 2819{
2820 struct MeshFlowControl *fc; 2820 struct CadetFlowControl *fc;
2821 2821
2822 LOG (GNUNET_ERROR_TYPE_DEBUG, " checking sendability of %s traffic on %s\n", 2822 LOG (GNUNET_ERROR_TYPE_DEBUG, " checking sendability of %s traffic on %s\n",
2823 GM_f2s (fwd), GMC_2s (c)); 2823 GM_f2s (fwd), GMC_2s (c));
@@ -2848,7 +2848,7 @@ GMC_is_sendable (struct MeshConnection *c, int fwd)
2848 * @return #GNUNET_YES in case it's a direct connection, #GNUNET_NO otherwise. 2848 * @return #GNUNET_YES in case it's a direct connection, #GNUNET_NO otherwise.
2849 */ 2849 */
2850int 2850int
2851GMC_is_direct (struct MeshConnection *c) 2851GMC_is_direct (struct CadetConnection *c)
2852{ 2852{
2853 return (c->path->length == 2) ? GNUNET_YES : GNUNET_NO; 2853 return (c->path->length == 2) ? GNUNET_YES : GNUNET_NO;
2854} 2854}
@@ -2870,14 +2870,14 @@ GMC_is_direct (struct MeshConnection *c)
2870 * NULL on error or if @c cont is NULL. 2870 * NULL on error or if @c cont is NULL.
2871 * Invalid on @c cont call. 2871 * Invalid on @c cont call.
2872 */ 2872 */
2873struct MeshConnectionQueue * 2873struct CadetConnectionQueue *
2874GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, 2874GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
2875 uint16_t payload_type, uint32_t payload_id, 2875 uint16_t payload_type, uint32_t payload_id,
2876 struct MeshConnection *c, int fwd, int force, 2876 struct CadetConnection *c, int fwd, int force,
2877 GMC_sent cont, void *cont_cls) 2877 GMC_sent cont, void *cont_cls)
2878{ 2878{
2879 struct MeshFlowControl *fc; 2879 struct CadetFlowControl *fc;
2880 struct MeshConnectionQueue *q; 2880 struct CadetConnectionQueue *q;
2881 void *data; 2881 void *data;
2882 size_t size; 2882 size_t size;
2883 uint16_t type; 2883 uint16_t type;
@@ -2894,16 +2894,16 @@ GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
2894 droppable = GNUNET_NO == force; 2894 droppable = GNUNET_NO == force;
2895 switch (type) 2895 switch (type)
2896 { 2896 {
2897 struct GNUNET_MESH_Encrypted *emsg; 2897 struct GNUNET_CADET_Encrypted *emsg;
2898 struct GNUNET_MESH_KX *kmsg; 2898 struct GNUNET_CADET_KX *kmsg;
2899 struct GNUNET_MESH_ACK *amsg; 2899 struct GNUNET_CADET_ACK *amsg;
2900 struct GNUNET_MESH_Poll *pmsg; 2900 struct GNUNET_CADET_Poll *pmsg;
2901 struct GNUNET_MESH_ConnectionDestroy *dmsg; 2901 struct GNUNET_CADET_ConnectionDestroy *dmsg;
2902 struct GNUNET_MESH_ConnectionBroken *bmsg; 2902 struct GNUNET_CADET_ConnectionBroken *bmsg;
2903 uint32_t ttl; 2903 uint32_t ttl;
2904 2904
2905 case GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED: 2905 case GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED:
2906 emsg = (struct GNUNET_MESH_Encrypted *) data; 2906 emsg = (struct GNUNET_CADET_Encrypted *) data;
2907 ttl = ntohl (emsg->ttl); 2907 ttl = ntohl (emsg->ttl);
2908 if (0 == ttl) 2908 if (0 == ttl)
2909 { 2909 {
@@ -2931,40 +2931,40 @@ GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
2931 } 2931 }
2932 break; 2932 break;
2933 2933
2934 case GNUNET_MESSAGE_TYPE_MESH_KX: 2934 case GNUNET_MESSAGE_TYPE_CADET_KX:
2935 kmsg = (struct GNUNET_MESH_KX *) data; 2935 kmsg = (struct GNUNET_CADET_KX *) data;
2936 kmsg->cid = c->id; 2936 kmsg->cid = c->id;
2937 break; 2937 break;
2938 2938
2939 case GNUNET_MESSAGE_TYPE_MESH_ACK: 2939 case GNUNET_MESSAGE_TYPE_CADET_ACK:
2940 amsg = (struct GNUNET_MESH_ACK *) data; 2940 amsg = (struct GNUNET_CADET_ACK *) data;
2941 amsg->cid = c->id; 2941 amsg->cid = c->id;
2942 LOG (GNUNET_ERROR_TYPE_DEBUG, " ack %u\n", ntohl (amsg->ack)); 2942 LOG (GNUNET_ERROR_TYPE_DEBUG, " ack %u\n", ntohl (amsg->ack));
2943 droppable = GNUNET_NO; 2943 droppable = GNUNET_NO;
2944 break; 2944 break;
2945 2945
2946 case GNUNET_MESSAGE_TYPE_MESH_POLL: 2946 case GNUNET_MESSAGE_TYPE_CADET_POLL:
2947 pmsg = (struct GNUNET_MESH_Poll *) data; 2947 pmsg = (struct GNUNET_CADET_Poll *) data;
2948 pmsg->cid = c->id; 2948 pmsg->cid = c->id;
2949 LOG (GNUNET_ERROR_TYPE_DEBUG, " poll %u\n", ntohl (pmsg->pid)); 2949 LOG (GNUNET_ERROR_TYPE_DEBUG, " poll %u\n", ntohl (pmsg->pid));
2950 droppable = GNUNET_NO; 2950 droppable = GNUNET_NO;
2951 break; 2951 break;
2952 2952
2953 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY: 2953 case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY:
2954 dmsg = (struct GNUNET_MESH_ConnectionDestroy *) data; 2954 dmsg = (struct GNUNET_CADET_ConnectionDestroy *) data;
2955 dmsg->cid = c->id; 2955 dmsg->cid = c->id;
2956 break; 2956 break;
2957 2957
2958 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN: 2958 case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN:
2959 bmsg = (struct GNUNET_MESH_ConnectionBroken *) data; 2959 bmsg = (struct GNUNET_CADET_ConnectionBroken *) data;
2960 bmsg->cid = c->id; 2960 bmsg->cid = c->id;
2961 break; 2961 break;
2962 2962
2963 case GNUNET_MESSAGE_TYPE_MESH_KEEPALIVE: 2963 case GNUNET_MESSAGE_TYPE_CADET_KEEPALIVE:
2964 GNUNET_break (0); 2964 GNUNET_break (0);
2965 /* falltrough */ 2965 /* falltrough */
2966 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE: 2966 case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE:
2967 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK: 2967 case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK:
2968 break; 2968 break;
2969 2969
2970 default: 2970 default:
@@ -2981,7 +2981,7 @@ GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
2981 LOG (GNUNET_ERROR_TYPE_DEBUG, 2981 LOG (GNUNET_ERROR_TYPE_DEBUG,
2982 "queue full: %u/%u\n", 2982 "queue full: %u/%u\n",
2983 fc->queue_n, fc->queue_max); 2983 fc->queue_n, fc->queue_max);
2984 if (GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED == type) 2984 if (GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED == type)
2985 { 2985 {
2986 fc->queue_n--; 2986 fc->queue_n--;
2987 } 2987 }
@@ -2992,7 +2992,7 @@ GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
2992 LOG (GNUNET_ERROR_TYPE_DEBUG, " C_P+ %p %u\n", c, c->pending_messages); 2992 LOG (GNUNET_ERROR_TYPE_DEBUG, " C_P+ %p %u\n", c, c->pending_messages);
2993// c->pending_messages++; 2993// c->pending_messages++;
2994 2994
2995 q = GNUNET_new (struct MeshConnectionQueue); 2995 q = GNUNET_new (struct CadetConnectionQueue);
2996 q->forced = !droppable; 2996 q->forced = !droppable;
2997 q->q = GMP_queue_add (get_hop (c, fwd), data, type, payload_type, payload_id, 2997 q->q = GMP_queue_add (get_hop (c, fwd), data, type, payload_type, payload_id,
2998 size, c, fwd, &conn_message_sent, q); 2998 size, c, fwd, &conn_message_sent, q);
@@ -3019,7 +3019,7 @@ GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
3019 * @param q Handle to the queue. 3019 * @param q Handle to the queue.
3020 */ 3020 */
3021void 3021void
3022GMC_cancel (struct MeshConnectionQueue *q) 3022GMC_cancel (struct CadetConnectionQueue *q)
3023{ 3023{
3024 LOG (GNUNET_ERROR_TYPE_DEBUG, "! GMC cancel message\n"); 3024 LOG (GNUNET_ERROR_TYPE_DEBUG, "! GMC cancel message\n");
3025 3025
@@ -3035,16 +3035,16 @@ GMC_cancel (struct MeshConnectionQueue *q)
3035 * @param connection Connection to create. 3035 * @param connection Connection to create.
3036 */ 3036 */
3037void 3037void
3038GMC_send_create (struct MeshConnection *connection) 3038GMC_send_create (struct CadetConnection *connection)
3039{ 3039{
3040 enum MeshTunnel3CState state; 3040 enum CadetTunnel3CState state;
3041 size_t size; 3041 size_t size;
3042 3042
3043 size = sizeof (struct GNUNET_MESH_ConnectionCreate); 3043 size = sizeof (struct GNUNET_CADET_ConnectionCreate);
3044 size += connection->path->length * sizeof (struct GNUNET_PeerIdentity); 3044 size += connection->path->length * sizeof (struct GNUNET_PeerIdentity);
3045 3045
3046 LOG (GNUNET_ERROR_TYPE_INFO, "===> %s on connection %s (%u bytes)\n", 3046 LOG (GNUNET_ERROR_TYPE_INFO, "===> %s on connection %s (%u bytes)\n",
3047 GM_m2s (GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE), 3047 GM_m2s (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE),
3048 GMC_2s (connection), size); 3048 GMC_2s (connection), size);
3049 LOG (GNUNET_ERROR_TYPE_DEBUG, " C_P+ %p %u (create)\n", 3049 LOG (GNUNET_ERROR_TYPE_DEBUG, " C_P+ %p %u (create)\n",
3050 connection, connection->pending_messages); 3050 connection, connection->pending_messages);
@@ -3052,15 +3052,15 @@ GMC_send_create (struct MeshConnection *connection)
3052 3052
3053 connection->maintenance_q = 3053 connection->maintenance_q =
3054 GMP_queue_add (get_next_hop (connection), NULL, 3054 GMP_queue_add (get_next_hop (connection), NULL,
3055 GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE, 3055 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE,
3056 GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE, 0, 3056 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE, 0,
3057 size, connection, GNUNET_YES, &conn_message_sent, NULL); 3057 size, connection, GNUNET_YES, &conn_message_sent, NULL);
3058 3058
3059 state = GMT_get_cstate (connection->t); 3059 state = GMT_get_cstate (connection->t);
3060 if (MESH_TUNNEL3_SEARCHING == state || MESH_TUNNEL3_NEW == state) 3060 if (CADET_TUNNEL3_SEARCHING == state || CADET_TUNNEL3_NEW == state)
3061 GMT_change_cstate (connection->t, MESH_TUNNEL3_WAITING); 3061 GMT_change_cstate (connection->t, CADET_TUNNEL3_WAITING);
3062 if (MESH_CONNECTION_NEW == connection->state) 3062 if (CADET_CONNECTION_NEW == connection->state)
3063 connection_change_state (connection, MESH_CONNECTION_SENT); 3063 connection_change_state (connection, CADET_CONNECTION_SENT);
3064} 3064}
3065 3065
3066 3066
@@ -3074,15 +3074,15 @@ GMC_send_create (struct MeshConnection *connection)
3074 * @param c The connection whose peers to notify. 3074 * @param c The connection whose peers to notify.
3075 */ 3075 */
3076void 3076void
3077GMC_send_destroy (struct MeshConnection *c) 3077GMC_send_destroy (struct CadetConnection *c)
3078{ 3078{
3079 struct GNUNET_MESH_ConnectionDestroy msg; 3079 struct GNUNET_CADET_ConnectionDestroy msg;
3080 3080
3081 if (GNUNET_YES == c->destroy) 3081 if (GNUNET_YES == c->destroy)
3082 return; 3082 return;
3083 3083
3084 msg.header.size = htons (sizeof (msg)); 3084 msg.header.size = htons (sizeof (msg));
3085 msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY);; 3085 msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY);;
3086 msg.cid = c->id; 3086 msg.cid = c->id;
3087 LOG (GNUNET_ERROR_TYPE_DEBUG, 3087 LOG (GNUNET_ERROR_TYPE_DEBUG,
3088 " sending connection destroy for connection %s\n", 3088 " sending connection destroy for connection %s\n",
@@ -3090,14 +3090,14 @@ GMC_send_destroy (struct MeshConnection *c)
3090 3090
3091 if (GNUNET_NO == GMC_is_terminal (c, GNUNET_YES)) 3091 if (GNUNET_NO == GMC_is_terminal (c, GNUNET_YES))
3092 GMC_send_prebuilt_message (&msg.header, 3092 GMC_send_prebuilt_message (&msg.header,
3093 GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY, 0, 3093 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY, 0,
3094 c, GNUNET_YES, GNUNET_YES, NULL, NULL); 3094 c, GNUNET_YES, GNUNET_YES, NULL, NULL);
3095 if (GNUNET_NO == GMC_is_terminal (c, GNUNET_NO)) 3095 if (GNUNET_NO == GMC_is_terminal (c, GNUNET_NO))
3096 GMC_send_prebuilt_message (&msg.header, 3096 GMC_send_prebuilt_message (&msg.header,
3097 GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY, 0, 3097 GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY, 0,
3098 c, GNUNET_NO, GNUNET_YES, NULL, NULL); 3098 c, GNUNET_NO, GNUNET_YES, NULL, NULL);
3099 c->destroy = GNUNET_YES; 3099 c->destroy = GNUNET_YES;
3100 c->state = MESH_CONNECTION_DESTROYED; 3100 c->state = CADET_CONNECTION_DESTROYED;
3101} 3101}
3102 3102
3103 3103
@@ -3112,9 +3112,9 @@ GMC_send_destroy (struct MeshConnection *c)
3112 * @param fwd Should we poll in the FWD direction? 3112 * @param fwd Should we poll in the FWD direction?
3113 */ 3113 */
3114void 3114void
3115GMC_start_poll (struct MeshConnection *c, int fwd) 3115GMC_start_poll (struct CadetConnection *c, int fwd)
3116{ 3116{
3117 struct MeshFlowControl *fc; 3117 struct CadetFlowControl *fc;
3118 3118
3119 fc = fwd ? &c->fwd_fc : &c->bck_fc; 3119 fc = fwd ? &c->fwd_fc : &c->bck_fc;
3120 LOG (GNUNET_ERROR_TYPE_DEBUG, " *** POLL %s requested\n", 3120 LOG (GNUNET_ERROR_TYPE_DEBUG, " *** POLL %s requested\n",
@@ -3141,9 +3141,9 @@ GMC_start_poll (struct MeshConnection *c, int fwd)
3141 * @param fwd Should we stop the poll in the FWD direction? 3141 * @param fwd Should we stop the poll in the FWD direction?
3142 */ 3142 */
3143void 3143void
3144GMC_stop_poll (struct MeshConnection *c, int fwd) 3144GMC_stop_poll (struct CadetConnection *c, int fwd)
3145{ 3145{
3146 struct MeshFlowControl *fc; 3146 struct CadetFlowControl *fc;
3147 3147
3148 fc = fwd ? &c->fwd_fc : &c->bck_fc; 3148 fc = fwd ? &c->fwd_fc : &c->bck_fc;
3149 if (GNUNET_SCHEDULER_NO_TASK != fc->poll_task) 3149 if (GNUNET_SCHEDULER_NO_TASK != fc->poll_task)
@@ -3159,7 +3159,7 @@ GMC_stop_poll (struct MeshConnection *c, int fwd)
3159 * @param c Connection. 3159 * @param c Connection.
3160 */ 3160 */
3161const char * 3161const char *
3162GMC_2s (const struct MeshConnection *c) 3162GMC_2s (const struct CadetConnection *c)
3163{ 3163{
3164 if (NULL == c) 3164 if (NULL == c)
3165 return "NULL"; 3165 return "NULL";
diff --git a/src/mesh/gnunet-service-mesh_connection.h b/src/mesh/gnunet-service-mesh_connection.h
index 78d807817..4e1104c2b 100644
--- a/src/mesh/gnunet-service-mesh_connection.h
+++ b/src/mesh/gnunet-service-mesh_connection.h
@@ -19,15 +19,15 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file mesh/gnunet-service-mesh_connection.h 22 * @file cadet/gnunet-service-cadet_connection.h
23 * @brief mesh service; dealing with connections 23 * @brief cadet service; dealing with connections
24 * @author Bartlomiej Polot 24 * @author Bartlomiej Polot
25 * 25 *
26 * All functions in this file should use the prefix GMC (Gnunet Mesh Connection) 26 * All functions in this file should use the prefix GMC (Gnunet Cadet Connection)
27 */ 27 */
28 28
29#ifndef GNUNET_SERVICE_MESH_CONNECTION_H 29#ifndef GNUNET_SERVICE_CADET_CONNECTION_H
30#define GNUNET_SERVICE_MESH_CONNECTION_H 30#define GNUNET_SERVICE_CADET_CONNECTION_H
31 31
32#ifdef __cplusplus 32#ifdef __cplusplus
33extern "C" 33extern "C"
@@ -43,48 +43,48 @@ extern "C"
43/** 43/**
44 * All the states a connection can be in. 44 * All the states a connection can be in.
45 */ 45 */
46enum MeshConnectionState 46enum CadetConnectionState
47{ 47{
48 /** 48 /**
49 * Uninitialized status, should never appear in operation. 49 * Uninitialized status, should never appear in operation.
50 */ 50 */
51 MESH_CONNECTION_NEW, 51 CADET_CONNECTION_NEW,
52 52
53 /** 53 /**
54 * Connection create message sent, waiting for ACK. 54 * Connection create message sent, waiting for ACK.
55 */ 55 */
56 MESH_CONNECTION_SENT, 56 CADET_CONNECTION_SENT,
57 57
58 /** 58 /**
59 * Connection ACK sent, waiting for ACK. 59 * Connection ACK sent, waiting for ACK.
60 */ 60 */
61 MESH_CONNECTION_ACK, 61 CADET_CONNECTION_ACK,
62 62
63 /** 63 /**
64 * Connection confirmed, ready to carry traffic. 64 * Connection confirmed, ready to carry traffic.
65 */ 65 */
66 MESH_CONNECTION_READY, 66 CADET_CONNECTION_READY,
67 67
68 /** 68 /**
69 * Connection to be destroyed, just waiting to empty queues. 69 * Connection to be destroyed, just waiting to empty queues.
70 */ 70 */
71 MESH_CONNECTION_DESTROYED, 71 CADET_CONNECTION_DESTROYED,
72}; 72};
73 73
74 74
75/** 75/**
76 * Struct containing all information regarding a connection to a peer. 76 * Struct containing all information regarding a connection to a peer.
77 */ 77 */
78struct MeshConnection; 78struct CadetConnection;
79 79
80/** 80/**
81 * Handle for messages queued but not yet sent. 81 * Handle for messages queued but not yet sent.
82 */ 82 */
83struct MeshConnectionQueue; 83struct CadetConnectionQueue;
84 84
85#include "mesh_path.h" 85#include "cadet_path.h"
86#include "gnunet-service-mesh_channel.h" 86#include "gnunet-service-cadet_channel.h"
87#include "gnunet-service-mesh_peer.h" 87#include "gnunet-service-cadet_peer.h"
88 88
89 89
90 90
@@ -98,8 +98,8 @@ struct MeshConnectionQueue;
98 * @param size Size of the message. 98 * @param size Size of the message.
99 */ 99 */
100typedef void (*GMC_sent) (void *cls, 100typedef void (*GMC_sent) (void *cls,
101 struct MeshConnection *c, 101 struct CadetConnection *c,
102 struct MeshConnectionQueue *q, 102 struct CadetConnectionQueue *q,
103 uint16_t type, int fwd, size_t size); 103 uint16_t type, int fwd, size_t size);
104 104
105/** 105/**
@@ -160,7 +160,7 @@ GMC_handle_destroy (void *cls, const struct GNUNET_PeerIdentity *peer,
160 const struct GNUNET_MessageHeader *message); 160 const struct GNUNET_MessageHeader *message);
161 161
162/** 162/**
163 * Core handler for encrypted mesh network traffic (channel mgmt, data). 163 * Core handler for encrypted cadet network traffic (channel mgmt, data).
164 * 164 *
165 * @param cls Closure (unused). 165 * @param cls Closure (unused).
166 * @param message Message received. 166 * @param message Message received.
@@ -188,7 +188,7 @@ GMC_handle_kx (void *cls, const struct GNUNET_PeerIdentity *peer,
188 const struct GNUNET_MessageHeader *message); 188 const struct GNUNET_MessageHeader *message);
189 189
190/** 190/**
191 * Core handler for mesh network traffic point-to-point acks. 191 * Core handler for cadet network traffic point-to-point acks.
192 * 192 *
193 * @param cls closure 193 * @param cls closure
194 * @param message message 194 * @param message message
@@ -202,7 +202,7 @@ GMC_handle_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
202 const struct GNUNET_MessageHeader *message); 202 const struct GNUNET_MessageHeader *message);
203 203
204/** 204/**
205 * Core handler for mesh network traffic point-to-point ack polls. 205 * Core handler for cadet network traffic point-to-point ack polls.
206 * 206 *
207 * @param cls closure 207 * @param cls closure
208 * @param message message 208 * @param message message
@@ -216,7 +216,7 @@ GMC_handle_poll (void *cls, const struct GNUNET_PeerIdentity *peer,
216 const struct GNUNET_MessageHeader *message); 216 const struct GNUNET_MessageHeader *message);
217 217
218/** 218/**
219 * Core handler for mesh keepalives. 219 * Core handler for cadet keepalives.
220 * 220 *
221 * @param cls closure 221 * @param cls closure
222 * @param message message 222 * @param message message
@@ -239,7 +239,7 @@ GMC_handle_keepalive (void *cls, const struct GNUNET_PeerIdentity *peer,
239 * @param force Send the ACK even if suboptimal (e.g. requested by POLL). 239 * @param force Send the ACK even if suboptimal (e.g. requested by POLL).
240 */ 240 */
241void 241void
242GMC_send_ack (struct MeshConnection *c, int fwd, int force); 242GMC_send_ack (struct CadetConnection *c, int fwd, int force);
243 243
244/** 244/**
245 * Initialize the connections subsystem 245 * Initialize the connections subsystem
@@ -265,10 +265,10 @@ GMC_shutdown (void);
265 * 265 *
266 * @return Newly created connection, NULL in case of error (own id not in path). 266 * @return Newly created connection, NULL in case of error (own id not in path).
267 */ 267 */
268struct MeshConnection * 268struct CadetConnection *
269GMC_new (const struct GNUNET_MESH_Hash *cid, 269GMC_new (const struct GNUNET_CADET_Hash *cid,
270 struct MeshTunnel3 *t, 270 struct CadetTunnel3 *t,
271 struct MeshPeerPath *p, 271 struct CadetPeerPath *p,
272 unsigned int own_pos); 272 unsigned int own_pos);
273 273
274/** 274/**
@@ -280,7 +280,7 @@ GMC_new (const struct GNUNET_MESH_Hash *cid,
280 * @param c Connection to destroy. 280 * @param c Connection to destroy.
281 */ 281 */
282void 282void
283GMC_destroy (struct MeshConnection *c); 283GMC_destroy (struct CadetConnection *c);
284 284
285/** 285/**
286 * Get the connection ID. 286 * Get the connection ID.
@@ -289,8 +289,8 @@ GMC_destroy (struct MeshConnection *c);
289 * 289 *
290 * @return ID of the connection. 290 * @return ID of the connection.
291 */ 291 */
292const struct GNUNET_MESH_Hash * 292const struct GNUNET_CADET_Hash *
293GMC_get_id (const struct MeshConnection *c); 293GMC_get_id (const struct CadetConnection *c);
294 294
295 295
296/** 296/**
@@ -301,7 +301,7 @@ GMC_get_id (const struct MeshConnection *c);
301 * @return Hash expanded from the ID of the connection. 301 * @return Hash expanded from the ID of the connection.
302 */ 302 */
303const struct GNUNET_HashCode * 303const struct GNUNET_HashCode *
304GMC_get_h (const struct MeshConnection *c); 304GMC_get_h (const struct CadetConnection *c);
305 305
306 306
307/** 307/**
@@ -311,8 +311,8 @@ GMC_get_h (const struct MeshConnection *c);
311 * 311 *
312 * @return path used by the connection. 312 * @return path used by the connection.
313 */ 313 */
314const struct MeshPeerPath * 314const struct CadetPeerPath *
315GMC_get_path (const struct MeshConnection *c); 315GMC_get_path (const struct CadetConnection *c);
316 316
317/** 317/**
318 * Get the connection state. 318 * Get the connection state.
@@ -321,8 +321,8 @@ GMC_get_path (const struct MeshConnection *c);
321 * 321 *
322 * @return state of the connection. 322 * @return state of the connection.
323 */ 323 */
324enum MeshConnectionState 324enum CadetConnectionState
325GMC_get_state (const struct MeshConnection *c); 325GMC_get_state (const struct CadetConnection *c);
326 326
327/** 327/**
328 * Get the connection tunnel. 328 * Get the connection tunnel.
@@ -331,8 +331,8 @@ GMC_get_state (const struct MeshConnection *c);
331 * 331 *
332 * @return tunnel of the connection. 332 * @return tunnel of the connection.
333 */ 333 */
334struct MeshTunnel3 * 334struct CadetTunnel3 *
335GMC_get_tunnel (const struct MeshConnection *c); 335GMC_get_tunnel (const struct CadetConnection *c);
336 336
337/** 337/**
338 * Get free buffer space in a connection. 338 * Get free buffer space in a connection.
@@ -343,7 +343,7 @@ GMC_get_tunnel (const struct MeshConnection *c);
343 * @return Free buffer space [0 - max_msgs_queue/max_connections] 343 * @return Free buffer space [0 - max_msgs_queue/max_connections]
344 */ 344 */
345unsigned int 345unsigned int
346GMC_get_buffer (struct MeshConnection *c, int fwd); 346GMC_get_buffer (struct CadetConnection *c, int fwd);
347 347
348/** 348/**
349 * Get how many messages have we allowed to send to us from a direction. 349 * Get how many messages have we allowed to send to us from a direction.
@@ -354,7 +354,7 @@ GMC_get_buffer (struct MeshConnection *c, int fwd);
354 * @return last_ack_sent - last_pid_recv 354 * @return last_ack_sent - last_pid_recv
355 */ 355 */
356unsigned int 356unsigned int
357GMC_get_allowed (struct MeshConnection *c, int fwd); 357GMC_get_allowed (struct CadetConnection *c, int fwd);
358 358
359/** 359/**
360 * Get messages queued in a connection. 360 * Get messages queued in a connection.
@@ -365,7 +365,7 @@ GMC_get_allowed (struct MeshConnection *c, int fwd);
365 * @return Number of messages queued. 365 * @return Number of messages queued.
366 */ 366 */
367unsigned int 367unsigned int
368GMC_get_qn (struct MeshConnection *c, int fwd); 368GMC_get_qn (struct CadetConnection *c, int fwd);
369 369
370/** 370/**
371 * Get next PID to use. 371 * Get next PID to use.
@@ -376,7 +376,7 @@ GMC_get_qn (struct MeshConnection *c, int fwd);
376 * @return Last PID used + 1. 376 * @return Last PID used + 1.
377 */ 377 */
378unsigned int 378unsigned int
379GMC_get_pid (struct MeshConnection *c, int fwd); 379GMC_get_pid (struct CadetConnection *c, int fwd);
380 380
381/** 381/**
382 * Allow the connection to advertise a buffer of the given size. 382 * Allow the connection to advertise a buffer of the given size.
@@ -389,7 +389,7 @@ GMC_get_pid (struct MeshConnection *c, int fwd);
389 * @param fwd Is this about FWD traffic? (The ack will go dest->root). 389 * @param fwd Is this about FWD traffic? (The ack will go dest->root).
390 */ 390 */
391void 391void
392GMC_allow (struct MeshConnection *c, unsigned int buffer, int fwd); 392GMC_allow (struct CadetConnection *c, unsigned int buffer, int fwd);
393 393
394/** 394/**
395 * Send FWD keepalive packets for a connection. 395 * Send FWD keepalive packets for a connection.
@@ -418,8 +418,8 @@ GMC_bck_keepalive (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
418 * @param peer Peer that disconnected. 418 * @param peer Peer that disconnected.
419 */ 419 */
420void 420void
421GMC_notify_broken (struct MeshConnection *c, 421GMC_notify_broken (struct CadetConnection *c,
422 struct MeshPeer *peer); 422 struct CadetPeer *peer);
423 423
424/** 424/**
425 * Is this peer the first one on the connection? 425 * Is this peer the first one on the connection?
@@ -430,7 +430,7 @@ GMC_notify_broken (struct MeshConnection *c,
430 * @return #GNUNET_YES if origin, #GNUNET_NO if relay/terminal. 430 * @return #GNUNET_YES if origin, #GNUNET_NO if relay/terminal.
431 */ 431 */
432int 432int
433GMC_is_origin (struct MeshConnection *c, int fwd); 433GMC_is_origin (struct CadetConnection *c, int fwd);
434 434
435/** 435/**
436 * Is this peer the last one on the connection? 436 * Is this peer the last one on the connection?
@@ -442,7 +442,7 @@ GMC_is_origin (struct MeshConnection *c, int fwd);
442 * @return #GNUNET_YES if terminal, #GNUNET_NO if relay/origin. 442 * @return #GNUNET_YES if terminal, #GNUNET_NO if relay/origin.
443 */ 443 */
444int 444int
445GMC_is_terminal (struct MeshConnection *c, int fwd); 445GMC_is_terminal (struct CadetConnection *c, int fwd);
446 446
447/** 447/**
448 * See if we are allowed to send by the next hop in the given direction. 448 * See if we are allowed to send by the next hop in the given direction.
@@ -453,7 +453,7 @@ GMC_is_terminal (struct MeshConnection *c, int fwd);
453 * @return #GNUNET_YES in case it's OK to send. 453 * @return #GNUNET_YES in case it's OK to send.
454 */ 454 */
455int 455int
456GMC_is_sendable (struct MeshConnection *c, int fwd); 456GMC_is_sendable (struct CadetConnection *c, int fwd);
457 457
458/** 458/**
459 * Check if this connection is a direct one (never trim a direct connection). 459 * Check if this connection is a direct one (never trim a direct connection).
@@ -463,7 +463,7 @@ GMC_is_sendable (struct MeshConnection *c, int fwd);
463 * @return #GNUNET_YES in case it's a direct connection, #GNUNET_NO otherwise. 463 * @return #GNUNET_YES in case it's a direct connection, #GNUNET_NO otherwise.
464 */ 464 */
465int 465int
466GMC_is_direct (struct MeshConnection *c); 466GMC_is_direct (struct CadetConnection *c);
467 467
468/** 468/**
469 * Cancel a previously sent message while it's in the queue. 469 * Cancel a previously sent message while it's in the queue.
@@ -475,7 +475,7 @@ GMC_is_direct (struct MeshConnection *c);
475 * @param q Handle to the queue. 475 * @param q Handle to the queue.
476 */ 476 */
477void 477void
478GMC_cancel (struct MeshConnectionQueue *q); 478GMC_cancel (struct CadetConnectionQueue *q);
479 479
480/** 480/**
481 * Sends an already built message on a connection, properly registering 481 * Sends an already built message on a connection, properly registering
@@ -494,10 +494,10 @@ GMC_cancel (struct MeshConnectionQueue *q);
494 * NULL on error or if @c cont is NULL. 494 * NULL on error or if @c cont is NULL.
495 * Invalid on @c cont call. 495 * Invalid on @c cont call.
496 */ 496 */
497struct MeshConnectionQueue * 497struct CadetConnectionQueue *
498GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, 498GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
499 uint16_t payload_type, uint32_t payload_id, 499 uint16_t payload_type, uint32_t payload_id,
500 struct MeshConnection *c, int fwd, int force, 500 struct CadetConnection *c, int fwd, int force,
501 GMC_sent cont, void *cont_cls); 501 GMC_sent cont, void *cont_cls);
502 502
503/** 503/**
@@ -507,7 +507,7 @@ GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
507 * @param connection Connection to create. 507 * @param connection Connection to create.
508 */ 508 */
509void 509void
510GMC_send_create (struct MeshConnection *connection); 510GMC_send_create (struct CadetConnection *connection);
511 511
512/** 512/**
513 * Send a message to all peers in this connection that the connection 513 * Send a message to all peers in this connection that the connection
@@ -519,7 +519,7 @@ GMC_send_create (struct MeshConnection *connection);
519 * @param c The connection whose peers to notify. 519 * @param c The connection whose peers to notify.
520 */ 520 */
521void 521void
522GMC_send_destroy (struct MeshConnection *c); 522GMC_send_destroy (struct CadetConnection *c);
523 523
524/** 524/**
525 * @brief Start a polling timer for the connection. 525 * @brief Start a polling timer for the connection.
@@ -532,7 +532,7 @@ GMC_send_destroy (struct MeshConnection *c);
532 * @param fwd Should we poll in the FWD direction? 532 * @param fwd Should we poll in the FWD direction?
533 */ 533 */
534void 534void
535GMC_start_poll (struct MeshConnection *c, int fwd); 535GMC_start_poll (struct CadetConnection *c, int fwd);
536 536
537 537
538/** 538/**
@@ -544,7 +544,7 @@ GMC_start_poll (struct MeshConnection *c, int fwd);
544 * @param fwd Should we stop the poll in the FWD direction? 544 * @param fwd Should we stop the poll in the FWD direction?
545 */ 545 */
546void 546void
547GMC_stop_poll (struct MeshConnection *c, int fwd); 547GMC_stop_poll (struct CadetConnection *c, int fwd);
548 548
549/** 549/**
550 * Get a (static) string for a connection. 550 * Get a (static) string for a connection.
@@ -552,7 +552,7 @@ GMC_stop_poll (struct MeshConnection *c, int fwd);
552 * @param c Connection. 552 * @param c Connection.
553 */ 553 */
554const char * 554const char *
555GMC_2s (const struct MeshConnection *c); 555GMC_2s (const struct CadetConnection *c);
556 556
557#if 0 /* keep Emacsens' auto-indent happy */ 557#if 0 /* keep Emacsens' auto-indent happy */
558{ 558{
@@ -561,6 +561,6 @@ GMC_2s (const struct MeshConnection *c);
561} 561}
562#endif 562#endif
563 563
564/* ifndef GNUNET_SERVICE_MESH_CONNECTION_H */ 564/* ifndef GNUNET_SERVICE_CADET_CONNECTION_H */
565#endif 565#endif
566/* end of gnunet-service-mesh_connection.h */ 566/* end of gnunet-service-cadet_connection.h */
diff --git a/src/mesh/gnunet-service-mesh_dht.c b/src/mesh/gnunet-service-mesh_dht.c
index 01fb4a30f..b187e3cd9 100644
--- a/src/mesh/gnunet-service-mesh_dht.c
+++ b/src/mesh/gnunet-service-mesh_dht.c
@@ -25,12 +25,12 @@
25#include "gnunet_dht_service.h" 25#include "gnunet_dht_service.h"
26#include "gnunet_statistics_service.h" 26#include "gnunet_statistics_service.h"
27 27
28#include "mesh_path.h" 28#include "cadet_path.h"
29#include "gnunet-service-mesh_dht.h" 29#include "gnunet-service-cadet_dht.h"
30#include "gnunet-service-mesh_peer.h" 30#include "gnunet-service-cadet_peer.h"
31#include "gnunet-service-mesh_hello.h" 31#include "gnunet-service-cadet_hello.h"
32 32
33#define LOG(level, ...) GNUNET_log_from (level,"mesh-dht",__VA_ARGS__) 33#define LOG(level, ...) GNUNET_log_from (level,"cadet-dht",__VA_ARGS__)
34 34
35 35
36/******************************************************************************/ 36/******************************************************************************/
@@ -113,13 +113,13 @@ static struct GNUNET_CONTAINER_MultiHashMap32 *get_requests;
113 * 113 *
114 * FIXME refactor and use build_path_from_peer_ids 114 * FIXME refactor and use build_path_from_peer_ids
115 */ 115 */
116static struct MeshPeerPath * 116static struct CadetPeerPath *
117path_build_from_dht (const struct GNUNET_PeerIdentity *get_path, 117path_build_from_dht (const struct GNUNET_PeerIdentity *get_path,
118 unsigned int get_path_length, 118 unsigned int get_path_length,
119 const struct GNUNET_PeerIdentity *put_path, 119 const struct GNUNET_PeerIdentity *put_path,
120 unsigned int put_path_length) 120 unsigned int put_path_length)
121{ 121{
122 struct MeshPeerPath *p; 122 struct CadetPeerPath *p;
123 GNUNET_PEER_Id id; 123 GNUNET_PEER_Id id;
124 int i; 124 int i;
125 125
@@ -172,7 +172,7 @@ path_build_from_dht (const struct GNUNET_PeerIdentity *get_path,
172 p->peers[p->length - 1] = id; 172 p->peers[p->length - 1] = id;
173 } 173 }
174 } 174 }
175#if MESH_DEBUG 175#if CADET_DEBUG
176 if (get_path_length > 0) 176 if (get_path_length > 0)
177 LOG (GNUNET_ERROR_TYPE_DEBUG, " (first of GET: %s)\n", 177 LOG (GNUNET_ERROR_TYPE_DEBUG, " (first of GET: %s)\n",
178 GNUNET_i2s (&get_path[0])); 178 GNUNET_i2s (&get_path[0]));
@@ -221,8 +221,8 @@ dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp,
221{ 221{
222 struct GMD_search_handle *h = cls; 222 struct GMD_search_handle *h = cls;
223 struct GNUNET_HELLO_Message *hello; 223 struct GNUNET_HELLO_Message *hello;
224 struct MeshPeerPath *p; 224 struct CadetPeerPath *p;
225 struct MeshPeer *peer; 225 struct CadetPeer *peer;
226 char *s; 226 char *s;
227 227
228 p = path_build_from_dht (get_path, get_path_length, 228 p = path_build_from_dht (get_path, get_path_length,
@@ -334,20 +334,20 @@ GMD_init (const struct GNUNET_CONFIGURATION_Handle *c)
334{ 334{
335 LOG (GNUNET_ERROR_TYPE_DEBUG, "init\n"); 335 LOG (GNUNET_ERROR_TYPE_DEBUG, "init\n");
336 if (GNUNET_OK != 336 if (GNUNET_OK !=
337 GNUNET_CONFIGURATION_get_value_number (c, "MESH", "DHT_REPLICATION_LEVEL", 337 GNUNET_CONFIGURATION_get_value_number (c, "CADET", "DHT_REPLICATION_LEVEL",
338 &dht_replication_level)) 338 &dht_replication_level))
339 { 339 {
340 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING, 340 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING,
341 "MESH", "DHT_REPLICATION_LEVEL", "USING DEFAULT"); 341 "CADET", "DHT_REPLICATION_LEVEL", "USING DEFAULT");
342 dht_replication_level = 3; 342 dht_replication_level = 3;
343 } 343 }
344 344
345 if (GNUNET_OK != 345 if (GNUNET_OK !=
346 GNUNET_CONFIGURATION_get_value_time (c, "MESH", "ID_ANNOUNCE_TIME", 346 GNUNET_CONFIGURATION_get_value_time (c, "CADET", "ID_ANNOUNCE_TIME",
347 &id_announce_time)) 347 &id_announce_time))
348 { 348 {
349 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, 349 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
350 "MESH", "ID_ANNOUNCE_TIME", "MISSING"); 350 "CADET", "ID_ANNOUNCE_TIME", "MISSING");
351 GNUNET_SCHEDULER_shutdown (); 351 GNUNET_SCHEDULER_shutdown ();
352 return; 352 return;
353 } 353 }
diff --git a/src/mesh/gnunet-service-mesh_dht.h b/src/mesh/gnunet-service-mesh_dht.h
index 179e7b4fc..6cac531ff 100644
--- a/src/mesh/gnunet-service-mesh_dht.h
+++ b/src/mesh/gnunet-service-mesh_dht.h
@@ -19,15 +19,15 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file mesh/gnunet-service-mesh_dht.h 22 * @file cadet/gnunet-service-cadet_dht.h
23 * @brief mesh service; dealing with DHT requests and results 23 * @brief cadet service; dealing with DHT requests and results
24 * @author Bartlomiej Polot 24 * @author Bartlomiej Polot
25 * 25 *
26 * All functions in this file should use the prefix GMD (Gnunet Mesh Dht) 26 * All functions in this file should use the prefix GMD (Gnunet Cadet Dht)
27 */ 27 */
28 28
29#ifndef GNUNET_SERVICE_MESH_DHT_H 29#ifndef GNUNET_SERVICE_CADET_DHT_H
30#define GNUNET_SERVICE_MESH_DHT_H 30#define GNUNET_SERVICE_CADET_DHT_H
31 31
32#ifdef __cplusplus 32#ifdef __cplusplus
33extern "C" 33extern "C"
@@ -51,7 +51,7 @@ struct GMD_search_handle;
51 * After callback will no longer be valid! 51 * After callback will no longer be valid!
52 */ 52 */
53typedef void (*GMD_search_callback) (void *cls, 53typedef void (*GMD_search_callback) (void *cls,
54 const struct MeshPeerPath *path); 54 const struct CadetPeerPath *path);
55 55
56/******************************************************************************/ 56/******************************************************************************/
57/******************************** API ***********************************/ 57/******************************** API ***********************************/
@@ -87,6 +87,6 @@ GMD_search_stop (struct GMD_search_handle *h);
87} 87}
88#endif 88#endif
89 89
90/* ifndef GNUNET_MESH_SERVICE_LOCAL_H */ 90/* ifndef GNUNET_CADET_SERVICE_LOCAL_H */
91#endif 91#endif
92/* end of gnunet-mesh-service_LOCAL.h */ \ No newline at end of file 92/* end of gnunet-cadet-service_LOCAL.h */ \ No newline at end of file
diff --git a/src/mesh/gnunet-service-mesh_hello.c b/src/mesh/gnunet-service-mesh_hello.c
index 599cc3731..7eda3f507 100644
--- a/src/mesh/gnunet-service-mesh_hello.c
+++ b/src/mesh/gnunet-service-mesh_hello.c
@@ -24,13 +24,13 @@
24#include "gnunet_statistics_service.h" 24#include "gnunet_statistics_service.h"
25#include "gnunet_peerinfo_service.h" 25#include "gnunet_peerinfo_service.h"
26 26
27#include "mesh_protocol.h" 27#include "cadet_protocol.h"
28#include "mesh_path.h" 28#include "cadet_path.h"
29 29
30#include "gnunet-service-mesh_hello.h" 30#include "gnunet-service-cadet_hello.h"
31#include "gnunet-service-mesh_peer.h" 31#include "gnunet-service-cadet_peer.h"
32 32
33#define LOG(level, ...) GNUNET_log_from(level,"mesh-hll",__VA_ARGS__) 33#define LOG(level, ...) GNUNET_log_from(level,"cadet-hll",__VA_ARGS__)
34 34
35 35
36/******************************************************************************/ 36/******************************************************************************/
@@ -98,7 +98,7 @@ got_hello (void *cls, const struct GNUNET_PeerIdentity *id,
98 const struct GNUNET_HELLO_Message *hello, 98 const struct GNUNET_HELLO_Message *hello,
99 const char *err_msg) 99 const char *err_msg)
100{ 100{
101 struct MeshPeer *peer; 101 struct CadetPeer *peer;
102 102
103 if (NULL == id || NULL == hello) 103 if (NULL == id || NULL == hello)
104 { 104 {
diff --git a/src/mesh/gnunet-service-mesh_hello.h b/src/mesh/gnunet-service-mesh_hello.h
index 8d8f87072..8e978ea9d 100644
--- a/src/mesh/gnunet-service-mesh_hello.h
+++ b/src/mesh/gnunet-service-mesh_hello.h
@@ -19,15 +19,15 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file mesh/gnunet-service-mesh_hello.h 22 * @file cadet/gnunet-service-cadet_hello.h
23 * @brief mesh service; dealing with hello messages 23 * @brief cadet service; dealing with hello messages
24 * @author Bartlomiej Polot 24 * @author Bartlomiej Polot
25 * 25 *
26 * All functions in this file should use the prefix GMH (Gnunet Mesh Hello) 26 * All functions in this file should use the prefix GMH (Gnunet Cadet Hello)
27 */ 27 */
28 28
29#ifndef GNUNET_SERVICE_MESH_HELLO_H 29#ifndef GNUNET_SERVICE_CADET_HELLO_H
30#define GNUNET_SERVICE_MESH_HELLO_H 30#define GNUNET_SERVICE_CADET_HELLO_H
31 31
32#ifdef __cplusplus 32#ifdef __cplusplus
33extern "C" 33extern "C"
@@ -71,6 +71,6 @@ GMH_get_mine (void);
71} 71}
72#endif 72#endif
73 73
74/* ifndef GNUNET_MESH_SERVICE_HELLO_H */ 74/* ifndef GNUNET_CADET_SERVICE_HELLO_H */
75#endif 75#endif
76/* end of gnunet-mesh-service_hello.h */ 76/* end of gnunet-cadet-service_hello.h */
diff --git a/src/mesh/gnunet-service-mesh_local.c b/src/mesh/gnunet-service-mesh_local.c
index 854def70f..96596ce68 100644
--- a/src/mesh/gnunet-service-mesh_local.c
+++ b/src/mesh/gnunet-service-mesh_local.c
@@ -24,17 +24,17 @@
24 24
25#include "gnunet_statistics_service.h" 25#include "gnunet_statistics_service.h"
26 26
27#include "mesh.h" 27#include "cadet.h"
28#include "mesh_protocol.h" /* GNUNET_MESH_Data is shared */ 28#include "cadet_protocol.h" /* GNUNET_CADET_Data is shared */
29 29
30#include "gnunet-service-mesh_local.h" 30#include "gnunet-service-cadet_local.h"
31#include "gnunet-service-mesh_channel.h" 31#include "gnunet-service-cadet_channel.h"
32 32
33/* INFO DEBUG */ 33/* INFO DEBUG */
34#include "gnunet-service-mesh_tunnel.h" 34#include "gnunet-service-cadet_tunnel.h"
35#include "gnunet-service-mesh_peer.h" 35#include "gnunet-service-cadet_peer.h"
36 36
37#define LOG(level, ...) GNUNET_log_from(level,"mesh-loc",__VA_ARGS__) 37#define LOG(level, ...) GNUNET_log_from(level,"cadet-loc",__VA_ARGS__)
38 38
39/******************************************************************************/ 39/******************************************************************************/
40/******************************** STRUCTS **********************************/ 40/******************************** STRUCTS **********************************/
@@ -45,17 +45,17 @@
45 * 45 *
46 * TODO: add a list of 'waiting' ports 46 * TODO: add a list of 'waiting' ports
47 */ 47 */
48struct MeshClient 48struct CadetClient
49{ 49{
50 /** 50 /**
51 * Linked list next 51 * Linked list next
52 */ 52 */
53 struct MeshClient *next; 53 struct CadetClient *next;
54 54
55 /** 55 /**
56 * Linked list prev 56 * Linked list prev
57 */ 57 */
58 struct MeshClient *prev; 58 struct CadetClient *prev;
59 59
60 /** 60 /**
61 * Tunnels that belong to this client, indexed by local id 61 * Tunnels that belong to this client, indexed by local id
@@ -70,7 +70,7 @@ struct MeshClient
70 /** 70 /**
71 * Channel ID for the next incoming channel. 71 * Channel ID for the next incoming channel.
72 */ 72 */
73 MESH_ChannelNumber next_chid; 73 CADET_ChannelNumber next_chid;
74 74
75 /** 75 /**
76 * Handle to communicate with the client 76 * Handle to communicate with the client
@@ -112,12 +112,12 @@ static struct GNUNET_SERVER_Handle *server_handle;
112/** 112/**
113 * DLL with all the clients, head. 113 * DLL with all the clients, head.
114 */ 114 */
115static struct MeshClient *clients_head; 115static struct CadetClient *clients_head;
116 116
117/** 117/**
118 * DLL with all the clients, tail. 118 * DLL with all the clients, tail.
119 */ 119 */
120static struct MeshClient *clients_tail; 120static struct CadetClient *clients_tail;
121 121
122/** 122/**
123 * Next ID to assign to a client. 123 * Next ID to assign to a client.
@@ -182,15 +182,15 @@ client_release_ports (void *cls,
182static void 182static void
183handle_client_connect (void *cls, struct GNUNET_SERVER_Client *client) 183handle_client_connect (void *cls, struct GNUNET_SERVER_Client *client)
184{ 184{
185 struct MeshClient *c; 185 struct CadetClient *c;
186 186
187 LOG (GNUNET_ERROR_TYPE_DEBUG, "client connected: %p\n", client); 187 LOG (GNUNET_ERROR_TYPE_DEBUG, "client connected: %p\n", client);
188 if (NULL == client) 188 if (NULL == client)
189 return; 189 return;
190 c = GNUNET_new (struct MeshClient); 190 c = GNUNET_new (struct CadetClient);
191 c->handle = client; 191 c->handle = client;
192 c->id = next_client_id++; /* overflow not important: just for debug */ 192 c->id = next_client_id++; /* overflow not important: just for debug */
193 c->next_chid = GNUNET_MESH_LOCAL_CHANNEL_ID_SERV; 193 c->next_chid = GNUNET_CADET_LOCAL_CHANNEL_ID_SERV;
194 GNUNET_SERVER_client_keep (client); 194 GNUNET_SERVER_client_keep (client);
195 GNUNET_SERVER_client_set_user_context (client, c); 195 GNUNET_SERVER_client_set_user_context (client, c);
196 GNUNET_CONTAINER_DLL_insert (clients_head, clients_tail, c); 196 GNUNET_CONTAINER_DLL_insert (clients_head, clients_tail, c);
@@ -211,14 +211,14 @@ channel_destroy_iterator (void *cls,
211 uint32_t key, 211 uint32_t key,
212 void *value) 212 void *value)
213{ 213{
214 struct MeshChannel *ch = value; 214 struct CadetChannel *ch = value;
215 struct MeshClient *c = cls; 215 struct CadetClient *c = cls;
216 216
217 LOG (GNUNET_ERROR_TYPE_DEBUG, 217 LOG (GNUNET_ERROR_TYPE_DEBUG,
218 " Channel %s destroy, due to client %s shutdown.\n", 218 " Channel %s destroy, due to client %s shutdown.\n",
219 GMCH_2s (ch), GML_2s (c)); 219 GMCH_2s (ch), GML_2s (c));
220 220
221 GMCH_handle_local_destroy (ch, c, key < GNUNET_MESH_LOCAL_CHANNEL_ID_SERV); 221 GMCH_handle_local_destroy (ch, c, key < GNUNET_CADET_LOCAL_CHANNEL_ID_SERV);
222 return GNUNET_OK; 222 return GNUNET_OK;
223} 223}
224 224
@@ -232,7 +232,7 @@ channel_destroy_iterator (void *cls,
232static void 232static void
233handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client) 233handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client)
234{ 234{
235 struct MeshClient *c; 235 struct CadetClient *c;
236 236
237 LOG (GNUNET_ERROR_TYPE_DEBUG, "client disconnected: %p\n", client); 237 LOG (GNUNET_ERROR_TYPE_DEBUG, "client disconnected: %p\n", client);
238 if (client == NULL) 238 if (client == NULL)
@@ -293,8 +293,8 @@ static void
293handle_new_client (void *cls, struct GNUNET_SERVER_Client *client, 293handle_new_client (void *cls, struct GNUNET_SERVER_Client *client,
294 const struct GNUNET_MessageHeader *message) 294 const struct GNUNET_MessageHeader *message)
295{ 295{
296 struct GNUNET_MESH_ClientConnect *cc_msg; 296 struct GNUNET_CADET_ClientConnect *cc_msg;
297 struct MeshClient *c; 297 struct CadetClient *c;
298 unsigned int size; 298 unsigned int size;
299 uint32_t *p; 299 uint32_t *p;
300 unsigned int i; 300 unsigned int i;
@@ -303,8 +303,8 @@ handle_new_client (void *cls, struct GNUNET_SERVER_Client *client,
303 LOG (GNUNET_ERROR_TYPE_DEBUG, "new client connected %p\n", client); 303 LOG (GNUNET_ERROR_TYPE_DEBUG, "new client connected %p\n", client);
304 304
305 /* Check data sanity */ 305 /* Check data sanity */
306 size = ntohs (message->size) - sizeof (struct GNUNET_MESH_ClientConnect); 306 size = ntohs (message->size) - sizeof (struct GNUNET_CADET_ClientConnect);
307 cc_msg = (struct GNUNET_MESH_ClientConnect *) message; 307 cc_msg = (struct GNUNET_CADET_ClientConnect *) message;
308 if (0 != (size % sizeof (uint32_t))) 308 if (0 != (size % sizeof (uint32_t)))
309 { 309 {
310 GNUNET_break (0); 310 GNUNET_break (0);
@@ -314,7 +314,7 @@ handle_new_client (void *cls, struct GNUNET_SERVER_Client *client,
314 size /= sizeof (uint32_t); 314 size /= sizeof (uint32_t);
315 315
316 /* Initialize new client structure */ 316 /* Initialize new client structure */
317 c = GNUNET_SERVER_client_get_user_context (client, struct MeshClient); 317 c = GNUNET_SERVER_client_get_user_context (client, struct CadetClient);
318 LOG (GNUNET_ERROR_TYPE_DEBUG, " client id %u\n", c->id); 318 LOG (GNUNET_ERROR_TYPE_DEBUG, " client id %u\n", c->id);
319 LOG (GNUNET_ERROR_TYPE_DEBUG, " client has %u ports\n", size); 319 LOG (GNUNET_ERROR_TYPE_DEBUG, " client has %u ports\n", size);
320 if (size > 0) 320 if (size > 0)
@@ -360,7 +360,7 @@ static void
360handle_channel_create (void *cls, struct GNUNET_SERVER_Client *client, 360handle_channel_create (void *cls, struct GNUNET_SERVER_Client *client,
361 const struct GNUNET_MessageHeader *message) 361 const struct GNUNET_MessageHeader *message)
362{ 362{
363 struct MeshClient *c; 363 struct CadetClient *c;
364 364
365 LOG (GNUNET_ERROR_TYPE_DEBUG, "\n"); 365 LOG (GNUNET_ERROR_TYPE_DEBUG, "\n");
366 LOG (GNUNET_ERROR_TYPE_DEBUG, "new channel requested\n"); 366 LOG (GNUNET_ERROR_TYPE_DEBUG, "new channel requested\n");
@@ -375,7 +375,7 @@ handle_channel_create (void *cls, struct GNUNET_SERVER_Client *client,
375 LOG (GNUNET_ERROR_TYPE_DEBUG, " by client %u\n", c->id); 375 LOG (GNUNET_ERROR_TYPE_DEBUG, " by client %u\n", c->id);
376 376
377 /* Message size sanity check */ 377 /* Message size sanity check */
378 if (sizeof (struct GNUNET_MESH_ChannelMessage) != ntohs (message->size)) 378 if (sizeof (struct GNUNET_CADET_ChannelMessage) != ntohs (message->size))
379 { 379 {
380 GNUNET_break (0); 380 GNUNET_break (0);
381 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 381 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
@@ -384,7 +384,7 @@ handle_channel_create (void *cls, struct GNUNET_SERVER_Client *client,
384 384
385 if (GNUNET_OK != 385 if (GNUNET_OK !=
386 GMCH_handle_local_create (c, 386 GMCH_handle_local_create (c,
387 (struct GNUNET_MESH_ChannelMessage *) message)) 387 (struct GNUNET_CADET_ChannelMessage *) message))
388 { 388 {
389 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 389 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
390 return; 390 return;
@@ -406,10 +406,10 @@ static void
406handle_channel_destroy (void *cls, struct GNUNET_SERVER_Client *client, 406handle_channel_destroy (void *cls, struct GNUNET_SERVER_Client *client,
407 const struct GNUNET_MessageHeader *message) 407 const struct GNUNET_MessageHeader *message)
408{ 408{
409 struct GNUNET_MESH_ChannelMessage *msg; 409 struct GNUNET_CADET_ChannelMessage *msg;
410 struct MeshClient *c; 410 struct CadetClient *c;
411 struct MeshChannel *ch; 411 struct CadetChannel *ch;
412 MESH_ChannelNumber chid; 412 CADET_ChannelNumber chid;
413 413
414 LOG (GNUNET_ERROR_TYPE_DEBUG, "Got a DESTROY CHANNEL from client!\n"); 414 LOG (GNUNET_ERROR_TYPE_DEBUG, "Got a DESTROY CHANNEL from client!\n");
415 415
@@ -423,14 +423,14 @@ handle_channel_destroy (void *cls, struct GNUNET_SERVER_Client *client,
423 LOG (GNUNET_ERROR_TYPE_DEBUG, " by client %u\n", c->id); 423 LOG (GNUNET_ERROR_TYPE_DEBUG, " by client %u\n", c->id);
424 424
425 /* Message sanity check */ 425 /* Message sanity check */
426 if (sizeof (struct GNUNET_MESH_ChannelMessage) != ntohs (message->size)) 426 if (sizeof (struct GNUNET_CADET_ChannelMessage) != ntohs (message->size))
427 { 427 {
428 GNUNET_break (0); 428 GNUNET_break (0);
429 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 429 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
430 return; 430 return;
431 } 431 }
432 432
433 msg = (struct GNUNET_MESH_ChannelMessage *) message; 433 msg = (struct GNUNET_CADET_ChannelMessage *) message;
434 434
435 /* Retrieve tunnel */ 435 /* Retrieve tunnel */
436 chid = ntohl (msg->channel_id); 436 chid = ntohl (msg->channel_id);
@@ -446,7 +446,7 @@ handle_channel_destroy (void *cls, struct GNUNET_SERVER_Client *client,
446 return; 446 return;
447 } 447 }
448 448
449 GMCH_handle_local_destroy (ch, c, chid < GNUNET_MESH_LOCAL_CHANNEL_ID_SERV); 449 GMCH_handle_local_destroy (ch, c, chid < GNUNET_CADET_LOCAL_CHANNEL_ID_SERV);
450 450
451 GNUNET_SERVER_receive_done (client, GNUNET_OK); 451 GNUNET_SERVER_receive_done (client, GNUNET_OK);
452 return; 452 return;
@@ -464,10 +464,10 @@ static void
464handle_data (void *cls, struct GNUNET_SERVER_Client *client, 464handle_data (void *cls, struct GNUNET_SERVER_Client *client,
465 const struct GNUNET_MessageHeader *message) 465 const struct GNUNET_MessageHeader *message)
466{ 466{
467 struct GNUNET_MESH_LocalData *msg; 467 struct GNUNET_CADET_LocalData *msg;
468 struct MeshClient *c; 468 struct CadetClient *c;
469 struct MeshChannel *ch; 469 struct CadetChannel *ch;
470 MESH_ChannelNumber chid; 470 CADET_ChannelNumber chid;
471 size_t size; 471 size_t size;
472 int fwd; 472 int fwd;
473 473
@@ -482,10 +482,10 @@ handle_data (void *cls, struct GNUNET_SERVER_Client *client,
482 } 482 }
483 LOG (GNUNET_ERROR_TYPE_DEBUG, " by client %u\n", c->id); 483 LOG (GNUNET_ERROR_TYPE_DEBUG, " by client %u\n", c->id);
484 484
485 msg = (struct GNUNET_MESH_LocalData *) message; 485 msg = (struct GNUNET_CADET_LocalData *) message;
486 486
487 /* Sanity check for message size */ 487 /* Sanity check for message size */
488 size = ntohs (message->size) - sizeof (struct GNUNET_MESH_LocalData); 488 size = ntohs (message->size) - sizeof (struct GNUNET_CADET_LocalData);
489 if (size < sizeof (struct GNUNET_MessageHeader)) 489 if (size < sizeof (struct GNUNET_MessageHeader))
490 { 490 {
491 GNUNET_break (0); 491 GNUNET_break (0);
@@ -496,7 +496,7 @@ handle_data (void *cls, struct GNUNET_SERVER_Client *client,
496 /* Channel exists? */ 496 /* Channel exists? */
497 chid = ntohl (msg->id); 497 chid = ntohl (msg->id);
498 LOG (GNUNET_ERROR_TYPE_DEBUG, " on channel %X\n", chid); 498 LOG (GNUNET_ERROR_TYPE_DEBUG, " on channel %X\n", chid);
499 fwd = chid < GNUNET_MESH_LOCAL_CHANNEL_ID_SERV; 499 fwd = chid < GNUNET_CADET_LOCAL_CHANNEL_ID_SERV;
500 ch = GML_channel_get (c, chid); 500 ch = GML_channel_get (c, chid);
501 if (NULL == ch) 501 if (NULL == ch)
502 { 502 {
@@ -533,10 +533,10 @@ static void
533handle_ack (void *cls, struct GNUNET_SERVER_Client *client, 533handle_ack (void *cls, struct GNUNET_SERVER_Client *client,
534 const struct GNUNET_MessageHeader *message) 534 const struct GNUNET_MessageHeader *message)
535{ 535{
536 struct GNUNET_MESH_LocalAck *msg; 536 struct GNUNET_CADET_LocalAck *msg;
537 struct MeshChannel *ch; 537 struct CadetChannel *ch;
538 struct MeshClient *c; 538 struct CadetClient *c;
539 MESH_ChannelNumber chid; 539 CADET_ChannelNumber chid;
540 int fwd; 540 int fwd;
541 541
542 LOG (GNUNET_ERROR_TYPE_DEBUG, "\n"); 542 LOG (GNUNET_ERROR_TYPE_DEBUG, "\n");
@@ -551,7 +551,7 @@ handle_ack (void *cls, struct GNUNET_SERVER_Client *client,
551 } 551 }
552 LOG (GNUNET_ERROR_TYPE_DEBUG, " by client %u\n", c->id); 552 LOG (GNUNET_ERROR_TYPE_DEBUG, " by client %u\n", c->id);
553 553
554 msg = (struct GNUNET_MESH_LocalAck *) message; 554 msg = (struct GNUNET_CADET_LocalAck *) message;
555 555
556 /* Channel exists? */ 556 /* Channel exists? */
557 chid = ntohl (msg->channel_id); 557 chid = ntohl (msg->channel_id);
@@ -571,7 +571,7 @@ handle_ack (void *cls, struct GNUNET_SERVER_Client *client,
571 571
572 /* If client is root, the ACK is going FWD, therefore this is "BCK ACK". */ 572 /* If client is root, the ACK is going FWD, therefore this is "BCK ACK". */
573 /* If client is dest, the ACK is going BCK, therefore this is "FWD ACK" */ 573 /* If client is dest, the ACK is going BCK, therefore this is "FWD ACK" */
574 fwd = chid >= GNUNET_MESH_LOCAL_CHANNEL_ID_SERV; 574 fwd = chid >= GNUNET_CADET_LOCAL_CHANNEL_ID_SERV;
575 575
576 GMCH_handle_local_ack (ch, fwd); 576 GMCH_handle_local_ack (ch, fwd);
577 GNUNET_SERVER_receive_done (client, GNUNET_OK); 577 GNUNET_SERVER_receive_done (client, GNUNET_OK);
@@ -596,11 +596,11 @@ get_all_peers_iterator (void *cls,
596 void *value) 596 void *value)
597{ 597{
598 struct GNUNET_SERVER_Client *client = cls; 598 struct GNUNET_SERVER_Client *client = cls;
599 struct MeshPeer *p = value; 599 struct CadetPeer *p = value;
600 struct GNUNET_MESH_LocalInfoPeer msg; 600 struct GNUNET_CADET_LocalInfoPeer msg;
601 601
602 msg.header.size = htons (sizeof (msg)); 602 msg.header.size = htons (sizeof (msg));
603 msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_PEERS); 603 msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS);
604 msg.destination = *peer; 604 msg.destination = *peer;
605 msg.paths = htons (GMP_count_paths (p)); 605 msg.paths = htons (GMP_count_paths (p));
606 msg.tunnel = htons (NULL != GMP_get_tunnel (p)); 606 msg.tunnel = htons (NULL != GMP_get_tunnel (p));
@@ -625,7 +625,7 @@ static void
625handle_get_peers (void *cls, struct GNUNET_SERVER_Client *client, 625handle_get_peers (void *cls, struct GNUNET_SERVER_Client *client,
626 const struct GNUNET_MessageHeader *message) 626 const struct GNUNET_MessageHeader *message)
627{ 627{
628 struct MeshClient *c; 628 struct CadetClient *c;
629 struct GNUNET_MessageHeader reply; 629 struct GNUNET_MessageHeader reply;
630 630
631 /* Sanity check for client registration */ 631 /* Sanity check for client registration */
@@ -642,7 +642,7 @@ handle_get_peers (void *cls, struct GNUNET_SERVER_Client *client,
642 642
643 GMP_iterate_all (get_all_peers_iterator, client); 643 GMP_iterate_all (get_all_peers_iterator, client);
644 reply.size = htons (sizeof (reply)); 644 reply.size = htons (sizeof (reply));
645 reply.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_PEERS); 645 reply.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS);
646 GNUNET_SERVER_notification_context_unicast (nc, client, &reply, GNUNET_NO); 646 GNUNET_SERVER_notification_context_unicast (nc, client, &reply, GNUNET_NO);
647 647
648 LOG (GNUNET_ERROR_TYPE_DEBUG, 648 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -666,11 +666,11 @@ get_all_tunnels_iterator (void *cls,
666 void *value) 666 void *value)
667{ 667{
668 struct GNUNET_SERVER_Client *client = cls; 668 struct GNUNET_SERVER_Client *client = cls;
669 struct MeshTunnel3 *t = value; 669 struct CadetTunnel3 *t = value;
670 struct GNUNET_MESH_LocalInfoTunnel msg; 670 struct GNUNET_CADET_LocalInfoTunnel msg;
671 671
672 msg.header.size = htons (sizeof (msg)); 672 msg.header.size = htons (sizeof (msg));
673 msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS); 673 msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS);
674 msg.destination = *peer; 674 msg.destination = *peer;
675 msg.channels = htonl (GMT_count_channels (t)); 675 msg.channels = htonl (GMT_count_channels (t));
676 msg.connections = htonl (GMT_count_connections (t)); 676 msg.connections = htonl (GMT_count_connections (t));
@@ -697,7 +697,7 @@ static void
697handle_get_tunnels (void *cls, struct GNUNET_SERVER_Client *client, 697handle_get_tunnels (void *cls, struct GNUNET_SERVER_Client *client,
698 const struct GNUNET_MessageHeader *message) 698 const struct GNUNET_MessageHeader *message)
699{ 699{
700 struct MeshClient *c; 700 struct CadetClient *c;
701 struct GNUNET_MessageHeader reply; 701 struct GNUNET_MessageHeader reply;
702 702
703 /* Sanity check for client registration */ 703 /* Sanity check for client registration */
@@ -714,7 +714,7 @@ handle_get_tunnels (void *cls, struct GNUNET_SERVER_Client *client,
714 714
715 GMT_iterate_all (get_all_tunnels_iterator, client); 715 GMT_iterate_all (get_all_tunnels_iterator, client);
716 reply.size = htons (sizeof (reply)); 716 reply.size = htons (sizeof (reply));
717 reply.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS); 717 reply.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS);
718 GNUNET_SERVER_notification_context_unicast (nc, client, &reply, GNUNET_NO); 718 GNUNET_SERVER_notification_context_unicast (nc, client, &reply, GNUNET_NO);
719 719
720 LOG (GNUNET_ERROR_TYPE_DEBUG, 720 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -724,21 +724,21 @@ handle_get_tunnels (void *cls, struct GNUNET_SERVER_Client *client,
724 724
725 725
726static void 726static void
727iter_connection (void *cls, struct MeshConnection *c) 727iter_connection (void *cls, struct CadetConnection *c)
728{ 728{
729 struct GNUNET_MESH_LocalInfoTunnel *msg = cls; 729 struct GNUNET_CADET_LocalInfoTunnel *msg = cls;
730 struct GNUNET_MESH_Hash *h = (struct GNUNET_MESH_Hash *) &msg[1]; 730 struct GNUNET_CADET_Hash *h = (struct GNUNET_CADET_Hash *) &msg[1];
731 731
732 h[msg->connections] = *(GMC_get_id (c)); 732 h[msg->connections] = *(GMC_get_id (c));
733 msg->connections++; 733 msg->connections++;
734} 734}
735 735
736static void 736static void
737iter_channel (void *cls, struct MeshChannel *ch) 737iter_channel (void *cls, struct CadetChannel *ch)
738{ 738{
739 struct GNUNET_MESH_LocalInfoTunnel *msg = cls; 739 struct GNUNET_CADET_LocalInfoTunnel *msg = cls;
740 struct GNUNET_HashCode *h = (struct GNUNET_HashCode *) &msg[1]; 740 struct GNUNET_HashCode *h = (struct GNUNET_HashCode *) &msg[1];
741 MESH_ChannelNumber *chn = (MESH_ChannelNumber *) &h[msg->connections]; 741 CADET_ChannelNumber *chn = (CADET_ChannelNumber *) &h[msg->connections];
742 742
743 chn[msg->channels] = GMCH_get_id (ch); 743 chn[msg->channels] = GMCH_get_id (ch);
744 msg->channels++; 744 msg->channels++;
@@ -756,10 +756,10 @@ void
756handle_show_tunnel (void *cls, struct GNUNET_SERVER_Client *client, 756handle_show_tunnel (void *cls, struct GNUNET_SERVER_Client *client,
757 const struct GNUNET_MessageHeader *message) 757 const struct GNUNET_MessageHeader *message)
758{ 758{
759 const struct GNUNET_MESH_LocalInfo *msg; 759 const struct GNUNET_CADET_LocalInfo *msg;
760 struct GNUNET_MESH_LocalInfoTunnel *resp; 760 struct GNUNET_CADET_LocalInfoTunnel *resp;
761 struct MeshClient *c; 761 struct CadetClient *c;
762 struct MeshTunnel3 *t; 762 struct CadetTunnel3 *t;
763 unsigned int ch_n; 763 unsigned int ch_n;
764 unsigned int c_n; 764 unsigned int c_n;
765 size_t size; 765 size_t size;
@@ -772,7 +772,7 @@ handle_show_tunnel (void *cls, struct GNUNET_SERVER_Client *client,
772 return; 772 return;
773 } 773 }
774 774
775 msg = (struct GNUNET_MESH_LocalInfo *) message; 775 msg = (struct GNUNET_CADET_LocalInfo *) message;
776 LOG (GNUNET_ERROR_TYPE_INFO, 776 LOG (GNUNET_ERROR_TYPE_INFO,
777 "Received tunnel info request from client %u for tunnel %s\n", 777 "Received tunnel info request from client %u for tunnel %s\n",
778 c->id, GNUNET_i2s_full(&msg->peer)); 778 c->id, GNUNET_i2s_full(&msg->peer));
@@ -781,11 +781,11 @@ handle_show_tunnel (void *cls, struct GNUNET_SERVER_Client *client,
781 if (NULL == t) 781 if (NULL == t)
782 { 782 {
783 /* We don't know the tunnel */ 783 /* We don't know the tunnel */
784 struct GNUNET_MESH_LocalInfoTunnel warn; 784 struct GNUNET_CADET_LocalInfoTunnel warn;
785 785
786 LOG (GNUNET_ERROR_TYPE_INFO, "Tunnel %s unknown %u\n", 786 LOG (GNUNET_ERROR_TYPE_INFO, "Tunnel %s unknown %u\n",
787 GNUNET_i2s_full(&msg->peer), sizeof (warn)); 787 GNUNET_i2s_full(&msg->peer), sizeof (warn));
788 warn.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNEL); 788 warn.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL);
789 warn.header.size = htons (sizeof (warn)); 789 warn.header.size = htons (sizeof (warn));
790 warn.destination = msg->peer; 790 warn.destination = msg->peer;
791 warn.channels = htonl (0); 791 warn.channels = htonl (0);
@@ -804,12 +804,12 @@ handle_show_tunnel (void *cls, struct GNUNET_SERVER_Client *client,
804 ch_n = GMT_count_channels (t); 804 ch_n = GMT_count_channels (t);
805 c_n = GMT_count_connections (t); 805 c_n = GMT_count_connections (t);
806 806
807 size = sizeof (struct GNUNET_MESH_LocalInfoTunnel); 807 size = sizeof (struct GNUNET_CADET_LocalInfoTunnel);
808 size += c_n * sizeof (struct GNUNET_MESH_Hash); 808 size += c_n * sizeof (struct GNUNET_CADET_Hash);
809 size += ch_n * sizeof (MESH_ChannelNumber); 809 size += ch_n * sizeof (CADET_ChannelNumber);
810 810
811 resp = GNUNET_malloc (size); 811 resp = GNUNET_malloc (size);
812 resp->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNEL); 812 resp->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL);
813 resp->header.size = htons (size); 813 resp->header.size = htons (size);
814 GMT_iterate_connections (t, &iter_connection, resp); 814 GMT_iterate_connections (t, &iter_connection, resp);
815 GMT_iterate_channels (t, &iter_channel, resp); 815 GMT_iterate_channels (t, &iter_channel, resp);
@@ -834,20 +834,20 @@ handle_show_tunnel (void *cls, struct GNUNET_SERVER_Client *client,
834 * Functions to handle messages from clients 834 * Functions to handle messages from clients
835 */ 835 */
836static struct GNUNET_SERVER_MessageHandler client_handlers[] = { 836static struct GNUNET_SERVER_MessageHandler client_handlers[] = {
837 {&handle_new_client, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT, 0}, 837 {&handle_new_client, NULL, GNUNET_MESSAGE_TYPE_CADET_LOCAL_CONNECT, 0},
838 {&handle_channel_create, NULL, GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE, 838 {&handle_channel_create, NULL, GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE,
839 sizeof (struct GNUNET_MESH_ChannelMessage)}, 839 sizeof (struct GNUNET_CADET_ChannelMessage)},
840 {&handle_channel_destroy, NULL, GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY, 840 {&handle_channel_destroy, NULL, GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY,
841 sizeof (struct GNUNET_MESH_ChannelMessage)}, 841 sizeof (struct GNUNET_CADET_ChannelMessage)},
842 {&handle_data, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA, 0}, 842 {&handle_data, NULL, GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA, 0},
843 {&handle_ack, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK, 843 {&handle_ack, NULL, GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK,
844 sizeof (struct GNUNET_MESH_LocalAck)}, 844 sizeof (struct GNUNET_CADET_LocalAck)},
845 {&handle_get_peers, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_PEERS, 845 {&handle_get_peers, NULL, GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS,
846 sizeof (struct GNUNET_MessageHeader)}, 846 sizeof (struct GNUNET_MessageHeader)},
847 {&handle_get_tunnels, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS, 847 {&handle_get_tunnels, NULL, GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS,
848 sizeof (struct GNUNET_MessageHeader)}, 848 sizeof (struct GNUNET_MessageHeader)},
849 {&handle_show_tunnel, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNEL, 849 {&handle_show_tunnel, NULL, GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL,
850 sizeof (struct GNUNET_MESH_LocalInfo)}, 850 sizeof (struct GNUNET_CADET_LocalInfo)},
851 {NULL, NULL, 0, 0} 851 {NULL, NULL, 0, 0}
852}; 852};
853 853
@@ -913,21 +913,21 @@ GML_shutdown (void)
913 * 913 *
914 * @return non-NULL if channel exists in the clients lists 914 * @return non-NULL if channel exists in the clients lists
915 */ 915 */
916struct MeshChannel * 916struct CadetChannel *
917GML_channel_get (struct MeshClient *c, MESH_ChannelNumber chid) 917GML_channel_get (struct CadetClient *c, CADET_ChannelNumber chid)
918{ 918{
919 struct GNUNET_CONTAINER_MultiHashMap32 *map; 919 struct GNUNET_CONTAINER_MultiHashMap32 *map;
920 920
921 if (0 == (chid & GNUNET_MESH_LOCAL_CHANNEL_ID_CLI)) 921 if (0 == (chid & GNUNET_CADET_LOCAL_CHANNEL_ID_CLI))
922 { 922 {
923 GNUNET_break_op (0); 923 GNUNET_break_op (0);
924 LOG (GNUNET_ERROR_TYPE_DEBUG, "CHID %X not a local chid\n", chid); 924 LOG (GNUNET_ERROR_TYPE_DEBUG, "CHID %X not a local chid\n", chid);
925 return NULL; 925 return NULL;
926 } 926 }
927 927
928 if (chid >= GNUNET_MESH_LOCAL_CHANNEL_ID_SERV) 928 if (chid >= GNUNET_CADET_LOCAL_CHANNEL_ID_SERV)
929 map = c->incoming_channels; 929 map = c->incoming_channels;
930 else if (chid >= GNUNET_MESH_LOCAL_CHANNEL_ID_CLI) 930 else if (chid >= GNUNET_CADET_LOCAL_CHANNEL_ID_CLI)
931 map = c->own_channels; 931 map = c->own_channels;
932 else 932 else
933 { 933 {
@@ -954,14 +954,14 @@ GML_channel_get (struct MeshClient *c, MESH_ChannelNumber chid)
954 * @param ch Channel. 954 * @param ch Channel.
955 */ 955 */
956void 956void
957GML_channel_add (struct MeshClient *client, 957GML_channel_add (struct CadetClient *client,
958 uint32_t chid, 958 uint32_t chid,
959 struct MeshChannel *ch) 959 struct CadetChannel *ch)
960{ 960{
961 if (chid >= GNUNET_MESH_LOCAL_CHANNEL_ID_SERV) 961 if (chid >= GNUNET_CADET_LOCAL_CHANNEL_ID_SERV)
962 GNUNET_CONTAINER_multihashmap32_put (client->incoming_channels, chid, ch, 962 GNUNET_CONTAINER_multihashmap32_put (client->incoming_channels, chid, ch,
963 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); 963 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
964 else if (chid >= GNUNET_MESH_LOCAL_CHANNEL_ID_CLI) 964 else if (chid >= GNUNET_CADET_LOCAL_CHANNEL_ID_CLI)
965 GNUNET_CONTAINER_multihashmap32_put (client->own_channels, chid, ch, 965 GNUNET_CONTAINER_multihashmap32_put (client->own_channels, chid, ch,
966 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); 966 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
967 else 967 else
@@ -977,15 +977,15 @@ GML_channel_add (struct MeshClient *client,
977 * @param ch Channel. 977 * @param ch Channel.
978 */ 978 */
979void 979void
980GML_channel_remove (struct MeshClient *client, 980GML_channel_remove (struct CadetClient *client,
981 uint32_t chid, 981 uint32_t chid,
982 struct MeshChannel *ch) 982 struct CadetChannel *ch)
983{ 983{
984 if (GNUNET_MESH_LOCAL_CHANNEL_ID_SERV <= chid) 984 if (GNUNET_CADET_LOCAL_CHANNEL_ID_SERV <= chid)
985 GNUNET_break (GNUNET_YES == 985 GNUNET_break (GNUNET_YES ==
986 GNUNET_CONTAINER_multihashmap32_remove (client->incoming_channels, 986 GNUNET_CONTAINER_multihashmap32_remove (client->incoming_channels,
987 chid, ch)); 987 chid, ch));
988 else if (GNUNET_MESH_LOCAL_CHANNEL_ID_CLI <= chid) 988 else if (GNUNET_CADET_LOCAL_CHANNEL_ID_CLI <= chid)
989 GNUNET_break (GNUNET_YES == 989 GNUNET_break (GNUNET_YES ==
990 GNUNET_CONTAINER_multihashmap32_remove (client->own_channels, 990 GNUNET_CONTAINER_multihashmap32_remove (client->own_channels,
991 chid, ch)); 991 chid, ch));
@@ -1001,18 +1001,18 @@ GML_channel_remove (struct MeshClient *client,
1001 * 1001 *
1002 * @return LID of a channel free to use. 1002 * @return LID of a channel free to use.
1003 */ 1003 */
1004MESH_ChannelNumber 1004CADET_ChannelNumber
1005GML_get_next_chid (struct MeshClient *c) 1005GML_get_next_chid (struct CadetClient *c)
1006{ 1006{
1007 MESH_ChannelNumber chid; 1007 CADET_ChannelNumber chid;
1008 1008
1009 while (NULL != GML_channel_get (c, c->next_chid)) 1009 while (NULL != GML_channel_get (c, c->next_chid))
1010 { 1010 {
1011 LOG (GNUNET_ERROR_TYPE_DEBUG, "Channel %u exists...\n", c->next_chid); 1011 LOG (GNUNET_ERROR_TYPE_DEBUG, "Channel %u exists...\n", c->next_chid);
1012 c->next_chid = (c->next_chid + 1) | GNUNET_MESH_LOCAL_CHANNEL_ID_SERV; 1012 c->next_chid = (c->next_chid + 1) | GNUNET_CADET_LOCAL_CHANNEL_ID_SERV;
1013 } 1013 }
1014 chid = c->next_chid; 1014 chid = c->next_chid;
1015 c->next_chid = (c->next_chid + 1) | GNUNET_MESH_LOCAL_CHANNEL_ID_SERV; 1015 c->next_chid = (c->next_chid + 1) | GNUNET_CADET_LOCAL_CHANNEL_ID_SERV;
1016 1016
1017 return chid; 1017 return chid;
1018} 1018}
@@ -1025,10 +1025,10 @@ GML_get_next_chid (struct MeshClient *c)
1025 * 1025 *
1026 * @return non-NULL if client exists in the global DLL 1026 * @return non-NULL if client exists in the global DLL
1027 */ 1027 */
1028struct MeshClient * 1028struct CadetClient *
1029GML_client_get (struct GNUNET_SERVER_Client *client) 1029GML_client_get (struct GNUNET_SERVER_Client *client)
1030{ 1030{
1031 return GNUNET_SERVER_client_get_user_context (client, struct MeshClient); 1031 return GNUNET_SERVER_client_get_user_context (client, struct CadetClient);
1032} 1032}
1033 1033
1034/** 1034/**
@@ -1038,7 +1038,7 @@ GML_client_get (struct GNUNET_SERVER_Client *client)
1038 * 1038 *
1039 * @return non-NULL if a client has the port. 1039 * @return non-NULL if a client has the port.
1040 */ 1040 */
1041struct MeshClient * 1041struct CadetClient *
1042GML_client_get_by_port (uint32_t port) 1042GML_client_get_by_port (uint32_t port)
1043{ 1043{
1044 return GNUNET_CONTAINER_multihashmap32_get (ports, port); 1044 return GNUNET_CONTAINER_multihashmap32_get (ports, port);
@@ -1053,20 +1053,20 @@ GML_client_get_by_port (uint32_t port)
1053 * @param id Channel ID. 1053 * @param id Channel ID.
1054 */ 1054 */
1055void 1055void
1056GML_client_delete_channel (struct MeshClient *c, 1056GML_client_delete_channel (struct CadetClient *c,
1057 struct MeshChannel *ch, 1057 struct CadetChannel *ch,
1058 MESH_ChannelNumber id) 1058 CADET_ChannelNumber id)
1059{ 1059{
1060 int res; 1060 int res;
1061 1061
1062 if (GNUNET_MESH_LOCAL_CHANNEL_ID_SERV <= id) 1062 if (GNUNET_CADET_LOCAL_CHANNEL_ID_SERV <= id)
1063 { 1063 {
1064 res = GNUNET_CONTAINER_multihashmap32_remove (c->incoming_channels, 1064 res = GNUNET_CONTAINER_multihashmap32_remove (c->incoming_channels,
1065 id, ch); 1065 id, ch);
1066 if (GNUNET_YES != res) 1066 if (GNUNET_YES != res)
1067 LOG (GNUNET_ERROR_TYPE_DEBUG, "client_delete_channel dest KO\n"); 1067 LOG (GNUNET_ERROR_TYPE_DEBUG, "client_delete_channel dest KO\n");
1068 } 1068 }
1069 else if (GNUNET_MESH_LOCAL_CHANNEL_ID_CLI <= id) 1069 else if (GNUNET_CADET_LOCAL_CHANNEL_ID_CLI <= id)
1070 { 1070 {
1071 res = GNUNET_CONTAINER_multihashmap32_remove (c->own_channels, 1071 res = GNUNET_CONTAINER_multihashmap32_remove (c->own_channels,
1072 id, ch); 1072 id, ch);
@@ -1088,16 +1088,16 @@ GML_client_delete_channel (struct MeshClient *c,
1088 * @param id Channel ID to use 1088 * @param id Channel ID to use
1089 */ 1089 */
1090void 1090void
1091GML_send_ack (struct MeshClient *c, MESH_ChannelNumber id) 1091GML_send_ack (struct CadetClient *c, CADET_ChannelNumber id)
1092{ 1092{
1093 struct GNUNET_MESH_LocalAck msg; 1093 struct GNUNET_CADET_LocalAck msg;
1094 1094
1095 LOG (GNUNET_ERROR_TYPE_DEBUG, 1095 LOG (GNUNET_ERROR_TYPE_DEBUG,
1096 "send local %s ack on %X towards %p\n", 1096 "send local %s ack on %X towards %p\n",
1097 id < GNUNET_MESH_LOCAL_CHANNEL_ID_SERV ? "FWD" : "BCK", id, c); 1097 id < GNUNET_CADET_LOCAL_CHANNEL_ID_SERV ? "FWD" : "BCK", id, c);
1098 1098
1099 msg.header.size = htons (sizeof (msg)); 1099 msg.header.size = htons (sizeof (msg));
1100 msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK); 1100 msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK);
1101 msg.channel_id = htonl (id); 1101 msg.channel_id = htonl (id);
1102 GNUNET_SERVER_notification_context_unicast (nc, 1102 GNUNET_SERVER_notification_context_unicast (nc,
1103 c->handle, 1103 c->handle,
@@ -1118,14 +1118,14 @@ GML_send_ack (struct MeshClient *c, MESH_ChannelNumber id)
1118 * @param peer Origin peer. 1118 * @param peer Origin peer.
1119 */ 1119 */
1120void 1120void
1121GML_send_channel_create (struct MeshClient *c, 1121GML_send_channel_create (struct CadetClient *c,
1122 uint32_t id, uint32_t port, uint32_t opt, 1122 uint32_t id, uint32_t port, uint32_t opt,
1123 const struct GNUNET_PeerIdentity *peer) 1123 const struct GNUNET_PeerIdentity *peer)
1124{ 1124{
1125 struct GNUNET_MESH_ChannelMessage msg; 1125 struct GNUNET_CADET_ChannelMessage msg;
1126 1126
1127 msg.header.size = htons (sizeof (msg)); 1127 msg.header.size = htons (sizeof (msg));
1128 msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE); 1128 msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE);
1129 msg.channel_id = htonl (id); 1129 msg.channel_id = htonl (id);
1130 msg.port = htonl (port); 1130 msg.port = htonl (port);
1131 msg.opt = htonl (opt); 1131 msg.opt = htonl (opt);
@@ -1142,16 +1142,16 @@ GML_send_channel_create (struct MeshClient *c,
1142 * @param id Channel ID to use 1142 * @param id Channel ID to use
1143 */ 1143 */
1144void 1144void
1145GML_send_channel_nack (struct MeshClient *c, MESH_ChannelNumber id) 1145GML_send_channel_nack (struct CadetClient *c, CADET_ChannelNumber id)
1146{ 1146{
1147 struct GNUNET_MESH_LocalAck msg; 1147 struct GNUNET_CADET_LocalAck msg;
1148 1148
1149 LOG (GNUNET_ERROR_TYPE_DEBUG, 1149 LOG (GNUNET_ERROR_TYPE_DEBUG,
1150 "send local nack on %X towards %p\n", 1150 "send local nack on %X towards %p\n",
1151 id, c); 1151 id, c);
1152 1152
1153 msg.header.size = htons (sizeof (msg)); 1153 msg.header.size = htons (sizeof (msg));
1154 msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_NACK); 1154 msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK);
1155 msg.channel_id = htonl (id); 1155 msg.channel_id = htonl (id);
1156 GNUNET_SERVER_notification_context_unicast (nc, 1156 GNUNET_SERVER_notification_context_unicast (nc,
1157 c->handle, 1157 c->handle,
@@ -1167,9 +1167,9 @@ GML_send_channel_nack (struct MeshClient *c, MESH_ChannelNumber id)
1167 * @param id ID of the channel that is destroyed. 1167 * @param id ID of the channel that is destroyed.
1168 */ 1168 */
1169void 1169void
1170GML_send_channel_destroy (struct MeshClient *c, uint32_t id) 1170GML_send_channel_destroy (struct CadetClient *c, uint32_t id)
1171{ 1171{
1172 struct GNUNET_MESH_ChannelMessage msg; 1172 struct GNUNET_CADET_ChannelMessage msg;
1173 1173
1174 if (NULL == c) 1174 if (NULL == c)
1175 { 1175 {
@@ -1179,7 +1179,7 @@ GML_send_channel_destroy (struct MeshClient *c, uint32_t id)
1179 if (GNUNET_YES == c->shutting_down) 1179 if (GNUNET_YES == c->shutting_down)
1180 return; 1180 return;
1181 msg.header.size = htons (sizeof (msg)); 1181 msg.header.size = htons (sizeof (msg));
1182 msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY); 1182 msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY);
1183 msg.channel_id = htonl (id); 1183 msg.channel_id = htonl (id);
1184 msg.port = htonl (0); 1184 msg.port = htonl (0);
1185 memset (&msg.peer, 0, sizeof (msg.peer)); 1185 memset (&msg.peer, 0, sizeof (msg.peer));
@@ -1190,20 +1190,20 @@ GML_send_channel_destroy (struct MeshClient *c, uint32_t id)
1190 1190
1191 1191
1192/** 1192/**
1193 * Modify the mesh message ID from global to local and send to client. 1193 * Modify the cadet message ID from global to local and send to client.
1194 * 1194 *
1195 * @param c Client to send to. 1195 * @param c Client to send to.
1196 * @param msg Message to modify and send. 1196 * @param msg Message to modify and send.
1197 * @param id Channel ID to use (c can be both owner and client). 1197 * @param id Channel ID to use (c can be both owner and client).
1198 */ 1198 */
1199void 1199void
1200GML_send_data (struct MeshClient *c, 1200GML_send_data (struct CadetClient *c,
1201 const struct GNUNET_MESH_Data *msg, 1201 const struct GNUNET_CADET_Data *msg,
1202 MESH_ChannelNumber id) 1202 CADET_ChannelNumber id)
1203{ 1203{
1204 struct GNUNET_MESH_LocalData *copy; 1204 struct GNUNET_CADET_LocalData *copy;
1205 uint16_t size = ntohs (msg->header.size) - sizeof (struct GNUNET_MESH_Data); 1205 uint16_t size = ntohs (msg->header.size) - sizeof (struct GNUNET_CADET_Data);
1206 char cbuf[size + sizeof (struct GNUNET_MESH_LocalData)]; 1206 char cbuf[size + sizeof (struct GNUNET_CADET_LocalData)];
1207 1207
1208 if (size < sizeof (struct GNUNET_MessageHeader)) 1208 if (size < sizeof (struct GNUNET_MessageHeader))
1209 { 1209 {
@@ -1215,10 +1215,10 @@ GML_send_data (struct MeshClient *c,
1215 GNUNET_break (0); 1215 GNUNET_break (0);
1216 return; 1216 return;
1217 } 1217 }
1218 copy = (struct GNUNET_MESH_LocalData *) cbuf; 1218 copy = (struct GNUNET_CADET_LocalData *) cbuf;
1219 memcpy (&copy[1], &msg[1], size); 1219 memcpy (&copy[1], &msg[1], size);
1220 copy->header.size = htons (sizeof (struct GNUNET_MESH_LocalData) + size); 1220 copy->header.size = htons (sizeof (struct GNUNET_CADET_LocalData) + size);
1221 copy->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA); 1221 copy->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA);
1222 copy->id = htonl (id); 1222 copy->id = htonl (id);
1223 GNUNET_SERVER_notification_context_unicast (nc, c->handle, 1223 GNUNET_SERVER_notification_context_unicast (nc, c->handle,
1224 &copy->header, GNUNET_NO); 1224 &copy->header, GNUNET_NO);
@@ -1233,7 +1233,7 @@ GML_send_data (struct MeshClient *c,
1233 * @return Static string for the client. 1233 * @return Static string for the client.
1234 */ 1234 */
1235const char * 1235const char *
1236GML_2s (const struct MeshClient *c) 1236GML_2s (const struct CadetClient *c)
1237{ 1237{
1238 static char buf[32]; 1238 static char buf[32];
1239 1239
diff --git a/src/mesh/gnunet-service-mesh_local.h b/src/mesh/gnunet-service-mesh_local.h
index c5a0b367c..b78b3c5da 100644
--- a/src/mesh/gnunet-service-mesh_local.h
+++ b/src/mesh/gnunet-service-mesh_local.h
@@ -19,15 +19,15 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file mesh/gnunet-service-mesh_local.h 22 * @file cadet/gnunet-service-cadet_local.h
23 * @brief mesh service; dealing with local clients 23 * @brief cadet service; dealing with local clients
24 * @author Bartlomiej Polot 24 * @author Bartlomiej Polot
25 * 25 *
26 * All functions in this file should use the prefix GML (Gnunet Mesh Local) 26 * All functions in this file should use the prefix GML (Gnunet Cadet Local)
27 */ 27 */
28 28
29#ifndef GNUNET_SERVICE_MESH_LOCAL_H 29#ifndef GNUNET_SERVICE_CADET_LOCAL_H
30#define GNUNET_SERVICE_MESH_LOCAL_H 30#define GNUNET_SERVICE_CADET_LOCAL_H
31 31
32#ifdef __cplusplus 32#ifdef __cplusplus
33extern "C" 33extern "C"
@@ -43,9 +43,9 @@ extern "C"
43/** 43/**
44 * Struct containing information about a client of the service 44 * Struct containing information about a client of the service
45 */ 45 */
46struct MeshClient; 46struct CadetClient;
47 47
48#include "gnunet-service-mesh_channel.h" 48#include "gnunet-service-cadet_channel.h"
49 49
50/******************************************************************************/ 50/******************************************************************************/
51/******************************** API ***********************************/ 51/******************************** API ***********************************/
@@ -79,8 +79,8 @@ GML_shutdown (void);
79 * 79 *
80 * @return non-NULL if channel exists in the clients lists 80 * @return non-NULL if channel exists in the clients lists
81 */ 81 */
82struct MeshChannel * 82struct CadetChannel *
83GML_channel_get (struct MeshClient *c, uint32_t chid); 83GML_channel_get (struct CadetClient *c, uint32_t chid);
84 84
85/** 85/**
86 * Add a channel to a client 86 * Add a channel to a client
@@ -90,9 +90,9 @@ GML_channel_get (struct MeshClient *c, uint32_t chid);
90 * @param ch Channel. 90 * @param ch Channel.
91 */ 91 */
92void 92void
93GML_channel_add (struct MeshClient *client, 93GML_channel_add (struct CadetClient *client,
94 uint32_t chid, 94 uint32_t chid,
95 struct MeshChannel *ch); 95 struct CadetChannel *ch);
96 96
97/** 97/**
98 * Remove a channel from a client 98 * Remove a channel from a client
@@ -102,9 +102,9 @@ GML_channel_add (struct MeshClient *client,
102 * @param ch Channel. 102 * @param ch Channel.
103 */ 103 */
104void 104void
105GML_channel_remove (struct MeshClient *client, 105GML_channel_remove (struct CadetClient *client,
106 uint32_t chid, 106 uint32_t chid,
107 struct MeshChannel *ch); 107 struct CadetChannel *ch);
108 108
109/** 109/**
110 * Get the tunnel's next free local channel ID. 110 * Get the tunnel's next free local channel ID.
@@ -113,8 +113,8 @@ GML_channel_remove (struct MeshClient *client,
113 * 113 *
114 * @return LID of a channel free to use. 114 * @return LID of a channel free to use.
115 */ 115 */
116MESH_ChannelNumber 116CADET_ChannelNumber
117GML_get_next_chid (struct MeshClient *c); 117GML_get_next_chid (struct CadetClient *c);
118 118
119/** 119/**
120 * Check if client has registered with the service and has not disconnected 120 * Check if client has registered with the service and has not disconnected
@@ -123,7 +123,7 @@ GML_get_next_chid (struct MeshClient *c);
123 * 123 *
124 * @return non-NULL if client exists in the global DLL 124 * @return non-NULL if client exists in the global DLL
125 */ 125 */
126struct MeshClient * 126struct CadetClient *
127GML_client_get (struct GNUNET_SERVER_Client *client); 127GML_client_get (struct GNUNET_SERVER_Client *client);
128 128
129/** 129/**
@@ -133,7 +133,7 @@ GML_client_get (struct GNUNET_SERVER_Client *client);
133 * 133 *
134 * @return non-NULL if a client has the port. 134 * @return non-NULL if a client has the port.
135 */ 135 */
136struct MeshClient * 136struct CadetClient *
137GML_client_get_by_port (uint32_t port); 137GML_client_get_by_port (uint32_t port);
138 138
139/** 139/**
@@ -144,9 +144,9 @@ GML_client_get_by_port (uint32_t port);
144 * @param id Channel ID. 144 * @param id Channel ID.
145 */ 145 */
146void 146void
147GML_client_delete_channel (struct MeshClient *c, 147GML_client_delete_channel (struct CadetClient *c,
148 struct MeshChannel *ch, 148 struct CadetChannel *ch,
149 MESH_ChannelNumber id); 149 CADET_ChannelNumber id);
150 150
151/** 151/**
152 * Build a local ACK message and send it to a local client, if needed. 152 * Build a local ACK message and send it to a local client, if needed.
@@ -157,7 +157,7 @@ GML_client_delete_channel (struct MeshClient *c,
157 * @param id Channel ID to use 157 * @param id Channel ID to use
158 */ 158 */
159void 159void
160GML_send_ack (struct MeshClient *c, MESH_ChannelNumber id); 160GML_send_ack (struct CadetClient *c, CADET_ChannelNumber id);
161 161
162/** 162/**
163 * Notify the appropriate client that a new incoming channel was created. 163 * Notify the appropriate client that a new incoming channel was created.
@@ -169,7 +169,7 @@ GML_send_ack (struct MeshClient *c, MESH_ChannelNumber id);
169 * @param peer Origin peer. 169 * @param peer Origin peer.
170 */ 170 */
171void 171void
172GML_send_channel_create (struct MeshClient *c, 172GML_send_channel_create (struct CadetClient *c,
173 uint32_t id, uint32_t port, uint32_t opt, 173 uint32_t id, uint32_t port, uint32_t opt,
174 const struct GNUNET_PeerIdentity *peer); 174 const struct GNUNET_PeerIdentity *peer);
175 175
@@ -180,7 +180,7 @@ GML_send_channel_create (struct MeshClient *c,
180 * @param id Channel ID to use 180 * @param id Channel ID to use
181 */ 181 */
182void 182void
183GML_send_channel_nack (struct MeshClient *c, MESH_ChannelNumber id); 183GML_send_channel_nack (struct CadetClient *c, CADET_ChannelNumber id);
184 184
185/** 185/**
186 * Notify a client that a channel is no longer valid. 186 * Notify a client that a channel is no longer valid.
@@ -189,19 +189,19 @@ GML_send_channel_nack (struct MeshClient *c, MESH_ChannelNumber id);
189 * @param id ID of the channel that is destroyed. 189 * @param id ID of the channel that is destroyed.
190 */ 190 */
191void 191void
192GML_send_channel_destroy (struct MeshClient *c, uint32_t id); 192GML_send_channel_destroy (struct CadetClient *c, uint32_t id);
193 193
194/** 194/**
195 * Modify the mesh message ID from global to local and send to client. 195 * Modify the cadet message ID from global to local and send to client.
196 * 196 *
197 * @param c Client to send to. 197 * @param c Client to send to.
198 * @param msg Message to modify and send. 198 * @param msg Message to modify and send.
199 * @param id Channel ID to use (c can be both owner and client). 199 * @param id Channel ID to use (c can be both owner and client).
200 */ 200 */
201void 201void
202GML_send_data (struct MeshClient *c, 202GML_send_data (struct CadetClient *c,
203 const struct GNUNET_MESH_Data *msg, 203 const struct GNUNET_CADET_Data *msg,
204 MESH_ChannelNumber id); 204 CADET_ChannelNumber id);
205 205
206/** 206/**
207 * Get the static string to represent a client. 207 * Get the static string to represent a client.
@@ -211,7 +211,7 @@ GML_send_data (struct MeshClient *c,
211 * @return Static string for the client. 211 * @return Static string for the client.
212 */ 212 */
213const char * 213const char *
214GML_2s (const struct MeshClient *c); 214GML_2s (const struct CadetClient *c);
215 215
216 216
217#if 0 /* keep Emacsens' auto-indent happy */ 217#if 0 /* keep Emacsens' auto-indent happy */
@@ -221,6 +221,6 @@ GML_2s (const struct MeshClient *c);
221} 221}
222#endif 222#endif
223 223
224/* ifndef GNUNET_MESH_SERVICE_LOCAL_H */ 224/* ifndef GNUNET_CADET_SERVICE_LOCAL_H */
225#endif 225#endif
226/* end of gnunet-mesh-service_LOCAL.h */ 226/* end of gnunet-cadet-service_LOCAL.h */
diff --git a/src/mesh/gnunet-service-mesh_peer.c b/src/mesh/gnunet-service-mesh_peer.c
index e2b27d97c..287d42efe 100644
--- a/src/mesh/gnunet-service-mesh_peer.c
+++ b/src/mesh/gnunet-service-mesh_peer.c
@@ -26,15 +26,15 @@
26#include "gnunet_core_service.h" 26#include "gnunet_core_service.h"
27#include "gnunet_statistics_service.h" 27#include "gnunet_statistics_service.h"
28 28
29#include "mesh_protocol.h" 29#include "cadet_protocol.h"
30 30
31#include "gnunet-service-mesh_peer.h" 31#include "gnunet-service-cadet_peer.h"
32#include "gnunet-service-mesh_dht.h" 32#include "gnunet-service-cadet_dht.h"
33#include "gnunet-service-mesh_connection.h" 33#include "gnunet-service-cadet_connection.h"
34#include "gnunet-service-mesh_tunnel.h" 34#include "gnunet-service-cadet_tunnel.h"
35#include "mesh_path.h" 35#include "cadet_path.h"
36 36
37#define LOG(level, ...) GNUNET_log_from (level,"mesh-p2p",__VA_ARGS__) 37#define LOG(level, ...) GNUNET_log_from (level,"cadet-p2p",__VA_ARGS__)
38 38
39/******************************************************************************/ 39/******************************************************************************/
40/******************************** STRUCTS **********************************/ 40/******************************** STRUCTS **********************************/
@@ -43,27 +43,27 @@
43/** 43/**
44 * Struct containing info about a queued transmission to this peer 44 * Struct containing info about a queued transmission to this peer
45 */ 45 */
46struct MeshPeerQueue 46struct CadetPeerQueue
47{ 47{
48 /** 48 /**
49 * DLL next 49 * DLL next
50 */ 50 */
51 struct MeshPeerQueue *next; 51 struct CadetPeerQueue *next;
52 52
53 /** 53 /**
54 * DLL previous 54 * DLL previous
55 */ 55 */
56 struct MeshPeerQueue *prev; 56 struct CadetPeerQueue *prev;
57 57
58 /** 58 /**
59 * Peer this transmission is directed to. 59 * Peer this transmission is directed to.
60 */ 60 */
61 struct MeshPeer *peer; 61 struct CadetPeer *peer;
62 62
63 /** 63 /**
64 * Connection this message belongs to. 64 * Connection this message belongs to.
65 */ 65 */
66 struct MeshConnection *c; 66 struct CadetConnection *c;
67 67
68 /** 68 /**
69 * Is FWD in c? 69 * Is FWD in c?
@@ -114,7 +114,7 @@ struct MeshPeerQueue
114/** 114/**
115 * Struct containing all information regarding a given peer 115 * Struct containing all information regarding a given peer
116 */ 116 */
117struct MeshPeer 117struct CadetPeer
118{ 118{
119 /** 119 /**
120 * ID of the peer 120 * ID of the peer
@@ -129,12 +129,12 @@ struct MeshPeer
129 /** 129 /**
130 * Paths to reach the peer, ordered by ascending hop count 130 * Paths to reach the peer, ordered by ascending hop count
131 */ 131 */
132 struct MeshPeerPath *path_head; 132 struct CadetPeerPath *path_head;
133 133
134 /** 134 /**
135 * Paths to reach the peer, ordered by ascending hop count 135 * Paths to reach the peer, ordered by ascending hop count
136 */ 136 */
137 struct MeshPeerPath *path_tail; 137 struct CadetPeerPath *path_tail;
138 138
139 /** 139 /**
140 * Handle to stop the DHT search for paths to this peer 140 * Handle to stop the DHT search for paths to this peer
@@ -144,7 +144,7 @@ struct MeshPeer
144 /** 144 /**
145 * Tunnel to this peer, if any. 145 * Tunnel to this peer, if any.
146 */ 146 */
147 struct MeshTunnel3 *tunnel; 147 struct CadetTunnel3 *tunnel;
148 148
149 /** 149 /**
150 * Connections that go through this peer, indexed by tid; 150 * Connections that go through this peer, indexed by tid;
@@ -159,12 +159,12 @@ struct MeshPeer
159 /** 159 /**
160 * Transmission queue to core DLL head 160 * Transmission queue to core DLL head
161 */ 161 */
162 struct MeshPeerQueue *queue_head; 162 struct CadetPeerQueue *queue_head;
163 163
164 /** 164 /**
165 * Transmission queue to core DLL tail 165 * Transmission queue to core DLL tail
166 */ 166 */
167 struct MeshPeerQueue *queue_tail; 167 struct CadetPeerQueue *queue_tail;
168 168
169 /** 169 /**
170 * How many messages are in the queue to this peer. 170 * How many messages are in the queue to this peer.
@@ -198,7 +198,7 @@ extern struct GNUNET_PeerIdentity my_full_id;
198extern GNUNET_PEER_Id myid; 198extern GNUNET_PEER_Id myid;
199 199
200/** 200/**
201 * Peers known, indexed by PeerIdentity (MeshPeer). 201 * Peers known, indexed by PeerIdentity (CadetPeer).
202 */ 202 */
203static struct GNUNET_CONTAINER_MultiPeerMap *peers; 203static struct GNUNET_CONTAINER_MultiPeerMap *peers;
204 204
@@ -228,9 +228,9 @@ static struct GNUNET_TRANSPORT_Handle *transport_handle;
228/******************************************************************************/ 228/******************************************************************************/
229 229
230static void 230static void
231queue_debug (struct MeshPeer *peer) 231queue_debug (struct CadetPeer *peer)
232{ 232{
233 struct MeshPeerQueue *q; 233 struct CadetPeerQueue *q;
234 234
235 LOG (GNUNET_ERROR_TYPE_DEBUG, "QQQ Messages queued towards %s\n", GMP_2s (peer)); 235 LOG (GNUNET_ERROR_TYPE_DEBUG, "QQQ Messages queued towards %s\n", GMP_2s (peer));
236 LOG (GNUNET_ERROR_TYPE_DEBUG, "QQQ core tmt rdy: %p\n", peer->core_transmit); 236 LOG (GNUNET_ERROR_TYPE_DEBUG, "QQQ core tmt rdy: %p\n", peer->core_transmit);
@@ -265,8 +265,8 @@ notify_broken (void *cls,
265 const struct GNUNET_HashCode *key, 265 const struct GNUNET_HashCode *key,
266 void *value) 266 void *value)
267{ 267{
268 struct MeshPeer *peer = cls; 268 struct CadetPeer *peer = cls;
269 struct MeshConnection *c = value; 269 struct CadetConnection *c = value;
270 270
271 LOG (GNUNET_ERROR_TYPE_DEBUG, " notifying %s due to %s\n", 271 LOG (GNUNET_ERROR_TYPE_DEBUG, " notifying %s due to %s\n",
272 GMC_2s (c), GMP_2s (peer)); 272 GMC_2s (c), GMP_2s (peer));
@@ -282,10 +282,10 @@ notify_broken (void *cls,
282 * @param peer Peer to remove the direct path from. 282 * @param peer Peer to remove the direct path from.
283 * 283 *
284 */ 284 */
285static struct MeshPeerPath * 285static struct CadetPeerPath *
286pop_direct_path (struct MeshPeer *peer) 286pop_direct_path (struct CadetPeer *peer)
287{ 287{
288 struct MeshPeerPath *iter; 288 struct CadetPeerPath *iter;
289 289
290 for (iter = peer->path_head; NULL != iter; iter = iter->next) 290 for (iter = peer->path_head; NULL != iter; iter = iter->next)
291 { 291 {
@@ -312,8 +312,8 @@ pop_direct_path (struct MeshPeer *peer)
312static void 312static void
313core_connect (void *cls, const struct GNUNET_PeerIdentity *peer) 313core_connect (void *cls, const struct GNUNET_PeerIdentity *peer)
314{ 314{
315 struct MeshPeer *mp; 315 struct CadetPeer *mp;
316 struct MeshPeerPath *path; 316 struct CadetPeerPath *path;
317 char own_id[16]; 317 char own_id[16];
318 318
319 strncpy (own_id, GNUNET_i2s (&my_full_id), 15); 319 strncpy (own_id, GNUNET_i2s (&my_full_id), 15);
@@ -357,8 +357,8 @@ core_connect (void *cls, const struct GNUNET_PeerIdentity *peer)
357static void 357static void
358core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) 358core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
359{ 359{
360 struct MeshPeer *p; 360 struct CadetPeer *p;
361 struct MeshPeerPath *direct_path; 361 struct CadetPeerPath *direct_path;
362 char own_id[16]; 362 char own_id[16];
363 363
364 strncpy (own_id, GNUNET_i2s (&my_full_id), 15); 364 strncpy (own_id, GNUNET_i2s (&my_full_id), 15);
@@ -393,19 +393,19 @@ core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
393 * Functions to handle messages from core 393 * Functions to handle messages from core
394 */ 394 */
395static struct GNUNET_CORE_MessageHandler core_handlers[] = { 395static struct GNUNET_CORE_MessageHandler core_handlers[] = {
396 {&GMC_handle_create, GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE, 0}, 396 {&GMC_handle_create, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE, 0},
397 {&GMC_handle_confirm, GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK, 397 {&GMC_handle_confirm, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK,
398 sizeof (struct GNUNET_MESH_ConnectionACK)}, 398 sizeof (struct GNUNET_CADET_ConnectionACK)},
399 {&GMC_handle_broken, GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN, 399 {&GMC_handle_broken, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN,
400 sizeof (struct GNUNET_MESH_ConnectionBroken)}, 400 sizeof (struct GNUNET_CADET_ConnectionBroken)},
401 {&GMC_handle_destroy, GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY, 401 {&GMC_handle_destroy, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY,
402 sizeof (struct GNUNET_MESH_ConnectionDestroy)}, 402 sizeof (struct GNUNET_CADET_ConnectionDestroy)},
403 {&GMC_handle_ack, GNUNET_MESSAGE_TYPE_MESH_ACK, 403 {&GMC_handle_ack, GNUNET_MESSAGE_TYPE_CADET_ACK,
404 sizeof (struct GNUNET_MESH_ACK)}, 404 sizeof (struct GNUNET_CADET_ACK)},
405 {&GMC_handle_poll, GNUNET_MESSAGE_TYPE_MESH_POLL, 405 {&GMC_handle_poll, GNUNET_MESSAGE_TYPE_CADET_POLL,
406 sizeof (struct GNUNET_MESH_Poll)}, 406 sizeof (struct GNUNET_CADET_Poll)},
407 {&GMC_handle_encrypted, GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED, 0}, 407 {&GMC_handle_encrypted, GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED, 0},
408 {&GMC_handle_kx, GNUNET_MESSAGE_TYPE_MESH_KX, 0}, 408 {&GMC_handle_kx, GNUNET_MESSAGE_TYPE_CADET_KX, 0},
409 {NULL, 0, 0} 409 {NULL, 0, 0}
410}; 410};
411 411
@@ -431,7 +431,7 @@ core_init (void *cls,
431 LOG (GNUNET_ERROR_TYPE_ERROR, " my id %s\n", GNUNET_i2s (&my_full_id)); 431 LOG (GNUNET_ERROR_TYPE_ERROR, " my id %s\n", GNUNET_i2s (&my_full_id));
432 GNUNET_CORE_disconnect (core_handle); 432 GNUNET_CORE_disconnect (core_handle);
433 core_handle = GNUNET_CORE_connect (c, /* Main configuration */ 433 core_handle = GNUNET_CORE_connect (c, /* Main configuration */
434 NULL, /* Closure passed to MESH functions */ 434 NULL, /* Closure passed to CADET functions */
435 &core_init, /* Call core_init once connected */ 435 &core_init, /* Call core_init once connected */
436 &core_connect, /* Handle connects */ 436 &core_connect, /* Handle connects */
437 &core_disconnect, /* remove peers on disconnects */ 437 &core_disconnect, /* remove peers on disconnects */
@@ -451,7 +451,7 @@ core_init (void *cls,
451/** 451/**
452 * Core callback to write a pre-constructed data packet to core buffer 452 * Core callback to write a pre-constructed data packet to core buffer
453 * 453 *
454 * @param cls Closure (MeshTransmissionDescriptor with data in "data" member). 454 * @param cls Closure (CadetTransmissionDescriptor with data in "data" member).
455 * @param size Number of bytes available in buf. 455 * @param size Number of bytes available in buf.
456 * @param buf Where the to write the message. 456 * @param buf Where the to write the message.
457 * 457 *
@@ -486,11 +486,11 @@ send_core_data_raw (void *cls, size_t size, void *buf)
486 * @return number of bytes written to buf 486 * @return number of bytes written to buf
487 */ 487 */
488static size_t 488static size_t
489send_core_connection_create (struct MeshConnection *c, size_t size, void *buf) 489send_core_connection_create (struct CadetConnection *c, size_t size, void *buf)
490{ 490{
491 struct GNUNET_MESH_ConnectionCreate *msg; 491 struct GNUNET_CADET_ConnectionCreate *msg;
492 struct GNUNET_PeerIdentity *peer_ptr; 492 struct GNUNET_PeerIdentity *peer_ptr;
493 const struct MeshPeerPath *p = GMC_get_path (c); 493 const struct CadetPeerPath *p = GMC_get_path (c);
494 size_t size_needed; 494 size_t size_needed;
495 int i; 495 int i;
496 496
@@ -499,7 +499,7 @@ send_core_connection_create (struct MeshConnection *c, size_t size, void *buf)
499 499
500 LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending CONNECTION CREATE...\n"); 500 LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending CONNECTION CREATE...\n");
501 size_needed = 501 size_needed =
502 sizeof (struct GNUNET_MESH_ConnectionCreate) + 502 sizeof (struct GNUNET_CADET_ConnectionCreate) +
503 p->length * sizeof (struct GNUNET_PeerIdentity); 503 p->length * sizeof (struct GNUNET_PeerIdentity);
504 504
505 if (size < size_needed || NULL == buf) 505 if (size < size_needed || NULL == buf)
@@ -507,9 +507,9 @@ send_core_connection_create (struct MeshConnection *c, size_t size, void *buf)
507 GNUNET_break (0); 507 GNUNET_break (0);
508 return 0; 508 return 0;
509 } 509 }
510 msg = (struct GNUNET_MESH_ConnectionCreate *) buf; 510 msg = (struct GNUNET_CADET_ConnectionCreate *) buf;
511 msg->header.size = htons (size_needed); 511 msg->header.size = htons (size_needed);
512 msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE); 512 msg->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE);
513 msg->cid = *GMC_get_id (c); 513 msg->cid = *GMC_get_id (c);
514 514
515 peer_ptr = (struct GNUNET_PeerIdentity *) &msg[1]; 515 peer_ptr = (struct GNUNET_PeerIdentity *) &msg[1];
@@ -535,22 +535,22 @@ send_core_connection_create (struct MeshConnection *c, size_t size, void *buf)
535 * @return number of bytes written to buf 535 * @return number of bytes written to buf
536 */ 536 */
537static size_t 537static size_t
538send_core_connection_ack (struct MeshConnection *c, size_t size, void *buf) 538send_core_connection_ack (struct CadetConnection *c, size_t size, void *buf)
539{ 539{
540 struct GNUNET_MESH_ConnectionACK *msg = buf; 540 struct GNUNET_CADET_ConnectionACK *msg = buf;
541 541
542 LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending CONNECTION ACK...\n"); 542 LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending CONNECTION ACK...\n");
543 if (sizeof (struct GNUNET_MESH_ConnectionACK) > size) 543 if (sizeof (struct GNUNET_CADET_ConnectionACK) > size)
544 { 544 {
545 GNUNET_break (0); 545 GNUNET_break (0);
546 return 0; 546 return 0;
547 } 547 }
548 msg->header.size = htons (sizeof (struct GNUNET_MESH_ConnectionACK)); 548 msg->header.size = htons (sizeof (struct GNUNET_CADET_ConnectionACK));
549 msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK); 549 msg->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK);
550 msg->cid = *GMC_get_id (c); 550 msg->cid = *GMC_get_id (c);
551 551
552 LOG (GNUNET_ERROR_TYPE_DEBUG, "CONNECTION ACK sent!\n"); 552 LOG (GNUNET_ERROR_TYPE_DEBUG, "CONNECTION ACK sent!\n");
553 return sizeof (struct GNUNET_MESH_ConnectionACK); 553 return sizeof (struct GNUNET_CADET_ConnectionACK);
554} 554}
555 555
556 556
@@ -567,7 +567,7 @@ send_core_connection_ack (struct MeshConnection *c, size_t size, void *buf)
567 * @return CORE priority to use. 567 * @return CORE priority to use.
568 */ 568 */
569static enum GNUNET_CORE_Priority 569static enum GNUNET_CORE_Priority
570get_priority (struct MeshPeerQueue *q) 570get_priority (struct CadetPeerQueue *q)
571{ 571{
572 enum GNUNET_CORE_Priority low; 572 enum GNUNET_CORE_Priority low;
573 enum GNUNET_CORE_Priority high; 573 enum GNUNET_CORE_Priority high;
@@ -591,7 +591,7 @@ get_priority (struct MeshPeerQueue *q)
591 } 591 }
592 592
593 /* Bulky payload has lower priority, control traffic has higher. */ 593 /* Bulky payload has lower priority, control traffic has higher. */
594 if (GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED == q->type) 594 if (GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED == q->type)
595 return low; 595 return low;
596 else 596 else
597 return high; 597 return high;
@@ -612,8 +612,8 @@ shutdown_tunnel (void *cls,
612 const struct GNUNET_PeerIdentity *key, 612 const struct GNUNET_PeerIdentity *key,
613 void *value) 613 void *value)
614{ 614{
615 struct MeshPeer *p = value; 615 struct CadetPeer *p = value;
616 struct MeshTunnel3 *t = p->tunnel; 616 struct CadetTunnel3 *t = p->tunnel;
617 617
618 if (NULL != t) 618 if (NULL != t)
619 GMT_destroy (t); 619 GMT_destroy (t);
@@ -629,11 +629,11 @@ shutdown_tunnel (void *cls,
629 * @return GNUNET_OK on success 629 * @return GNUNET_OK on success
630 */ 630 */
631static int 631static int
632peer_destroy (struct MeshPeer *peer) 632peer_destroy (struct CadetPeer *peer)
633{ 633{
634 struct GNUNET_PeerIdentity id; 634 struct GNUNET_PeerIdentity id;
635 struct MeshPeerPath *p; 635 struct CadetPeerPath *p;
636 struct MeshPeerPath *nextp; 636 struct CadetPeerPath *nextp;
637 637
638 GNUNET_PEER_resolve (peer->id, &id); 638 GNUNET_PEER_resolve (peer->id, &id);
639 GNUNET_PEER_change_rc (peer->id, -1); 639 GNUNET_PEER_change_rc (peer->id, -1);
@@ -672,9 +672,9 @@ peer_destroy (struct MeshPeer *peer)
672 * @return #GNUNET_YES if peer is in use. 672 * @return #GNUNET_YES if peer is in use.
673 */ 673 */
674static int 674static int
675peer_is_used (struct MeshPeer *peer) 675peer_is_used (struct CadetPeer *peer)
676{ 676{
677 struct MeshPeerPath *p; 677 struct CadetPeerPath *p;
678 678
679 if (NULL != peer->tunnel) 679 if (NULL != peer->tunnel)
680 return GNUNET_YES; 680 return GNUNET_YES;
@@ -700,7 +700,7 @@ peer_get_oldest (void *cls,
700 const struct GNUNET_PeerIdentity *key, 700 const struct GNUNET_PeerIdentity *key,
701 void *value) 701 void *value)
702{ 702{
703 struct MeshPeer *p = value; 703 struct CadetPeer *p = value;
704 struct GNUNET_TIME_Absolute *abs = cls; 704 struct GNUNET_TIME_Absolute *abs = cls;
705 705
706 /* Don't count active peers */ 706 /* Don't count active peers */
@@ -726,7 +726,7 @@ peer_timeout (void *cls,
726 const struct GNUNET_PeerIdentity *key, 726 const struct GNUNET_PeerIdentity *key,
727 void *value) 727 void *value)
728{ 728{
729 struct MeshPeer *p = value; 729 struct CadetPeer *p = value;
730 struct GNUNET_TIME_Absolute *abs = cls; 730 struct GNUNET_TIME_Absolute *abs = cls;
731 731
732 LOG (GNUNET_ERROR_TYPE_WARNING, 732 LOG (GNUNET_ERROR_TYPE_WARNING,
@@ -769,11 +769,11 @@ peer_delete_oldest (void)
769 * 769 *
770 * @return Best current known path towards the peer, if any. 770 * @return Best current known path towards the peer, if any.
771 */ 771 */
772static struct MeshPeerPath * 772static struct CadetPeerPath *
773peer_get_best_path (const struct MeshPeer *peer) 773peer_get_best_path (const struct CadetPeer *peer)
774{ 774{
775 struct MeshPeerPath *best_p; 775 struct CadetPeerPath *best_p;
776 struct MeshPeerPath *p; 776 struct CadetPeerPath *p;
777 unsigned int best_cost; 777 unsigned int best_cost;
778 unsigned int cost; 778 unsigned int cost;
779 779
@@ -807,21 +807,21 @@ peer_get_best_path (const struct MeshPeer *peer)
807 * @return #GNUNET_YES if it is sendable, #GNUNET_NO otherwise. 807 * @return #GNUNET_YES if it is sendable, #GNUNET_NO otherwise.
808 */ 808 */
809static int 809static int
810queue_is_sendable (struct MeshPeerQueue *q) 810queue_is_sendable (struct CadetPeerQueue *q)
811{ 811{
812 /* Is PID-independent? */ 812 /* Is PID-independent? */
813 switch (q->type) 813 switch (q->type)
814 { 814 {
815 case GNUNET_MESSAGE_TYPE_MESH_ACK: 815 case GNUNET_MESSAGE_TYPE_CADET_ACK:
816 case GNUNET_MESSAGE_TYPE_MESH_POLL: 816 case GNUNET_MESSAGE_TYPE_CADET_POLL:
817 case GNUNET_MESSAGE_TYPE_MESH_KX: 817 case GNUNET_MESSAGE_TYPE_CADET_KX:
818 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE: 818 case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE:
819 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK: 819 case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK:
820 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY: 820 case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY:
821 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN: 821 case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN:
822 return GNUNET_YES; 822 return GNUNET_YES;
823 823
824 case GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED: 824 case GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED:
825 break; 825 break;
826 826
827 default: 827 default:
@@ -839,10 +839,10 @@ queue_is_sendable (struct MeshPeerQueue *q)
839 * 839 *
840 * @return First transmittable message, if any. Otherwise, NULL. 840 * @return First transmittable message, if any. Otherwise, NULL.
841 */ 841 */
842static struct MeshPeerQueue * 842static struct CadetPeerQueue *
843peer_get_first_message (const struct MeshPeer *peer) 843peer_get_first_message (const struct CadetPeer *peer)
844{ 844{
845 struct MeshPeerQueue *q; 845 struct CadetPeerQueue *q;
846 846
847 for (q = peer->queue_head; NULL != q; q = q->next) 847 for (q = peer->queue_head; NULL != q; q = q->next)
848 { 848 {
@@ -864,9 +864,9 @@ peer_get_first_message (const struct MeshPeer *peer)
864 * @param path 864 * @param path
865 */ 865 */
866static void 866static void
867search_handler (void *cls, const struct MeshPeerPath *path) 867search_handler (void *cls, const struct CadetPeerPath *path)
868{ 868{
869 struct MeshPeer *peer = cls; 869 struct CadetPeer *peer = cls;
870 unsigned int connection_count; 870 unsigned int connection_count;
871 871
872 GMP_add_path_to_all (path, GNUNET_NO); 872 GMP_add_path_to_all (path, GNUNET_NO);
@@ -878,7 +878,7 @@ search_handler (void *cls, const struct MeshPeerPath *path)
878 if (3 <= connection_count) 878 if (3 <= connection_count)
879 return; 879 return;
880 880
881 if (MESH_TUNNEL3_SEARCHING == GMT_get_cstate (peer->tunnel)) 881 if (CADET_TUNNEL3_SEARCHING == GMT_get_cstate (peer->tunnel))
882 { 882 {
883 LOG (GNUNET_ERROR_TYPE_DEBUG, " ... connect!\n"); 883 LOG (GNUNET_ERROR_TYPE_DEBUG, " ... connect!\n");
884 GMP_connect (peer); 884 GMP_connect (peer);
@@ -900,9 +900,9 @@ search_handler (void *cls, const struct MeshPeerPath *path)
900static size_t 900static size_t
901queue_send (void *cls, size_t size, void *buf) 901queue_send (void *cls, size_t size, void *buf)
902{ 902{
903 struct MeshPeer *peer = cls; 903 struct CadetPeer *peer = cls;
904 struct MeshConnection *c; 904 struct CadetConnection *c;
905 struct MeshPeerQueue *queue; 905 struct CadetPeerQueue *queue;
906 const struct GNUNET_PeerIdentity *dst_id; 906 const struct GNUNET_PeerIdentity *dst_id;
907 size_t data_size; 907 size_t data_size;
908 uint32_t pid; 908 uint32_t pid;
@@ -950,28 +950,28 @@ queue_send (void *cls, size_t size, void *buf)
950 /* Fill buf */ 950 /* Fill buf */
951 switch (queue->type) 951 switch (queue->type)
952 { 952 {
953 case GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED: 953 case GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED:
954 pid = GMC_get_pid (queue->c, queue->fwd); 954 pid = GMC_get_pid (queue->c, queue->fwd);
955 LOG (GNUNET_ERROR_TYPE_DEBUG, " payload ID %u\n", pid); 955 LOG (GNUNET_ERROR_TYPE_DEBUG, " payload ID %u\n", pid);
956 data_size = send_core_data_raw (queue->cls, size, buf); 956 data_size = send_core_data_raw (queue->cls, size, buf);
957 ((struct GNUNET_MESH_Encrypted *) buf)->pid = htonl (pid); 957 ((struct GNUNET_CADET_Encrypted *) buf)->pid = htonl (pid);
958 break; 958 break;
959 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY: 959 case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY:
960 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN: 960 case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN:
961 case GNUNET_MESSAGE_TYPE_MESH_KX: 961 case GNUNET_MESSAGE_TYPE_CADET_KX:
962 case GNUNET_MESSAGE_TYPE_MESH_ACK: 962 case GNUNET_MESSAGE_TYPE_CADET_ACK:
963 case GNUNET_MESSAGE_TYPE_MESH_POLL: 963 case GNUNET_MESSAGE_TYPE_CADET_POLL:
964 LOG (GNUNET_ERROR_TYPE_DEBUG, " raw %s\n", GM_m2s (queue->type)); 964 LOG (GNUNET_ERROR_TYPE_DEBUG, " raw %s\n", GM_m2s (queue->type));
965 data_size = send_core_data_raw (queue->cls, size, buf); 965 data_size = send_core_data_raw (queue->cls, size, buf);
966 break; 966 break;
967 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE: 967 case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE:
968 LOG (GNUNET_ERROR_TYPE_DEBUG, " path create\n"); 968 LOG (GNUNET_ERROR_TYPE_DEBUG, " path create\n");
969 if (GMC_is_origin (c, GNUNET_YES)) 969 if (GMC_is_origin (c, GNUNET_YES))
970 data_size = send_core_connection_create (queue->c, size, buf); 970 data_size = send_core_connection_create (queue->c, size, buf);
971 else 971 else
972 data_size = send_core_data_raw (queue->cls, size, buf); 972 data_size = send_core_data_raw (queue->cls, size, buf);
973 break; 973 break;
974 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK: 974 case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK:
975 LOG (GNUNET_ERROR_TYPE_DEBUG, " path ack\n"); 975 LOG (GNUNET_ERROR_TYPE_DEBUG, " path ack\n");
976 if (GMC_is_origin (c, GNUNET_NO) || 976 if (GMC_is_origin (c, GNUNET_NO) ||
977 GMC_is_origin (c, GNUNET_YES)) 977 GMC_is_origin (c, GNUNET_YES))
@@ -979,9 +979,9 @@ queue_send (void *cls, size_t size, void *buf)
979 else 979 else
980 data_size = send_core_data_raw (queue->cls, size, buf); 980 data_size = send_core_data_raw (queue->cls, size, buf);
981 break; 981 break;
982 case GNUNET_MESSAGE_TYPE_MESH_DATA: 982 case GNUNET_MESSAGE_TYPE_CADET_DATA:
983 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE: 983 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE:
984 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY: 984 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY:
985 /* This should be encapsulted */ 985 /* This should be encapsulted */
986 GNUNET_break (0); 986 GNUNET_break (0);
987 data_size = 0; 987 data_size = 0;
@@ -1060,10 +1060,10 @@ queue_send (void *cls, size_t size, void *buf)
1060 * @param pid PID, if relevant (was sent and was a payload message). 1060 * @param pid PID, if relevant (was sent and was a payload message).
1061 */ 1061 */
1062void 1062void
1063GMP_queue_destroy (struct MeshPeerQueue *queue, int clear_cls, 1063GMP_queue_destroy (struct CadetPeerQueue *queue, int clear_cls,
1064 int sent, uint32_t pid) 1064 int sent, uint32_t pid)
1065{ 1065{
1066 struct MeshPeer *peer; 1066 struct CadetPeer *peer;
1067 1067
1068 peer = queue->peer; 1068 peer = queue->peer;
1069 1069
@@ -1073,17 +1073,17 @@ GMP_queue_destroy (struct MeshPeerQueue *queue, int clear_cls,
1073 GM_m2s (queue->type)); 1073 GM_m2s (queue->type));
1074 switch (queue->type) 1074 switch (queue->type)
1075 { 1075 {
1076 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY: 1076 case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY:
1077 LOG (GNUNET_ERROR_TYPE_INFO, "destroying a DESTROY message\n"); 1077 LOG (GNUNET_ERROR_TYPE_INFO, "destroying a DESTROY message\n");
1078 /* fall through */ 1078 /* fall through */
1079 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK: 1079 case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK:
1080 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE: 1080 case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE:
1081 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN: 1081 case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN:
1082 case GNUNET_MESSAGE_TYPE_MESH_KEEPALIVE: 1082 case GNUNET_MESSAGE_TYPE_CADET_KEEPALIVE:
1083 case GNUNET_MESSAGE_TYPE_MESH_KX: 1083 case GNUNET_MESSAGE_TYPE_CADET_KX:
1084 case GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED: 1084 case GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED:
1085 case GNUNET_MESSAGE_TYPE_MESH_ACK: 1085 case GNUNET_MESSAGE_TYPE_CADET_ACK:
1086 case GNUNET_MESSAGE_TYPE_MESH_POLL: 1086 case GNUNET_MESSAGE_TYPE_CADET_POLL:
1087 GNUNET_free_non_null (queue->cls); 1087 GNUNET_free_non_null (queue->cls);
1088 break; 1088 break;
1089 1089
@@ -1095,8 +1095,8 @@ GMP_queue_destroy (struct MeshPeerQueue *queue, int clear_cls,
1095 } 1095 }
1096 GNUNET_CONTAINER_DLL_remove (peer->queue_head, peer->queue_tail, queue); 1096 GNUNET_CONTAINER_DLL_remove (peer->queue_head, peer->queue_tail, queue);
1097 1097
1098 if (queue->type != GNUNET_MESSAGE_TYPE_MESH_ACK && 1098 if (queue->type != GNUNET_MESSAGE_TYPE_CADET_ACK &&
1099 queue->type != GNUNET_MESSAGE_TYPE_MESH_POLL) 1099 queue->type != GNUNET_MESSAGE_TYPE_CADET_POLL)
1100 { 1100 {
1101 peer->queue_n--; 1101 peer->queue_n--;
1102 } 1102 }
@@ -1136,13 +1136,13 @@ GMP_queue_destroy (struct MeshPeerQueue *queue, int clear_cls,
1136 * @return Handle to cancel the message before it is sent. Once cont is called 1136 * @return Handle to cancel the message before it is sent. Once cont is called
1137 * message has been sent and therefore the handle is no longer valid. 1137 * message has been sent and therefore the handle is no longer valid.
1138 */ 1138 */
1139struct MeshPeerQueue * 1139struct CadetPeerQueue *
1140GMP_queue_add (struct MeshPeer *peer, void *cls, uint16_t type, 1140GMP_queue_add (struct CadetPeer *peer, void *cls, uint16_t type,
1141 uint16_t payload_type, uint32_t payload_id, size_t size, 1141 uint16_t payload_type, uint32_t payload_id, size_t size,
1142 struct MeshConnection *c, int fwd, 1142 struct CadetConnection *c, int fwd,
1143 GMP_sent cont, void *cont_cls) 1143 GMP_sent cont, void *cont_cls)
1144{ 1144{
1145 struct MeshPeerQueue *queue; 1145 struct CadetPeerQueue *queue;
1146 int priority; 1146 int priority;
1147 int call_core; 1147 int call_core;
1148 1148
@@ -1162,8 +1162,8 @@ GMP_queue_add (struct MeshPeer *peer, void *cls, uint16_t type,
1162 1162
1163 priority = 0; 1163 priority = 0;
1164 1164
1165 if (GNUNET_MESSAGE_TYPE_MESH_POLL == type || 1165 if (GNUNET_MESSAGE_TYPE_CADET_POLL == type ||
1166 GNUNET_MESSAGE_TYPE_MESH_ACK == type) 1166 GNUNET_MESSAGE_TYPE_CADET_ACK == type)
1167 { 1167 {
1168 priority = 100; 1168 priority = 100;
1169 } 1169 }
@@ -1171,7 +1171,7 @@ GMP_queue_add (struct MeshPeer *peer, void *cls, uint16_t type,
1171 LOG (GNUNET_ERROR_TYPE_DEBUG, "priority %d\n", priority); 1171 LOG (GNUNET_ERROR_TYPE_DEBUG, "priority %d\n", priority);
1172 1172
1173 call_core = NULL == c ? GNUNET_YES : GMC_is_sendable (c, fwd); 1173 call_core = NULL == c ? GNUNET_YES : GMC_is_sendable (c, fwd);
1174 queue = GNUNET_new (struct MeshPeerQueue); 1174 queue = GNUNET_new (struct CadetPeerQueue);
1175 queue->cls = cls; 1175 queue->cls = cls;
1176 queue->type = type; 1176 queue->type = type;
1177 queue->payload_type = payload_type; 1177 queue->payload_type = payload_type;
@@ -1233,11 +1233,11 @@ GMP_queue_add (struct MeshPeer *peer, void *cls, uint16_t type,
1233 * the sent continuation call. 1233 * the sent continuation call.
1234 */ 1234 */
1235void 1235void
1236GMP_queue_cancel (struct MeshPeer *peer, struct MeshConnection *c) 1236GMP_queue_cancel (struct CadetPeer *peer, struct CadetConnection *c)
1237{ 1237{
1238 struct MeshPeerQueue *q; 1238 struct CadetPeerQueue *q;
1239 struct MeshPeerQueue *next; 1239 struct CadetPeerQueue *next;
1240 struct MeshPeerQueue *prev; 1240 struct CadetPeerQueue *prev;
1241 1241
1242 for (q = peer->queue_head; NULL != q; q = next) 1242 for (q = peer->queue_head; NULL != q; q = next)
1243 { 1243 {
@@ -1245,7 +1245,7 @@ GMP_queue_cancel (struct MeshPeer *peer, struct MeshConnection *c)
1245 if (q->c == c) 1245 if (q->c == c)
1246 { 1246 {
1247 LOG (GNUNET_ERROR_TYPE_DEBUG, "GMP queue cancel %s\n", GM_m2s (q->type)); 1247 LOG (GNUNET_ERROR_TYPE_DEBUG, "GMP queue cancel %s\n", GM_m2s (q->type));
1248 if (GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY != q->type) 1248 if (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY != q->type)
1249 { 1249 {
1250 q->c = NULL; 1250 q->c = NULL;
1251 } 1251 }
@@ -1286,10 +1286,10 @@ GMP_queue_cancel (struct MeshPeer *peer, struct MeshConnection *c)
1286 * 1286 *
1287 * @return First transmittable message. 1287 * @return First transmittable message.
1288 */ 1288 */
1289static struct MeshPeerQueue * 1289static struct CadetPeerQueue *
1290connection_get_first_message (struct MeshPeer *peer, struct MeshConnection *c) 1290connection_get_first_message (struct CadetPeer *peer, struct CadetConnection *c)
1291{ 1291{
1292 struct MeshPeerQueue *q; 1292 struct CadetPeerQueue *q;
1293 1293
1294 for (q = peer->queue_head; NULL != q; q = q->next) 1294 for (q = peer->queue_head; NULL != q; q = q->next)
1295 { 1295 {
@@ -1316,10 +1316,10 @@ connection_get_first_message (struct MeshPeer *peer, struct MeshConnection *c)
1316 * @return First message for this connection. 1316 * @return First message for this connection.
1317 */ 1317 */
1318struct GNUNET_MessageHeader * 1318struct GNUNET_MessageHeader *
1319GMP_connection_pop (struct MeshPeer *peer, struct MeshConnection *c) 1319GMP_connection_pop (struct CadetPeer *peer, struct CadetConnection *c)
1320{ 1320{
1321 struct MeshPeerQueue *q; 1321 struct CadetPeerQueue *q;
1322 struct MeshPeerQueue *next; 1322 struct CadetPeerQueue *next;
1323 struct GNUNET_MessageHeader *msg; 1323 struct GNUNET_MessageHeader *msg;
1324 1324
1325 LOG (GNUNET_ERROR_TYPE_DEBUG, "Connection pop on %s\n", GMC_2s (c)); 1325 LOG (GNUNET_ERROR_TYPE_DEBUG, "Connection pop on %s\n", GMC_2s (c));
@@ -1330,17 +1330,17 @@ GMP_connection_pop (struct MeshPeer *peer, struct MeshConnection *c)
1330 continue; 1330 continue;
1331 switch (q->type) 1331 switch (q->type)
1332 { 1332 {
1333 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE: 1333 case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE:
1334 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK: 1334 case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK:
1335 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY: 1335 case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY:
1336 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN: 1336 case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN:
1337 case GNUNET_MESSAGE_TYPE_MESH_ACK: 1337 case GNUNET_MESSAGE_TYPE_CADET_ACK:
1338 case GNUNET_MESSAGE_TYPE_MESH_POLL: 1338 case GNUNET_MESSAGE_TYPE_CADET_POLL:
1339 GMP_queue_destroy (q, GNUNET_YES, GNUNET_NO, 0); 1339 GMP_queue_destroy (q, GNUNET_YES, GNUNET_NO, 0);
1340 continue; 1340 continue;
1341 1341
1342 case GNUNET_MESSAGE_TYPE_MESH_KX: 1342 case GNUNET_MESSAGE_TYPE_CADET_KX:
1343 case GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED: 1343 case GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED:
1344 msg = (struct GNUNET_MessageHeader *) q->cls; 1344 msg = (struct GNUNET_MessageHeader *) q->cls;
1345 GMP_queue_destroy (q, GNUNET_NO, GNUNET_NO, 0); 1345 GMP_queue_destroy (q, GNUNET_NO, GNUNET_NO, 0);
1346 return msg; 1346 return msg;
@@ -1355,9 +1355,9 @@ GMP_connection_pop (struct MeshPeer *peer, struct MeshConnection *c)
1355 1355
1356 1356
1357void 1357void
1358GMP_queue_unlock (struct MeshPeer *peer, struct MeshConnection *c) 1358GMP_queue_unlock (struct CadetPeer *peer, struct CadetConnection *c)
1359{ 1359{
1360 struct MeshPeerQueue *q; 1360 struct CadetPeerQueue *q;
1361 size_t size; 1361 size_t size;
1362 1362
1363 if (NULL != peer->core_transmit) 1363 if (NULL != peer->core_transmit)
@@ -1396,16 +1396,16 @@ GMP_init (const struct GNUNET_CONFIGURATION_Handle *c)
1396 LOG (GNUNET_ERROR_TYPE_DEBUG, "init\n"); 1396 LOG (GNUNET_ERROR_TYPE_DEBUG, "init\n");
1397 peers = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO); 1397 peers = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO);
1398 if (GNUNET_OK != 1398 if (GNUNET_OK !=
1399 GNUNET_CONFIGURATION_get_value_number (c, "MESH", "MAX_PEERS", 1399 GNUNET_CONFIGURATION_get_value_number (c, "CADET", "MAX_PEERS",
1400 &max_peers)) 1400 &max_peers))
1401 { 1401 {
1402 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING, 1402 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING,
1403 "MESH", "MAX_PEERS", "USING DEFAULT"); 1403 "CADET", "MAX_PEERS", "USING DEFAULT");
1404 max_peers = 1000; 1404 max_peers = 1000;
1405 } 1405 }
1406 1406
1407 if (GNUNET_OK != 1407 if (GNUNET_OK !=
1408 GNUNET_CONFIGURATION_get_value_number (c, "MESH", "DROP_PERCENT", 1408 GNUNET_CONFIGURATION_get_value_number (c, "CADET", "DROP_PERCENT",
1409 &drop_percent)) 1409 &drop_percent))
1410 { 1410 {
1411 drop_percent = 0; 1411 drop_percent = 0;
@@ -1413,14 +1413,14 @@ GMP_init (const struct GNUNET_CONFIGURATION_Handle *c)
1413 else 1413 else
1414 { 1414 {
1415 LOG (GNUNET_ERROR_TYPE_WARNING, "**************************************\n"); 1415 LOG (GNUNET_ERROR_TYPE_WARNING, "**************************************\n");
1416 LOG (GNUNET_ERROR_TYPE_WARNING, "Mesh is running with DROP enabled.\n"); 1416 LOG (GNUNET_ERROR_TYPE_WARNING, "Cadet is running with DROP enabled.\n");
1417 LOG (GNUNET_ERROR_TYPE_WARNING, "This is NOT a good idea!\n"); 1417 LOG (GNUNET_ERROR_TYPE_WARNING, "This is NOT a good idea!\n");
1418 LOG (GNUNET_ERROR_TYPE_WARNING, "Remove DROP_PERCENT from config file.\n"); 1418 LOG (GNUNET_ERROR_TYPE_WARNING, "Remove DROP_PERCENT from config file.\n");
1419 LOG (GNUNET_ERROR_TYPE_WARNING, "**************************************\n"); 1419 LOG (GNUNET_ERROR_TYPE_WARNING, "**************************************\n");
1420 } 1420 }
1421 1421
1422 core_handle = GNUNET_CORE_connect (c, /* Main configuration */ 1422 core_handle = GNUNET_CORE_connect (c, /* Main configuration */
1423 NULL, /* Closure passed to MESH functions */ 1423 NULL, /* Closure passed to CADET functions */
1424 &core_init, /* Call core_init once connected */ 1424 &core_init, /* Call core_init once connected */
1425 &core_connect, /* Handle connects */ 1425 &core_connect, /* Handle connects */
1426 &core_disconnect, /* remove peers on disconnects */ 1426 &core_disconnect, /* remove peers on disconnects */
@@ -1430,7 +1430,7 @@ GMP_init (const struct GNUNET_CONFIGURATION_Handle *c)
1430 GNUNET_NO, /* For header-only out notification */ 1430 GNUNET_NO, /* For header-only out notification */
1431 core_handlers); /* Register these handlers */ 1431 core_handlers); /* Register these handlers */
1432 if (GNUNET_YES != 1432 if (GNUNET_YES !=
1433 GNUNET_CONFIGURATION_get_value_yesno (c, "MESH", "DISABLE_TRY_CONNECT")) 1433 GNUNET_CONFIGURATION_get_value_yesno (c, "CADET", "DISABLE_TRY_CONNECT"))
1434 { 1434 {
1435 transport_handle = GNUNET_TRANSPORT_connect (c, &my_full_id, NULL, /* cls */ 1435 transport_handle = GNUNET_TRANSPORT_connect (c, &my_full_id, NULL, /* cls */
1436 /* Notify callbacks */ 1436 /* Notify callbacks */
@@ -1478,22 +1478,22 @@ GMP_shutdown (void)
1478} 1478}
1479 1479
1480/** 1480/**
1481 * Retrieve the MeshPeer stucture associated with the peer, create one 1481 * Retrieve the CadetPeer stucture associated with the peer, create one
1482 * and insert it in the appropriate structures if the peer is not known yet. 1482 * and insert it in the appropriate structures if the peer is not known yet.
1483 * 1483 *
1484 * @param peer_id Full identity of the peer. 1484 * @param peer_id Full identity of the peer.
1485 * 1485 *
1486 * @return Existing or newly created peer structure. 1486 * @return Existing or newly created peer structure.
1487 */ 1487 */
1488struct MeshPeer * 1488struct CadetPeer *
1489GMP_get (const struct GNUNET_PeerIdentity *peer_id) 1489GMP_get (const struct GNUNET_PeerIdentity *peer_id)
1490{ 1490{
1491 struct MeshPeer *peer; 1491 struct CadetPeer *peer;
1492 1492
1493 peer = GNUNET_CONTAINER_multipeermap_get (peers, peer_id); 1493 peer = GNUNET_CONTAINER_multipeermap_get (peers, peer_id);
1494 if (NULL == peer) 1494 if (NULL == peer)
1495 { 1495 {
1496 peer = GNUNET_new (struct MeshPeer); 1496 peer = GNUNET_new (struct CadetPeer);
1497 if (GNUNET_CONTAINER_multipeermap_size (peers) > max_peers) 1497 if (GNUNET_CONTAINER_multipeermap_size (peers) > max_peers)
1498 { 1498 {
1499 peer_delete_oldest (); 1499 peer_delete_oldest ();
@@ -1509,14 +1509,14 @@ GMP_get (const struct GNUNET_PeerIdentity *peer_id)
1509 1509
1510 1510
1511/** 1511/**
1512 * Retrieve the MeshPeer stucture associated with the peer, create one 1512 * Retrieve the CadetPeer stucture associated with the peer, create one
1513 * and insert it in the appropriate structures if the peer is not known yet. 1513 * and insert it in the appropriate structures if the peer is not known yet.
1514 * 1514 *
1515 * @param peer Short identity of the peer. 1515 * @param peer Short identity of the peer.
1516 * 1516 *
1517 * @return Existing or newly created peer structure. 1517 * @return Existing or newly created peer structure.
1518 */ 1518 */
1519struct MeshPeer * 1519struct CadetPeer *
1520GMP_get_short (const GNUNET_PEER_Id peer) 1520GMP_get_short (const GNUNET_PEER_Id peer)
1521{ 1521{
1522 return GMP_get (GNUNET_PEER_resolve2 (peer)); 1522 return GMP_get (GNUNET_PEER_resolve2 (peer));
@@ -1532,7 +1532,7 @@ GMP_get_short (const GNUNET_PEER_Id peer)
1532static void 1532static void
1533try_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 1533try_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1534{ 1534{
1535 struct MeshPeer *peer = cls; 1535 struct CadetPeer *peer = cls;
1536 1536
1537 if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) 1537 if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
1538 return; 1538 return;
@@ -1550,11 +1550,11 @@ try_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1550 * @param peer Peer to connect to. 1550 * @param peer Peer to connect to.
1551 */ 1551 */
1552void 1552void
1553GMP_connect (struct MeshPeer *peer) 1553GMP_connect (struct CadetPeer *peer)
1554{ 1554{
1555 struct MeshTunnel3 *t; 1555 struct CadetTunnel3 *t;
1556 struct MeshPeerPath *p; 1556 struct CadetPeerPath *p;
1557 struct MeshConnection *c; 1557 struct CadetConnection *c;
1558 int rerun_search; 1558 int rerun_search;
1559 1559
1560 LOG (GNUNET_ERROR_TYPE_DEBUG, "peer_connect towards %s\n", GMP_2s (peer)); 1560 LOG (GNUNET_ERROR_TYPE_DEBUG, "peer_connect towards %s\n", GMP_2s (peer));
@@ -1584,7 +1584,7 @@ GMP_connect (struct MeshPeer *peer)
1584 /* This case can happen when the path includes a first hop that is 1584 /* This case can happen when the path includes a first hop that is
1585 * not yet known to be connected. 1585 * not yet known to be connected.
1586 * 1586 *
1587 * This happens quite often during testing when running mesh 1587 * This happens quite often during testing when running cadet
1588 * under valgrind: core connect notifications come very late and the 1588 * under valgrind: core connect notifications come very late and the
1589 * DHT result has already come and created a valid path. 1589 * DHT result has already come and created a valid path.
1590 * In this case, the peer->connections hashmap will be NULL and 1590 * In this case, the peer->connections hashmap will be NULL and
@@ -1627,8 +1627,8 @@ GMP_connect (struct MeshPeer *peer)
1627 LOG (GNUNET_ERROR_TYPE_DEBUG, 1627 LOG (GNUNET_ERROR_TYPE_DEBUG,
1628 " Starting DHT GET for peer %s\n", GMP_2s (peer)); 1628 " Starting DHT GET for peer %s\n", GMP_2s (peer));
1629 peer->search_h = GMD_search (id, &search_handler, peer); 1629 peer->search_h = GMD_search (id, &search_handler, peer);
1630 if (MESH_TUNNEL3_NEW == GMT_get_cstate (t)) 1630 if (CADET_TUNNEL3_NEW == GMT_get_cstate (t))
1631 GMT_change_cstate (t, MESH_TUNNEL3_SEARCHING); 1631 GMT_change_cstate (t, CADET_TUNNEL3_SEARCHING);
1632 } 1632 }
1633} 1633}
1634 1634
@@ -1641,9 +1641,9 @@ GMP_connect (struct MeshPeer *peer)
1641 * @return #GNUNET_YES if there is a direct connection. 1641 * @return #GNUNET_YES if there is a direct connection.
1642 */ 1642 */
1643int 1643int
1644GMP_is_neighbor (const struct MeshPeer *peer) 1644GMP_is_neighbor (const struct CadetPeer *peer)
1645{ 1645{
1646 struct MeshPeerPath *path; 1646 struct CadetPeerPath *path;
1647 1647
1648 if (NULL == peer->connections) 1648 if (NULL == peer->connections)
1649 return GNUNET_NO; 1649 return GNUNET_NO;
@@ -1668,7 +1668,7 @@ GMP_is_neighbor (const struct MeshPeer *peer)
1668 * @param peer Peer towards which to create the tunnel. 1668 * @param peer Peer towards which to create the tunnel.
1669 */ 1669 */
1670void 1670void
1671GMP_add_tunnel (struct MeshPeer *peer) 1671GMP_add_tunnel (struct CadetPeer *peer)
1672{ 1672{
1673 if (NULL != peer->tunnel) 1673 if (NULL != peer->tunnel)
1674 return; 1674 return;
@@ -1689,8 +1689,8 @@ GMP_add_tunnel (struct MeshPeer *peer)
1689 * @return GNUNET_OK on success. 1689 * @return GNUNET_OK on success.
1690 */ 1690 */
1691int 1691int
1692GMP_add_connection (struct MeshPeer *peer, 1692GMP_add_connection (struct CadetPeer *peer,
1693 struct MeshConnection *c) 1693 struct CadetConnection *c)
1694{ 1694{
1695 int result; 1695 int result;
1696 LOG (GNUNET_ERROR_TYPE_DEBUG, "adding connection %s\n", GMC_2s (c)); 1696 LOG (GNUNET_ERROR_TYPE_DEBUG, "adding connection %s\n", GMC_2s (c));
@@ -1732,11 +1732,11 @@ GMP_add_connection (struct MeshPeer *peer,
1732 * @return path if path was taken, pointer to existing duplicate if exists 1732 * @return path if path was taken, pointer to existing duplicate if exists
1733 * NULL on error. 1733 * NULL on error.
1734 */ 1734 */
1735struct MeshPeerPath * 1735struct CadetPeerPath *
1736GMP_add_path (struct MeshPeer *peer, struct MeshPeerPath *path, 1736GMP_add_path (struct CadetPeer *peer, struct CadetPeerPath *path,
1737 int trusted) 1737 int trusted)
1738{ 1738{
1739 struct MeshPeerPath *aux; 1739 struct CadetPeerPath *aux;
1740 unsigned int l; 1740 unsigned int l;
1741 unsigned int l2; 1741 unsigned int l2;
1742 1742
@@ -1838,9 +1838,9 @@ GMP_add_path (struct MeshPeer *peer, struct MeshPeerPath *path,
1838 * @return path if path was taken, pointer to existing duplicate if exists 1838 * @return path if path was taken, pointer to existing duplicate if exists
1839 * NULL on error. 1839 * NULL on error.
1840 */ 1840 */
1841struct MeshPeerPath * 1841struct CadetPeerPath *
1842GMP_add_path_to_origin (struct MeshPeer *peer, 1842GMP_add_path_to_origin (struct CadetPeer *peer,
1843 struct MeshPeerPath *path, 1843 struct CadetPeerPath *path,
1844 int trusted) 1844 int trusted)
1845{ 1845{
1846 if (NULL == path) 1846 if (NULL == path)
@@ -1857,7 +1857,7 @@ GMP_add_path_to_origin (struct MeshPeer *peer,
1857 * @param confirmed Whether we know if the path works or not. 1857 * @param confirmed Whether we know if the path works or not.
1858 */ 1858 */
1859void 1859void
1860GMP_add_path_to_all (const struct MeshPeerPath *p, int confirmed) 1860GMP_add_path_to_all (const struct CadetPeerPath *p, int confirmed)
1861{ 1861{
1862 unsigned int i; 1862 unsigned int i;
1863 1863
@@ -1865,8 +1865,8 @@ GMP_add_path_to_all (const struct MeshPeerPath *p, int confirmed)
1865 for (i = 0; i < p->length && p->peers[i] != myid; i++) /* skip'em */ ; 1865 for (i = 0; i < p->length && p->peers[i] != myid; i++) /* skip'em */ ;
1866 for (i++; i < p->length; i++) 1866 for (i++; i < p->length; i++)
1867 { 1867 {
1868 struct MeshPeer *aux; 1868 struct CadetPeer *aux;
1869 struct MeshPeerPath *copy; 1869 struct CadetPeerPath *copy;
1870 1870
1871 aux = GMP_get_short (p->peers[i]); 1871 aux = GMP_get_short (p->peers[i]);
1872 copy = path_duplicate (p); 1872 copy = path_duplicate (p);
@@ -1883,10 +1883,10 @@ GMP_add_path_to_all (const struct MeshPeerPath *p, int confirmed)
1883 * @param path Path to remove. Is always destroyed . 1883 * @param path Path to remove. Is always destroyed .
1884 */ 1884 */
1885void 1885void
1886GMP_remove_path (struct MeshPeer *peer, struct MeshPeerPath *path) 1886GMP_remove_path (struct CadetPeer *peer, struct CadetPeerPath *path)
1887{ 1887{
1888 struct MeshPeerPath *iter; 1888 struct CadetPeerPath *iter;
1889 struct MeshPeerPath *next; 1889 struct CadetPeerPath *next;
1890 1890
1891 GNUNET_assert (myid == path->peers[0]); 1891 GNUNET_assert (myid == path->peers[0]);
1892 GNUNET_assert (peer->id == path->peers[path->length - 1]); 1892 GNUNET_assert (peer->id == path->peers[path->length - 1]);
@@ -1915,8 +1915,8 @@ GMP_remove_path (struct MeshPeer *peer, struct MeshPeerPath *path)
1915 * @return GNUNET_OK on success. 1915 * @return GNUNET_OK on success.
1916 */ 1916 */
1917int 1917int
1918GMP_remove_connection (struct MeshPeer *peer, 1918GMP_remove_connection (struct CadetPeer *peer,
1919 const struct MeshConnection *c) 1919 const struct CadetConnection *c)
1920{ 1920{
1921 LOG (GNUNET_ERROR_TYPE_DEBUG, "removing connection %s\n", GMC_2s (c)); 1921 LOG (GNUNET_ERROR_TYPE_DEBUG, "removing connection %s\n", GMC_2s (c));
1922 LOG (GNUNET_ERROR_TYPE_DEBUG, "from peer %s\n", GMP_2s (peer)); 1922 LOG (GNUNET_ERROR_TYPE_DEBUG, "from peer %s\n", GMP_2s (peer));
@@ -1944,7 +1944,7 @@ GMP_remove_connection (struct MeshPeer *peer,
1944 * @param peer Destination peer. 1944 * @param peer Destination peer.
1945 */ 1945 */
1946void 1946void
1947GMP_start_search (struct MeshPeer *peer) 1947GMP_start_search (struct CadetPeer *peer)
1948{ 1948{
1949 if (NULL != peer->search_h) 1949 if (NULL != peer->search_h)
1950 { 1950 {
@@ -1963,7 +1963,7 @@ GMP_start_search (struct MeshPeer *peer)
1963 * @param peer Destination peer. 1963 * @param peer Destination peer.
1964 */ 1964 */
1965void 1965void
1966GMP_stop_search (struct MeshPeer *peer) 1966GMP_stop_search (struct CadetPeer *peer)
1967{ 1967{
1968 if (NULL == peer->search_h) 1968 if (NULL == peer->search_h)
1969 { 1969 {
@@ -1983,7 +1983,7 @@ GMP_stop_search (struct MeshPeer *peer)
1983 * @return Full ID of peer. 1983 * @return Full ID of peer.
1984 */ 1984 */
1985const struct GNUNET_PeerIdentity * 1985const struct GNUNET_PeerIdentity *
1986GMP_get_id (const struct MeshPeer *peer) 1986GMP_get_id (const struct CadetPeer *peer)
1987{ 1987{
1988 return GNUNET_PEER_resolve2 (peer->id); 1988 return GNUNET_PEER_resolve2 (peer->id);
1989} 1989}
@@ -1997,7 +1997,7 @@ GMP_get_id (const struct MeshPeer *peer)
1997 * @return Short ID of peer. 1997 * @return Short ID of peer.
1998 */ 1998 */
1999GNUNET_PEER_Id 1999GNUNET_PEER_Id
2000GMP_get_short_id (const struct MeshPeer *peer) 2000GMP_get_short_id (const struct CadetPeer *peer)
2001{ 2001{
2002 return peer->id; 2002 return peer->id;
2003} 2003}
@@ -2010,7 +2010,7 @@ GMP_get_short_id (const struct MeshPeer *peer)
2010 * @param t Tunnel. 2010 * @param t Tunnel.
2011 */ 2011 */
2012void 2012void
2013GMP_set_tunnel (struct MeshPeer *peer, struct MeshTunnel3 *t) 2013GMP_set_tunnel (struct CadetPeer *peer, struct CadetTunnel3 *t)
2014{ 2014{
2015 peer->tunnel = t; 2015 peer->tunnel = t;
2016 if (NULL == t && NULL != peer->search_h) 2016 if (NULL == t && NULL != peer->search_h)
@@ -2027,8 +2027,8 @@ GMP_set_tunnel (struct MeshPeer *peer, struct MeshTunnel3 *t)
2027 * 2027 *
2028 * @return Tunnel towards peer. 2028 * @return Tunnel towards peer.
2029 */ 2029 */
2030struct MeshTunnel3 * 2030struct CadetTunnel3 *
2031GMP_get_tunnel (const struct MeshPeer *peer) 2031GMP_get_tunnel (const struct CadetPeer *peer)
2032{ 2032{
2033 return peer->tunnel; 2033 return peer->tunnel;
2034} 2034}
@@ -2041,7 +2041,7 @@ GMP_get_tunnel (const struct MeshPeer *peer)
2041 * @param hello Hello message. 2041 * @param hello Hello message.
2042 */ 2042 */
2043void 2043void
2044GMP_set_hello (struct MeshPeer *peer, const struct GNUNET_HELLO_Message *hello) 2044GMP_set_hello (struct CadetPeer *peer, const struct GNUNET_HELLO_Message *hello)
2045{ 2045{
2046 struct GNUNET_HELLO_Message *old; 2046 struct GNUNET_HELLO_Message *old;
2047 size_t size; 2047 size_t size;
@@ -2076,7 +2076,7 @@ GMP_set_hello (struct MeshPeer *peer, const struct GNUNET_HELLO_Message *hello)
2076 * @return Hello message. 2076 * @return Hello message.
2077 */ 2077 */
2078struct GNUNET_HELLO_Message * 2078struct GNUNET_HELLO_Message *
2079GMP_get_hello (struct MeshPeer *peer) 2079GMP_get_hello (struct CadetPeer *peer)
2080{ 2080{
2081 struct GNUNET_TIME_Absolute expiration; 2081 struct GNUNET_TIME_Absolute expiration;
2082 struct GNUNET_TIME_Relative remaining; 2082 struct GNUNET_TIME_Relative remaining;
@@ -2103,7 +2103,7 @@ GMP_get_hello (struct MeshPeer *peer)
2103 * @param peer Peer to whom to connect. 2103 * @param peer Peer to whom to connect.
2104 */ 2104 */
2105void 2105void
2106GMP_try_connect (struct MeshPeer *peer) 2106GMP_try_connect (struct CadetPeer *peer)
2107{ 2107{
2108 struct GNUNET_HELLO_Message *hello; 2108 struct GNUNET_HELLO_Message *hello;
2109 struct GNUNET_MessageHeader *mh; 2109 struct GNUNET_MessageHeader *mh;
@@ -2129,12 +2129,12 @@ GMP_try_connect (struct MeshPeer *peer)
2129 * @param peer2 Peer whose link is broken. 2129 * @param peer2 Peer whose link is broken.
2130 */ 2130 */
2131void 2131void
2132GMP_notify_broken_link (struct MeshPeer *peer, 2132GMP_notify_broken_link (struct CadetPeer *peer,
2133 struct GNUNET_PeerIdentity *peer1, 2133 struct GNUNET_PeerIdentity *peer1,
2134 struct GNUNET_PeerIdentity *peer2) 2134 struct GNUNET_PeerIdentity *peer2)
2135{ 2135{
2136 struct MeshPeerPath *iter; 2136 struct CadetPeerPath *iter;
2137 struct MeshPeerPath *next; 2137 struct CadetPeerPath *next;
2138 unsigned int i; 2138 unsigned int i;
2139 GNUNET_PEER_Id p1; 2139 GNUNET_PEER_Id p1;
2140 GNUNET_PEER_Id p2; 2140 GNUNET_PEER_Id p2;
@@ -2178,9 +2178,9 @@ GMP_notify_broken_link (struct MeshPeer *peer,
2178 * @return Number of known paths. 2178 * @return Number of known paths.
2179 */ 2179 */
2180unsigned int 2180unsigned int
2181GMP_count_paths (const struct MeshPeer *peer) 2181GMP_count_paths (const struct CadetPeer *peer)
2182{ 2182{
2183 struct MeshPeerPath *iter; 2183 struct CadetPeerPath *iter;
2184 unsigned int i; 2184 unsigned int i;
2185 2185
2186 for (iter = peer->path_head, i = 0; NULL != iter; iter = iter->next) 2186 for (iter = peer->path_head, i = 0; NULL != iter; iter = iter->next)
@@ -2211,7 +2211,7 @@ GMP_iterate_all (GNUNET_CONTAINER_PeerMapIterator iter, void *cls)
2211 * @return Static string for it's ID. 2211 * @return Static string for it's ID.
2212 */ 2212 */
2213const char * 2213const char *
2214GMP_2s (const struct MeshPeer *peer) 2214GMP_2s (const struct CadetPeer *peer)
2215{ 2215{
2216 if (NULL == peer) 2216 if (NULL == peer)
2217 return "(NULL)"; 2217 return "(NULL)";
diff --git a/src/mesh/gnunet-service-mesh_peer.h b/src/mesh/gnunet-service-mesh_peer.h
index 57f5212b0..9f1146e9f 100644
--- a/src/mesh/gnunet-service-mesh_peer.h
+++ b/src/mesh/gnunet-service-mesh_peer.h
@@ -19,15 +19,15 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file mesh/gnunet-service-mesh_peer.h 22 * @file cadet/gnunet-service-cadet_peer.h
23 * @brief mesh service; dealing with remote peers 23 * @brief cadet service; dealing with remote peers
24 * @author Bartlomiej Polot 24 * @author Bartlomiej Polot
25 * 25 *
26 * All functions in this file should use the prefix GMP (Gnunet Mesh Peer) 26 * All functions in this file should use the prefix GMP (Gnunet Cadet Peer)
27 */ 27 */
28 28
29#ifndef GNUNET_SERVICE_MESH_PEER_H 29#ifndef GNUNET_SERVICE_CADET_PEER_H
30#define GNUNET_SERVICE_MESH_PEER_H 30#define GNUNET_SERVICE_CADET_PEER_H
31 31
32#ifdef __cplusplus 32#ifdef __cplusplus
33extern "C" 33extern "C"
@@ -43,14 +43,14 @@ extern "C"
43/** 43/**
44 * Struct containing all information regarding a given peer 44 * Struct containing all information regarding a given peer
45 */ 45 */
46struct MeshPeer; 46struct CadetPeer;
47 47
48/** 48/**
49 * Struct containing info about a queued transmission to this peer 49 * Struct containing info about a queued transmission to this peer
50 */ 50 */
51struct MeshPeerQueue; 51struct CadetPeerQueue;
52 52
53#include "gnunet-service-mesh_connection.h" 53#include "gnunet-service-cadet_connection.h"
54 54
55/** 55/**
56 * Callback called when a queued message is sent. 56 * Callback called when a queued message is sent.
@@ -65,7 +65,7 @@ struct MeshPeerQueue;
65 * @param wait Time spent waiting for core (only the time for THIS message) 65 * @param wait Time spent waiting for core (only the time for THIS message)
66 */ 66 */
67typedef void (*GMP_sent) (void *cls, 67typedef void (*GMP_sent) (void *cls,
68 struct MeshConnection *c, int sent, 68 struct CadetConnection *c, int sent,
69 uint16_t type, uint32_t pid, int fwd, size_t size, 69 uint16_t type, uint32_t pid, int fwd, size_t size,
70 struct GNUNET_TIME_Relative wait); 70 struct GNUNET_TIME_Relative wait);
71 71
@@ -89,26 +89,26 @@ GMP_shutdown (void);
89 89
90 90
91/** 91/**
92 * Retrieve the MeshPeer stucture associated with the peer, create one 92 * Retrieve the CadetPeer stucture associated with the peer, create one
93 * and insert it in the appropriate structures if the peer is not known yet. 93 * and insert it in the appropriate structures if the peer is not known yet.
94 * 94 *
95 * @param peer_id Full identity of the peer. 95 * @param peer_id Full identity of the peer.
96 * 96 *
97 * @return Existing or newly created peer structure. 97 * @return Existing or newly created peer structure.
98 */ 98 */
99struct MeshPeer * 99struct CadetPeer *
100GMP_get (const struct GNUNET_PeerIdentity *peer_id); 100GMP_get (const struct GNUNET_PeerIdentity *peer_id);
101 101
102 102
103/** 103/**
104 * Retrieve the MeshPeer stucture associated with the peer, create one 104 * Retrieve the CadetPeer stucture associated with the peer, create one
105 * and insert it in the appropriate structures if the peer is not known yet. 105 * and insert it in the appropriate structures if the peer is not known yet.
106 * 106 *
107 * @param peer Short identity of the peer. 107 * @param peer Short identity of the peer.
108 * 108 *
109 * @return Existing or newly created peer structure. 109 * @return Existing or newly created peer structure.
110 */ 110 */
111struct MeshPeer * 111struct CadetPeer *
112GMP_get_short (const GNUNET_PEER_Id peer); 112GMP_get_short (const GNUNET_PEER_Id peer);
113 113
114/** 114/**
@@ -119,7 +119,7 @@ GMP_get_short (const GNUNET_PEER_Id peer);
119 * @param peer Peer to connect to. 119 * @param peer Peer to connect to.
120 */ 120 */
121void 121void
122GMP_connect (struct MeshPeer *peer); 122GMP_connect (struct CadetPeer *peer);
123 123
124/** 124/**
125 * Free a transmission that was already queued with all resources 125 * Free a transmission that was already queued with all resources
@@ -131,7 +131,7 @@ GMP_connect (struct MeshPeer *peer);
131 * @param pid PID, if relevant (was sent and was a payload message). 131 * @param pid PID, if relevant (was sent and was a payload message).
132 */ 132 */
133void 133void
134GMP_queue_destroy (struct MeshPeerQueue *queue, int clear_cls, 134GMP_queue_destroy (struct CadetPeerQueue *queue, int clear_cls,
135 int sent, uint32_t pid); 135 int sent, uint32_t pid);
136 136
137/** 137/**
@@ -150,10 +150,10 @@ GMP_queue_destroy (struct MeshPeerQueue *queue, int clear_cls,
150 * @return Handle to cancel the message before it is sent. Once cont is called 150 * @return Handle to cancel the message before it is sent. Once cont is called
151 * message has been sent and therefore the handle is no longer valid. 151 * message has been sent and therefore the handle is no longer valid.
152 */ 152 */
153struct MeshPeerQueue * 153struct CadetPeerQueue *
154GMP_queue_add (struct MeshPeer *peer, void *cls, uint16_t type, 154GMP_queue_add (struct CadetPeer *peer, void *cls, uint16_t type,
155 uint16_t payload_type, uint32_t payload_id, 155 uint16_t payload_type, uint32_t payload_id,
156 size_t size, struct MeshConnection *c, int fwd, 156 size_t size, struct CadetConnection *c, int fwd,
157 GMP_sent cont, void *cont_cls); 157 GMP_sent cont, void *cont_cls);
158 158
159/** 159/**
@@ -164,7 +164,7 @@ GMP_queue_add (struct MeshPeer *peer, void *cls, uint16_t type,
164 * the sent continuation call. 164 * the sent continuation call.
165 */ 165 */
166void 166void
167GMP_queue_cancel (struct MeshPeer *peer, struct MeshConnection *c); 167GMP_queue_cancel (struct CadetPeer *peer, struct CadetConnection *c);
168 168
169/** 169/**
170 * Get the first message for a connection and unqueue it. 170 * Get the first message for a connection and unqueue it.
@@ -175,10 +175,10 @@ GMP_queue_cancel (struct MeshPeer *peer, struct MeshConnection *c);
175 * @return First message for this connection. 175 * @return First message for this connection.
176 */ 176 */
177struct GNUNET_MessageHeader * 177struct GNUNET_MessageHeader *
178GMP_connection_pop (struct MeshPeer *peer, struct MeshConnection *c); 178GMP_connection_pop (struct CadetPeer *peer, struct CadetConnection *c);
179 179
180void 180void
181GMP_queue_unlock (struct MeshPeer *peer, struct MeshConnection *c); 181GMP_queue_unlock (struct CadetPeer *peer, struct CadetConnection *c);
182 182
183/** 183/**
184 * Set tunnel. 184 * Set tunnel.
@@ -187,7 +187,7 @@ GMP_queue_unlock (struct MeshPeer *peer, struct MeshConnection *c);
187 * @param t Tunnel. 187 * @param t Tunnel.
188 */ 188 */
189void 189void
190GMP_set_tunnel (struct MeshPeer *peer, struct MeshTunnel3 *t); 190GMP_set_tunnel (struct CadetPeer *peer, struct CadetTunnel3 *t);
191 191
192/** 192/**
193 * Check whether there is a direct (core level) connection to peer. 193 * Check whether there is a direct (core level) connection to peer.
@@ -197,7 +197,7 @@ GMP_set_tunnel (struct MeshPeer *peer, struct MeshTunnel3 *t);
197 * @return #GNUNET_YES if there is a direct connection. 197 * @return #GNUNET_YES if there is a direct connection.
198 */ 198 */
199int 199int
200GMP_is_neighbor (const struct MeshPeer *peer); 200GMP_is_neighbor (const struct CadetPeer *peer);
201 201
202/** 202/**
203 * Create and initialize a new tunnel towards a peer, in case it has none. 203 * Create and initialize a new tunnel towards a peer, in case it has none.
@@ -207,7 +207,7 @@ GMP_is_neighbor (const struct MeshPeer *peer);
207 * @param peer Peer towards which to create the tunnel. 207 * @param peer Peer towards which to create the tunnel.
208 */ 208 */
209void 209void
210GMP_add_tunnel (struct MeshPeer *peer); 210GMP_add_tunnel (struct CadetPeer *peer);
211 211
212/** 212/**
213 * Add a connection to a neighboring peer. 213 * Add a connection to a neighboring peer.
@@ -222,7 +222,7 @@ GMP_add_tunnel (struct MeshPeer *peer);
222 * @return GNUNET_OK on success. 222 * @return GNUNET_OK on success.
223 */ 223 */
224int 224int
225GMP_add_connection (struct MeshPeer *peer, struct MeshConnection *c); 225GMP_add_connection (struct CadetPeer *peer, struct CadetConnection *c);
226 226
227/** 227/**
228 * Add the path to the peer and update the path used to reach it in case this 228 * Add the path to the peer and update the path used to reach it in case this
@@ -236,8 +236,8 @@ GMP_add_connection (struct MeshPeer *peer, struct MeshConnection *c);
236 * @return path if path was taken, pointer to existing duplicate if exists 236 * @return path if path was taken, pointer to existing duplicate if exists
237 * NULL on error. 237 * NULL on error.
238 */ 238 */
239struct MeshPeerPath * 239struct CadetPeerPath *
240GMP_add_path (struct MeshPeer *peer, struct MeshPeerPath *p, int trusted); 240GMP_add_path (struct CadetPeer *peer, struct CadetPeerPath *p, int trusted);
241 241
242/** 242/**
243 * Add the path to the origin peer and update the path used to reach it in case 243 * Add the path to the origin peer and update the path used to reach it in case
@@ -253,9 +253,9 @@ GMP_add_path (struct MeshPeer *peer, struct MeshPeerPath *p, int trusted);
253 * @return path if path was taken, pointer to existing duplicate if exists 253 * @return path if path was taken, pointer to existing duplicate if exists
254 * NULL on error. 254 * NULL on error.
255 */ 255 */
256struct MeshPeerPath * 256struct CadetPeerPath *
257GMP_add_path_to_origin (struct MeshPeer *peer, 257GMP_add_path_to_origin (struct CadetPeer *peer,
258 struct MeshPeerPath *path, 258 struct CadetPeerPath *path,
259 int trusted); 259 int trusted);
260 260
261/** 261/**
@@ -265,7 +265,7 @@ GMP_add_path_to_origin (struct MeshPeer *peer,
265 * @param confirmed Whether we know if the path works or not. 265 * @param confirmed Whether we know if the path works or not.
266 */ 266 */
267void 267void
268GMP_add_path_to_all (const struct MeshPeerPath *p, int confirmed); 268GMP_add_path_to_all (const struct CadetPeerPath *p, int confirmed);
269 269
270/** 270/**
271 * Remove any path to the peer that has the extact same peers as the one given. 271 * Remove any path to the peer that has the extact same peers as the one given.
@@ -274,7 +274,7 @@ GMP_add_path_to_all (const struct MeshPeerPath *p, int confirmed);
274 * @param path Path to remove. Is always destroyed . 274 * @param path Path to remove. Is always destroyed .
275 */ 275 */
276void 276void
277GMP_remove_path (struct MeshPeer *peer, struct MeshPeerPath *path); 277GMP_remove_path (struct CadetPeer *peer, struct CadetPeerPath *path);
278 278
279/** 279/**
280 * Remove a connection from a neighboring peer. 280 * Remove a connection from a neighboring peer.
@@ -285,7 +285,7 @@ GMP_remove_path (struct MeshPeer *peer, struct MeshPeerPath *path);
285 * @return GNUNET_OK on success. 285 * @return GNUNET_OK on success.
286 */ 286 */
287int 287int
288GMP_remove_connection (struct MeshPeer *peer, const struct MeshConnection *c); 288GMP_remove_connection (struct CadetPeer *peer, const struct CadetConnection *c);
289 289
290/** 290/**
291 * Start the DHT search for new paths towards the peer: we don't have 291 * Start the DHT search for new paths towards the peer: we don't have
@@ -294,7 +294,7 @@ GMP_remove_connection (struct MeshPeer *peer, const struct MeshConnection *c);
294 * @param peer Destination peer. 294 * @param peer Destination peer.
295 */ 295 */
296void 296void
297GMP_start_search (struct MeshPeer *peer); 297GMP_start_search (struct CadetPeer *peer);
298 298
299/** 299/**
300 * Stop the DHT search for new paths towards the peer: we already have 300 * Stop the DHT search for new paths towards the peer: we already have
@@ -303,7 +303,7 @@ GMP_start_search (struct MeshPeer *peer);
303 * @param peer Destination peer. 303 * @param peer Destination peer.
304 */ 304 */
305void 305void
306GMP_stop_search (struct MeshPeer *peer); 306GMP_stop_search (struct CadetPeer *peer);
307 307
308/** 308/**
309 * Get the Full ID of a peer. 309 * Get the Full ID of a peer.
@@ -313,7 +313,7 @@ GMP_stop_search (struct MeshPeer *peer);
313 * @return Full ID of peer. 313 * @return Full ID of peer.
314 */ 314 */
315const struct GNUNET_PeerIdentity * 315const struct GNUNET_PeerIdentity *
316GMP_get_id (const struct MeshPeer *peer); 316GMP_get_id (const struct CadetPeer *peer);
317 317
318/** 318/**
319 * Get the Short ID of a peer. 319 * Get the Short ID of a peer.
@@ -323,7 +323,7 @@ GMP_get_id (const struct MeshPeer *peer);
323 * @return Short ID of peer. 323 * @return Short ID of peer.
324 */ 324 */
325GNUNET_PEER_Id 325GNUNET_PEER_Id
326GMP_get_short_id (const struct MeshPeer *peer); 326GMP_get_short_id (const struct CadetPeer *peer);
327 327
328/** 328/**
329 * Get the tunnel towards a peer. 329 * Get the tunnel towards a peer.
@@ -332,8 +332,8 @@ GMP_get_short_id (const struct MeshPeer *peer);
332 * 332 *
333 * @return Tunnel towards peer. 333 * @return Tunnel towards peer.
334 */ 334 */
335struct MeshTunnel3 * 335struct CadetTunnel3 *
336GMP_get_tunnel (const struct MeshPeer *peer); 336GMP_get_tunnel (const struct CadetPeer *peer);
337 337
338/** 338/**
339 * Set the hello message. 339 * Set the hello message.
@@ -342,7 +342,7 @@ GMP_get_tunnel (const struct MeshPeer *peer);
342 * @param hello Hello message. 342 * @param hello Hello message.
343 */ 343 */
344void 344void
345GMP_set_hello (struct MeshPeer *peer, const struct GNUNET_HELLO_Message *hello); 345GMP_set_hello (struct CadetPeer *peer, const struct GNUNET_HELLO_Message *hello);
346 346
347/** 347/**
348 * Get the hello message. 348 * Get the hello message.
@@ -352,7 +352,7 @@ GMP_set_hello (struct MeshPeer *peer, const struct GNUNET_HELLO_Message *hello);
352 * @return Hello message. 352 * @return Hello message.
353 */ 353 */
354struct GNUNET_HELLO_Message * 354struct GNUNET_HELLO_Message *
355GMP_get_hello (struct MeshPeer *peer); 355GMP_get_hello (struct CadetPeer *peer);
356 356
357 357
358/** 358/**
@@ -361,7 +361,7 @@ GMP_get_hello (struct MeshPeer *peer);
361 * @param peer Peer to whom to connect. 361 * @param peer Peer to whom to connect.
362 */ 362 */
363void 363void
364GMP_try_connect (struct MeshPeer *peer); 364GMP_try_connect (struct CadetPeer *peer);
365 365
366/** 366/**
367 * Notify a peer that a link between two other peers is broken. If any path 367 * Notify a peer that a link between two other peers is broken. If any path
@@ -372,7 +372,7 @@ GMP_try_connect (struct MeshPeer *peer);
372 * @param peer2 Peer whose link is broken. 372 * @param peer2 Peer whose link is broken.
373 */ 373 */
374void 374void
375GMP_notify_broken_link (struct MeshPeer *peer, 375GMP_notify_broken_link (struct CadetPeer *peer,
376 struct GNUNET_PeerIdentity *peer1, 376 struct GNUNET_PeerIdentity *peer1,
377 struct GNUNET_PeerIdentity *peer2); 377 struct GNUNET_PeerIdentity *peer2);
378 378
@@ -384,7 +384,7 @@ GMP_notify_broken_link (struct MeshPeer *peer,
384 * @return Number of known paths. 384 * @return Number of known paths.
385 */ 385 */
386unsigned int 386unsigned int
387GMP_count_paths (const struct MeshPeer *peer); 387GMP_count_paths (const struct CadetPeer *peer);
388 388
389/** 389/**
390 * Iterate all known peers. 390 * Iterate all known peers.
@@ -403,7 +403,7 @@ GMP_iterate_all (GNUNET_CONTAINER_PeerMapIterator iter, void *cls);
403 * @return Static string for it's ID. 403 * @return Static string for it's ID.
404 */ 404 */
405const char * 405const char *
406GMP_2s (const struct MeshPeer *peer); 406GMP_2s (const struct CadetPeer *peer);
407 407
408 408
409#if 0 /* keep Emacsens' auto-indent happy */ 409#if 0 /* keep Emacsens' auto-indent happy */
@@ -413,6 +413,6 @@ GMP_2s (const struct MeshPeer *peer);
413} 413}
414#endif 414#endif
415 415
416/* ifndef GNUNET_MESH_SERVICE_PEER_H */ 416/* ifndef GNUNET_CADET_SERVICE_PEER_H */
417#endif 417#endif
418/* end of gnunet-mesh-service_peer.h */ 418/* end of gnunet-cadet-service_peer.h */
diff --git a/src/mesh/gnunet-service-mesh_tunnel.c b/src/mesh/gnunet-service-mesh_tunnel.c
index ffe4bd624..f2be27bf5 100644
--- a/src/mesh/gnunet-service-mesh_tunnel.c
+++ b/src/mesh/gnunet-service-mesh_tunnel.c
@@ -24,15 +24,15 @@
24#include "gnunet_signatures.h" 24#include "gnunet_signatures.h"
25#include "gnunet_statistics_service.h" 25#include "gnunet_statistics_service.h"
26 26
27#include "mesh_protocol.h" 27#include "cadet_protocol.h"
28#include "mesh_path.h" 28#include "cadet_path.h"
29 29
30#include "gnunet-service-mesh_tunnel.h" 30#include "gnunet-service-cadet_tunnel.h"
31#include "gnunet-service-mesh_connection.h" 31#include "gnunet-service-cadet_connection.h"
32#include "gnunet-service-mesh_channel.h" 32#include "gnunet-service-cadet_channel.h"
33#include "gnunet-service-mesh_peer.h" 33#include "gnunet-service-cadet_peer.h"
34 34
35#define LOG(level, ...) GNUNET_log_from(level,"mesh-tun",__VA_ARGS__) 35#define LOG(level, ...) GNUNET_log_from(level,"cadet-tun",__VA_ARGS__)
36 36
37#define REKEY_WAIT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 5) 37#define REKEY_WAIT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 5)
38 38
@@ -42,33 +42,33 @@
42/******************************** STRUCTS **********************************/ 42/******************************** STRUCTS **********************************/
43/******************************************************************************/ 43/******************************************************************************/
44 44
45struct MeshTChannel 45struct CadetTChannel
46{ 46{
47 struct MeshTChannel *next; 47 struct CadetTChannel *next;
48 struct MeshTChannel *prev; 48 struct CadetTChannel *prev;
49 struct MeshChannel *ch; 49 struct CadetChannel *ch;
50}; 50};
51 51
52 52
53/** 53/**
54 * Connection list and metadata. 54 * Connection list and metadata.
55 */ 55 */
56struct MeshTConnection 56struct CadetTConnection
57{ 57{
58 /** 58 /**
59 * Next in DLL. 59 * Next in DLL.
60 */ 60 */
61 struct MeshTConnection *next; 61 struct CadetTConnection *next;
62 62
63 /** 63 /**
64 * Prev in DLL. 64 * Prev in DLL.
65 */ 65 */
66 struct MeshTConnection *prev; 66 struct CadetTConnection *prev;
67 67
68 /** 68 /**
69 * Connection handle. 69 * Connection handle.
70 */ 70 */
71 struct MeshConnection *c; 71 struct CadetConnection *c;
72 72
73 /** 73 /**
74 * Creation time, to keep oldest connection alive. 74 * Creation time, to keep oldest connection alive.
@@ -84,7 +84,7 @@ struct MeshTConnection
84/** 84/**
85 * Structure used during a Key eXchange. 85 * Structure used during a Key eXchange.
86 */ 86 */
87struct MeshTunnelKXCtx 87struct CadetTunnelKXCtx
88{ 88{
89 /** 89 /**
90 * Decryption ("their") old key, for decrypting traffic sent by the 90 * Decryption ("their") old key, for decrypting traffic sent by the
@@ -101,27 +101,27 @@ struct MeshTunnelKXCtx
101/** 101/**
102 * Struct containing all information regarding a tunnel to a peer. 102 * Struct containing all information regarding a tunnel to a peer.
103 */ 103 */
104struct MeshTunnel3 104struct CadetTunnel3
105{ 105{
106 /** 106 /**
107 * Endpoint of the tunnel. 107 * Endpoint of the tunnel.
108 */ 108 */
109 struct MeshPeer *peer; 109 struct CadetPeer *peer;
110 110
111 /** 111 /**
112 * State of the tunnel connectivity. 112 * State of the tunnel connectivity.
113 */ 113 */
114 enum MeshTunnel3CState cstate; 114 enum CadetTunnel3CState cstate;
115 115
116 /** 116 /**
117 * State of the tunnel encryption. 117 * State of the tunnel encryption.
118 */ 118 */
119 enum MeshTunnel3EState estate; 119 enum CadetTunnel3EState estate;
120 120
121 /** 121 /**
122 * Key eXchange context. 122 * Key eXchange context.
123 */ 123 */
124 struct MeshTunnelKXCtx *kx_ctx; 124 struct CadetTunnelKXCtx *kx_ctx;
125 125
126 /** 126 /**
127 * Encryption ("our") key. 127 * Encryption ("our") key.
@@ -141,8 +141,8 @@ struct MeshTunnel3
141 /** 141 /**
142 * Paths that are actively used to reach the destination peer. 142 * Paths that are actively used to reach the destination peer.
143 */ 143 */
144 struct MeshTConnection *connection_head; 144 struct CadetTConnection *connection_head;
145 struct MeshTConnection *connection_tail; 145 struct CadetTConnection *connection_tail;
146 146
147 /** 147 /**
148 * Next connection number. 148 * Next connection number.
@@ -152,13 +152,13 @@ struct MeshTunnel3
152 /** 152 /**
153 * Channels inside this tunnel. 153 * Channels inside this tunnel.
154 */ 154 */
155 struct MeshTChannel *channel_head; 155 struct CadetTChannel *channel_head;
156 struct MeshTChannel *channel_tail; 156 struct CadetTChannel *channel_tail;
157 157
158 /** 158 /**
159 * Channel ID for the next created channel. 159 * Channel ID for the next created channel.
160 */ 160 */
161 MESH_ChannelNumber next_chid; 161 CADET_ChannelNumber next_chid;
162 162
163 /** 163 /**
164 * Destroy flag: if true, destroy on last message. 164 * Destroy flag: if true, destroy on last message.
@@ -168,31 +168,31 @@ struct MeshTunnel3
168 /** 168 /**
169 * Queued messages, to transmit once tunnel gets connected. 169 * Queued messages, to transmit once tunnel gets connected.
170 */ 170 */
171 struct MeshTunnelDelayed *tq_head; 171 struct CadetTunnelDelayed *tq_head;
172 struct MeshTunnelDelayed *tq_tail; 172 struct CadetTunnelDelayed *tq_tail;
173}; 173};
174 174
175 175
176/** 176/**
177 * Struct used to save messages in a non-ready tunnel to send once connected. 177 * Struct used to save messages in a non-ready tunnel to send once connected.
178 */ 178 */
179struct MeshTunnelDelayed 179struct CadetTunnelDelayed
180{ 180{
181 /** 181 /**
182 * DLL 182 * DLL
183 */ 183 */
184 struct MeshTunnelDelayed *next; 184 struct CadetTunnelDelayed *next;
185 struct MeshTunnelDelayed *prev; 185 struct CadetTunnelDelayed *prev;
186 186
187 /** 187 /**
188 * Tunnel. 188 * Tunnel.
189 */ 189 */
190 struct MeshTunnel3 *t; 190 struct CadetTunnel3 *t;
191 191
192 /** 192 /**
193 * Tunnel queue given to the channel to cancel request. Update on send_queued. 193 * Tunnel queue given to the channel to cancel request. Update on send_queued.
194 */ 194 */
195 struct MeshTunnel3Queue *tq; 195 struct CadetTunnel3Queue *tq;
196 196
197 /** 197 /**
198 * Message to send. 198 * Message to send.
@@ -204,17 +204,17 @@ struct MeshTunnelDelayed
204/** 204/**
205 * Handle for messages queued but not yet sent. 205 * Handle for messages queued but not yet sent.
206 */ 206 */
207struct MeshTunnel3Queue 207struct CadetTunnel3Queue
208{ 208{
209 /** 209 /**
210 * Connection queue handle, to cancel if necessary. 210 * Connection queue handle, to cancel if necessary.
211 */ 211 */
212 struct MeshConnectionQueue *cq; 212 struct CadetConnectionQueue *cq;
213 213
214 /** 214 /**
215 * Handle in case message hasn't been given to a connection yet. 215 * Handle in case message hasn't been given to a connection yet.
216 */ 216 */
217 struct MeshTunnelDelayed *tqd; 217 struct CadetTunnelDelayed *tqd;
218 218
219 /** 219 /**
220 * Continuation to call once sent. 220 * Continuation to call once sent.
@@ -278,7 +278,7 @@ static struct GNUNET_CRYPTO_EcdhePrivateKey *my_ephemeral_key;
278/** 278/**
279 * Cached message used to perform a key exchange. 279 * Cached message used to perform a key exchange.
280 */ 280 */
281static struct GNUNET_MESH_KX_Ephemeral kx_msg; 281static struct GNUNET_CADET_KX_Ephemeral kx_msg;
282 282
283/** 283/**
284 * Task to generate a new ephemeral key. 284 * Task to generate a new ephemeral key.
@@ -302,20 +302,20 @@ static struct GNUNET_TIME_Relative rekey_period;
302 * @return String representation. 302 * @return String representation.
303 */ 303 */
304static const char * 304static const char *
305cstate2s (enum MeshTunnel3CState cs) 305cstate2s (enum CadetTunnel3CState cs)
306{ 306{
307 static char buf[128]; 307 static char buf[128];
308 308
309 switch (cs) 309 switch (cs)
310 { 310 {
311 case MESH_TUNNEL3_NEW: 311 case CADET_TUNNEL3_NEW:
312 return "MESH_TUNNEL3_NEW"; 312 return "CADET_TUNNEL3_NEW";
313 case MESH_TUNNEL3_SEARCHING: 313 case CADET_TUNNEL3_SEARCHING:
314 return "MESH_TUNNEL3_SEARCHING"; 314 return "CADET_TUNNEL3_SEARCHING";
315 case MESH_TUNNEL3_WAITING: 315 case CADET_TUNNEL3_WAITING:
316 return "MESH_TUNNEL3_WAITING"; 316 return "CADET_TUNNEL3_WAITING";
317 case MESH_TUNNEL3_READY: 317 case CADET_TUNNEL3_READY:
318 return "MESH_TUNNEL3_READY"; 318 return "CADET_TUNNEL3_READY";
319 319
320 default: 320 default:
321 sprintf (buf, "%u (UNKNOWN STATE)", cs); 321 sprintf (buf, "%u (UNKNOWN STATE)", cs);
@@ -333,20 +333,20 @@ cstate2s (enum MeshTunnel3CState cs)
333 * @return String representation. 333 * @return String representation.
334 */ 334 */
335static const char * 335static const char *
336estate2s (enum MeshTunnel3EState es) 336estate2s (enum CadetTunnel3EState es)
337{ 337{
338 static char buf[128]; 338 static char buf[128];
339 339
340 switch (es) 340 switch (es)
341 { 341 {
342 case MESH_TUNNEL3_KEY_UNINITIALIZED: 342 case CADET_TUNNEL3_KEY_UNINITIALIZED:
343 return "MESH_TUNNEL3_KEY_UNINITIALIZED"; 343 return "CADET_TUNNEL3_KEY_UNINITIALIZED";
344 case MESH_TUNNEL3_KEY_SENT: 344 case CADET_TUNNEL3_KEY_SENT:
345 return "MESH_TUNNEL3_KEY_SENT"; 345 return "CADET_TUNNEL3_KEY_SENT";
346 case MESH_TUNNEL3_KEY_PING: 346 case CADET_TUNNEL3_KEY_PING:
347 return "MESH_TUNNEL3_KEY_PING"; 347 return "CADET_TUNNEL3_KEY_PING";
348 case MESH_TUNNEL3_KEY_OK: 348 case CADET_TUNNEL3_KEY_OK:
349 return "MESH_TUNNEL3_KEY_OK"; 349 return "CADET_TUNNEL3_KEY_OK";
350 350
351 default: 351 default:
352 sprintf (buf, "%u (UNKNOWN STATE)", es); 352 sprintf (buf, "%u (UNKNOWN STATE)", es);
@@ -366,12 +366,12 @@ estate2s (enum MeshTunnel3EState es)
366 * @return #GNUNET_YES if ready, #GNUNET_NO otherwise 366 * @return #GNUNET_YES if ready, #GNUNET_NO otherwise
367 */ 367 */
368static int 368static int
369is_ready (struct MeshTunnel3 *t) 369is_ready (struct CadetTunnel3 *t)
370{ 370{
371 int ready; 371 int ready;
372 372
373 GMT_debug (t); 373 GMT_debug (t);
374 ready = (MESH_TUNNEL3_READY == t->cstate && MESH_TUNNEL3_KEY_OK == t->estate); 374 ready = (CADET_TUNNEL3_READY == t->cstate && CADET_TUNNEL3_KEY_OK == t->estate);
375 ready = ready || GMT_is_loopback (t); 375 ready = ready || GMT_is_loopback (t);
376 return ready; 376 return ready;
377} 377}
@@ -413,7 +413,7 @@ ping_encryption_size (void)
413 * @return Amount of messages the channel can still buffer towards the client. 413 * @return Amount of messages the channel can still buffer towards the client.
414 */ 414 */
415static unsigned int 415static unsigned int
416get_channel_buffer (const struct MeshTChannel *tch) 416get_channel_buffer (const struct CadetTChannel *tch)
417{ 417{
418 int fwd; 418 int fwd;
419 419
@@ -432,7 +432,7 @@ get_channel_buffer (const struct MeshTChannel *tch)
432 * @return #GNUNET_YES if we allowed the client to send data to us. 432 * @return #GNUNET_YES if we allowed the client to send data to us.
433 */ 433 */
434static int 434static int
435get_channel_allowed (const struct MeshTChannel *tch) 435get_channel_allowed (const struct CadetTChannel *tch)
436{ 436{
437 int fwd; 437 int fwd;
438 438
@@ -451,7 +451,7 @@ get_channel_allowed (const struct MeshTChannel *tch)
451 * @return Amount of messages the connection can still buffer. 451 * @return Amount of messages the connection can still buffer.
452 */ 452 */
453static unsigned int 453static unsigned int
454get_connection_buffer (const struct MeshTConnection *tc) 454get_connection_buffer (const struct CadetTConnection *tc)
455{ 455{
456 int fwd; 456 int fwd;
457 457
@@ -470,7 +470,7 @@ get_connection_buffer (const struct MeshTConnection *tc)
470 * @return Amount of messages we have allowed the next peer to send us. 470 * @return Amount of messages we have allowed the next peer to send us.
471 */ 471 */
472static unsigned int 472static unsigned int
473get_connection_allowed (const struct MeshTConnection *tc) 473get_connection_allowed (const struct CadetTConnection *tc)
474{ 474{
475 int fwd; 475 int fwd;
476 476
@@ -490,11 +490,11 @@ get_connection_allowed (const struct MeshTConnection *tc)
490 * @return GNUNET_OK if message is fine, GNUNET_SYSERR otherwise. 490 * @return GNUNET_OK if message is fine, GNUNET_SYSERR otherwise.
491 */ 491 */
492int 492int
493check_ephemeral (struct MeshTunnel3 *t, 493check_ephemeral (struct CadetTunnel3 *t,
494 const struct GNUNET_MESH_KX_Ephemeral *msg) 494 const struct GNUNET_CADET_KX_Ephemeral *msg)
495{ 495{
496 /* Check message size */ 496 /* Check message size */
497 if (ntohs (msg->header.size) != sizeof (struct GNUNET_MESH_KX_Ephemeral)) 497 if (ntohs (msg->header.size) != sizeof (struct GNUNET_CADET_KX_Ephemeral))
498 return GNUNET_SYSERR; 498 return GNUNET_SYSERR;
499 499
500 /* Check signature size */ 500 /* Check signature size */
@@ -509,7 +509,7 @@ check_ephemeral (struct MeshTunnel3 *t,
509 509
510 /* Check signature */ 510 /* Check signature */
511 if (GNUNET_OK != 511 if (GNUNET_OK !=
512 GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_MESH_KX, 512 GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_CADET_KX,
513 &msg->purpose, 513 &msg->purpose,
514 &msg->signature, 514 &msg->signature,
515 &msg->origin_identity.public_key)) 515 &msg->origin_identity.public_key))
@@ -529,7 +529,7 @@ check_ephemeral (struct MeshTunnel3 *t,
529 * @param iv Initialization Vector to use. 529 * @param iv Initialization Vector to use.
530 */ 530 */
531static int 531static int
532t_encrypt (struct MeshTunnel3 *t, 532t_encrypt (struct CadetTunnel3 *t,
533 void *dst, const void *src, 533 void *dst, const void *src,
534 size_t size, uint32_t iv) 534 size_t size, uint32_t iv)
535{ 535{
@@ -556,7 +556,7 @@ t_encrypt (struct MeshTunnel3 *t,
556 * @param iv Initialization Vector to use. 556 * @param iv Initialization Vector to use.
557 */ 557 */
558static int 558static int
559t_decrypt (struct MeshTunnel3 *t, 559t_decrypt (struct CadetTunnel3 *t,
560 void *dst, const void *src, 560 void *dst, const void *src,
561 size_t size, uint32_t iv) 561 size_t size, uint32_t iv)
562{ 562{
@@ -565,7 +565,7 @@ t_decrypt (struct MeshTunnel3 *t,
565 size_t out_size; 565 size_t out_size;
566 566
567 LOG (GNUNET_ERROR_TYPE_DEBUG, " t_decrypt start\n"); 567 LOG (GNUNET_ERROR_TYPE_DEBUG, " t_decrypt start\n");
568 if (t->estate == MESH_TUNNEL3_KEY_OK || t->estate == MESH_TUNNEL3_KEY_PING) 568 if (t->estate == CADET_TUNNEL3_KEY_OK || t->estate == CADET_TUNNEL3_KEY_PING)
569 { 569 {
570 key = &t->d_key; 570 key = &t->d_key;
571 } 571 }
@@ -627,7 +627,7 @@ derive_symmertic (struct GNUNET_CRYPTO_SymmetricSessionKey *key,
627 const struct GNUNET_PeerIdentity *receiver, 627 const struct GNUNET_PeerIdentity *receiver,
628 const struct GNUNET_HashCode *key_material) 628 const struct GNUNET_HashCode *key_material)
629{ 629{
630 const char salt[] = "MESH kx salt"; 630 const char salt[] = "CADET kx salt";
631 631
632 GNUNET_CRYPTO_kdf (key, sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey), 632 GNUNET_CRYPTO_kdf (key, sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey),
633 salt, sizeof (salt), 633 salt, sizeof (salt),
@@ -644,11 +644,11 @@ derive_symmertic (struct GNUNET_CRYPTO_SymmetricSessionKey *key,
644 * 644 *
645 * @return The connection on which to send the next message. 645 * @return The connection on which to send the next message.
646 */ 646 */
647static struct MeshConnection * 647static struct CadetConnection *
648tunnel_get_connection (struct MeshTunnel3 *t) 648tunnel_get_connection (struct CadetTunnel3 *t)
649{ 649{
650 struct MeshTConnection *iter; 650 struct CadetTConnection *iter;
651 struct MeshConnection *best; 651 struct CadetConnection *best;
652 unsigned int qn; 652 unsigned int qn;
653 unsigned int lowest_q; 653 unsigned int lowest_q;
654 654
@@ -659,7 +659,7 @@ tunnel_get_connection (struct MeshTunnel3 *t)
659 { 659 {
660 LOG (GNUNET_ERROR_TYPE_DEBUG, " connection %s: %u\n", 660 LOG (GNUNET_ERROR_TYPE_DEBUG, " connection %s: %u\n",
661 GMC_2s (iter->c), GMC_get_state (iter->c)); 661 GMC_2s (iter->c), GMC_get_state (iter->c));
662 if (MESH_CONNECTION_READY == GMC_get_state (iter->c)) 662 if (CADET_CONNECTION_READY == GMC_get_state (iter->c))
663 { 663 {
664 qn = GMC_get_qn (iter->c, GMC_is_origin (iter->c, GNUNET_YES)); 664 qn = GMC_get_qn (iter->c, GMC_is_origin (iter->c, GNUNET_YES));
665 LOG (GNUNET_ERROR_TYPE_DEBUG, " q_n %u, \n", qn); 665 LOG (GNUNET_ERROR_TYPE_DEBUG, " q_n %u, \n", qn);
@@ -689,12 +689,12 @@ tunnel_get_connection (struct MeshTunnel3 *t)
689 */ 689 */
690static void 690static void
691tun_message_sent (void *cls, 691tun_message_sent (void *cls,
692 struct MeshConnection *c, 692 struct CadetConnection *c,
693 struct MeshConnectionQueue *q, 693 struct CadetConnectionQueue *q,
694 uint16_t type, int fwd, size_t size) 694 uint16_t type, int fwd, size_t size)
695{ 695{
696 struct MeshTunnel3Queue *qt = cls; 696 struct CadetTunnel3Queue *qt = cls;
697 struct MeshTunnel3 *t; 697 struct CadetTunnel3 *t;
698 698
699 LOG (GNUNET_ERROR_TYPE_DEBUG, "tun_message_sent\n"); 699 LOG (GNUNET_ERROR_TYPE_DEBUG, "tun_message_sent\n");
700 700
@@ -712,7 +712,7 @@ tun_message_sent (void *cls,
712 * @param tqd Delayed queue handle. 712 * @param tqd Delayed queue handle.
713 */ 713 */
714static void 714static void
715unqueue_data (struct MeshTunnelDelayed *tqd) 715unqueue_data (struct CadetTunnelDelayed *tqd)
716{ 716{
717 GNUNET_CONTAINER_DLL_remove (tqd->t->tq_head, tqd->t->tq_tail, tqd); 717 GNUNET_CONTAINER_DLL_remove (tqd->t->tq_head, tqd->t->tq_tail, tqd);
718 GNUNET_free (tqd); 718 GNUNET_free (tqd);
@@ -725,10 +725,10 @@ unqueue_data (struct MeshTunnelDelayed *tqd)
725 * @param t Tunnel to hold the message. 725 * @param t Tunnel to hold the message.
726 * @param msg Message itself (copy will be made). 726 * @param msg Message itself (copy will be made).
727 */ 727 */
728static struct MeshTunnelDelayed * 728static struct CadetTunnelDelayed *
729queue_data (struct MeshTunnel3 *t, const struct GNUNET_MessageHeader *msg) 729queue_data (struct CadetTunnel3 *t, const struct GNUNET_MessageHeader *msg)
730{ 730{
731 struct MeshTunnelDelayed *tqd; 731 struct CadetTunnelDelayed *tqd;
732 uint16_t size = ntohs (msg->size); 732 uint16_t size = ntohs (msg->size);
733 733
734 LOG (GNUNET_ERROR_TYPE_DEBUG, "queue data on Tunnel %s\n", GMT_2s (t)); 734 LOG (GNUNET_ERROR_TYPE_DEBUG, "queue data on Tunnel %s\n", GMT_2s (t));
@@ -739,7 +739,7 @@ queue_data (struct MeshTunnel3 *t, const struct GNUNET_MessageHeader *msg)
739 return NULL; 739 return NULL;
740 } 740 }
741 741
742 tqd = GNUNET_malloc (sizeof (struct MeshTunnelDelayed) + size); 742 tqd = GNUNET_malloc (sizeof (struct CadetTunnelDelayed) + size);
743 743
744 tqd->t = t; 744 tqd->t = t;
745 memcpy (&tqd[1], msg, size); 745 memcpy (&tqd[1], msg, size);
@@ -759,11 +759,11 @@ queue_data (struct MeshTunnel3 *t, const struct GNUNET_MessageHeader *msg)
759 * @param hmac Destination to store the HMAC. 759 * @param hmac Destination to store the HMAC.
760 */ 760 */
761static void 761static void
762t_hmac (struct MeshTunnel3 *t, const void *plaintext, size_t size, uint32_t iv, 762t_hmac (struct CadetTunnel3 *t, const void *plaintext, size_t size, uint32_t iv,
763 int outgoing, struct GNUNET_MESH_Hash *hmac) 763 int outgoing, struct GNUNET_CADET_Hash *hmac)
764{ 764{
765 struct GNUNET_CRYPTO_AuthKey auth_key; 765 struct GNUNET_CRYPTO_AuthKey auth_key;
766 static const char ctx[] = "mesh authentication key"; 766 static const char ctx[] = "cadet authentication key";
767 struct GNUNET_CRYPTO_SymmetricSessionKey *key; 767 struct GNUNET_CRYPTO_SymmetricSessionKey *key;
768 struct GNUNET_HashCode hash; 768 struct GNUNET_HashCode hash;
769 769
@@ -794,16 +794,16 @@ t_hmac (struct MeshTunnel3 *t, const void *plaintext, size_t size, uint32_t iv,
794 * 794 *
795 * @return Handle to cancel message. NULL if @c cont is NULL. 795 * @return Handle to cancel message. NULL if @c cont is NULL.
796 */ 796 */
797static struct MeshTunnel3Queue * 797static struct CadetTunnel3Queue *
798send_prebuilt_message (const struct GNUNET_MessageHeader *message, 798send_prebuilt_message (const struct GNUNET_MessageHeader *message,
799 struct MeshTunnel3 *t, struct MeshConnection *c, 799 struct CadetTunnel3 *t, struct CadetConnection *c,
800 int force, GMT_sent cont, void *cont_cls, 800 int force, GMT_sent cont, void *cont_cls,
801 struct MeshTunnel3Queue *existing_q) 801 struct CadetTunnel3Queue *existing_q)
802{ 802{
803 struct MeshTunnel3Queue *tq; 803 struct CadetTunnel3Queue *tq;
804 struct GNUNET_MESH_Encrypted *msg; 804 struct GNUNET_CADET_Encrypted *msg;
805 size_t size = ntohs (message->size); 805 size_t size = ntohs (message->size);
806 char cbuf[sizeof (struct GNUNET_MESH_Encrypted) + size]; 806 char cbuf[sizeof (struct GNUNET_CADET_Encrypted) + size];
807 uint32_t mid; 807 uint32_t mid;
808 uint32_t iv; 808 uint32_t iv;
809 uint16_t type; 809 uint16_t type;
@@ -813,7 +813,7 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message,
813 813
814 if (GNUNET_NO == is_ready (t)) 814 if (GNUNET_NO == is_ready (t))
815 { 815 {
816 struct MeshTunnelDelayed *tqd; 816 struct CadetTunnelDelayed *tqd;
817 /* A non null existing_q indicates sending of queued data. 817 /* A non null existing_q indicates sending of queued data.
818 * Should only happen after tunnel becomes ready. 818 * Should only happen after tunnel becomes ready.
819 */ 819 */
@@ -821,7 +821,7 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message,
821 tqd = queue_data (t, message); 821 tqd = queue_data (t, message);
822 if (NULL == cont) 822 if (NULL == cont)
823 return NULL; 823 return NULL;
824 tq = GNUNET_new (struct MeshTunnel3Queue); 824 tq = GNUNET_new (struct CadetTunnel3Queue);
825 tq->tqd = tqd; 825 tq->tqd = tqd;
826 tqd->tq = tq; 826 tqd->tq = tq;
827 tq->cont = cont; 827 tq->cont = cont;
@@ -832,19 +832,19 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message,
832 GNUNET_assert (GNUNET_NO == GMT_is_loopback (t)); 832 GNUNET_assert (GNUNET_NO == GMT_is_loopback (t));
833 833
834 iv = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX); 834 iv = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX);
835 msg = (struct GNUNET_MESH_Encrypted *) cbuf; 835 msg = (struct GNUNET_CADET_Encrypted *) cbuf;
836 msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED); 836 msg->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED);
837 msg->iv = iv; 837 msg->iv = iv;
838 GNUNET_assert (t_encrypt (t, &msg[1], message, size, iv) == size); 838 GNUNET_assert (t_encrypt (t, &msg[1], message, size, iv) == size);
839 t_hmac (t, &msg[1], size, iv, GNUNET_YES, &msg->hmac); 839 t_hmac (t, &msg[1], size, iv, GNUNET_YES, &msg->hmac);
840 msg->header.size = htons (sizeof (struct GNUNET_MESH_Encrypted) + size); 840 msg->header.size = htons (sizeof (struct GNUNET_CADET_Encrypted) + size);
841 841
842 if (NULL == c) 842 if (NULL == c)
843 c = tunnel_get_connection (t); 843 c = tunnel_get_connection (t);
844 if (NULL == c) 844 if (NULL == c)
845 { 845 {
846 if (GNUNET_SCHEDULER_NO_TASK != t->destroy_task 846 if (GNUNET_SCHEDULER_NO_TASK != t->destroy_task
847 || MESH_TUNNEL3_SEARCHING != t->cstate) 847 || CADET_TUNNEL3_SEARCHING != t->cstate)
848 { 848 {
849 GNUNET_break (0); 849 GNUNET_break (0);
850 GMT_debug (t); 850 GMT_debug (t);
@@ -856,18 +856,18 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message,
856 type = ntohs (message->type); 856 type = ntohs (message->type);
857 switch (type) 857 switch (type)
858 { 858 {
859 case GNUNET_MESSAGE_TYPE_MESH_DATA: 859 case GNUNET_MESSAGE_TYPE_CADET_DATA:
860 case GNUNET_MESSAGE_TYPE_MESH_DATA_ACK: 860 case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK:
861 if (GNUNET_MESSAGE_TYPE_MESH_DATA == type) 861 if (GNUNET_MESSAGE_TYPE_CADET_DATA == type)
862 mid = ntohl (((struct GNUNET_MESH_Data *) message)->mid); 862 mid = ntohl (((struct GNUNET_CADET_Data *) message)->mid);
863 else 863 else
864 mid = ntohl (((struct GNUNET_MESH_DataACK *) message)->mid); 864 mid = ntohl (((struct GNUNET_CADET_DataACK *) message)->mid);
865 /* Fall thru */ 865 /* Fall thru */
866 case GNUNET_MESSAGE_TYPE_MESH_KEEPALIVE: 866 case GNUNET_MESSAGE_TYPE_CADET_KEEPALIVE:
867 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE: 867 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE:
868 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY: 868 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY:
869 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK: 869 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK:
870 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_NACK: 870 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK:
871 msg->cid = *GMC_get_id (c); 871 msg->cid = *GMC_get_id (c);
872 msg->ttl = htonl (default_ttl); 872 msg->ttl = htonl (default_ttl);
873 break; 873 break;
@@ -887,7 +887,7 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message,
887 } 887 }
888 if (NULL == existing_q) 888 if (NULL == existing_q)
889 { 889 {
890 tq = GNUNET_new (struct MeshTunnel3Queue); /* FIXME valgrind: leak*/ 890 tq = GNUNET_new (struct CadetTunnel3Queue); /* FIXME valgrind: leak*/
891 } 891 }
892 else 892 else
893 { 893 {
@@ -909,10 +909,10 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message,
909 * @param t Tunnel that holds the messages. Cannot be loopback. 909 * @param t Tunnel that holds the messages. Cannot be loopback.
910 */ 910 */
911static void 911static void
912send_queued_data (struct MeshTunnel3 *t) 912send_queued_data (struct CadetTunnel3 *t)
913{ 913{
914 struct MeshTunnelDelayed *tqd; 914 struct CadetTunnelDelayed *tqd;
915 struct MeshTunnelDelayed *next; 915 struct CadetTunnelDelayed *next;
916 unsigned int room; 916 unsigned int room;
917 917
918 LOG (GNUNET_ERROR_TYPE_DEBUG, 918 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -959,13 +959,13 @@ send_queued_data (struct MeshTunnel3 *t)
959 * @param message Message to send. Function modifies it. 959 * @param message Message to send. Function modifies it.
960 */ 960 */
961static void 961static void
962send_kx (struct MeshTunnel3 *t, 962send_kx (struct CadetTunnel3 *t,
963 const struct GNUNET_MessageHeader *message) 963 const struct GNUNET_MessageHeader *message)
964{ 964{
965 struct MeshConnection *c; 965 struct CadetConnection *c;
966 struct GNUNET_MESH_KX *msg; 966 struct GNUNET_CADET_KX *msg;
967 size_t size = ntohs (message->size); 967 size_t size = ntohs (message->size);
968 char cbuf[sizeof (struct GNUNET_MESH_KX) + size]; 968 char cbuf[sizeof (struct GNUNET_CADET_KX) + size];
969 uint16_t type; 969 uint16_t type;
970 int fwd; 970 int fwd;
971 971
@@ -988,28 +988,28 @@ send_kx (struct MeshTunnel3 *t,
988 /* Must have a connection. */ 988 /* Must have a connection. */
989 if (NULL == t->connection_head) 989 if (NULL == t->connection_head)
990 { 990 {
991 GNUNET_break (MESH_TUNNEL3_SEARCHING == t->cstate); 991 GNUNET_break (CADET_TUNNEL3_SEARCHING == t->cstate);
992 GMT_debug (t); 992 GMT_debug (t);
993 return; 993 return;
994 } 994 }
995 995
996 msg = (struct GNUNET_MESH_KX *) cbuf; 996 msg = (struct GNUNET_CADET_KX *) cbuf;
997 msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_KX); 997 msg->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_KX);
998 msg->header.size = htons (sizeof (struct GNUNET_MESH_KX) + size); 998 msg->header.size = htons (sizeof (struct GNUNET_CADET_KX) + size);
999 c = tunnel_get_connection (t); 999 c = tunnel_get_connection (t);
1000 if (NULL == c) 1000 if (NULL == c)
1001 { 1001 {
1002 GNUNET_break (GNUNET_SCHEDULER_NO_TASK != t->destroy_task 1002 GNUNET_break (GNUNET_SCHEDULER_NO_TASK != t->destroy_task
1003 || MESH_TUNNEL3_READY != t->cstate); 1003 || CADET_TUNNEL3_READY != t->cstate);
1004 GMT_debug (t); 1004 GMT_debug (t);
1005 return; 1005 return;
1006 } 1006 }
1007 type = ntohs (message->type); 1007 type = ntohs (message->type);
1008 switch (type) 1008 switch (type)
1009 { 1009 {
1010 case GNUNET_MESSAGE_TYPE_MESH_KX_EPHEMERAL: 1010 case GNUNET_MESSAGE_TYPE_CADET_KX_EPHEMERAL:
1011 case GNUNET_MESSAGE_TYPE_MESH_KX_PING: 1011 case GNUNET_MESSAGE_TYPE_CADET_KX_PING:
1012 case GNUNET_MESSAGE_TYPE_MESH_KX_PONG: 1012 case GNUNET_MESSAGE_TYPE_CADET_KX_PONG:
1013 memcpy (&msg[1], message, size); 1013 memcpy (&msg[1], message, size);
1014 break; 1014 break;
1015 default: 1015 default:
@@ -1020,7 +1020,7 @@ send_kx (struct MeshTunnel3 *t,
1020 1020
1021 fwd = GMC_is_origin (t->connection_head->c, GNUNET_YES); 1021 fwd = GMC_is_origin (t->connection_head->c, GNUNET_YES);
1022 /* TODO save handle and cancel in case of a unneeded retransmission */ 1022 /* TODO save handle and cancel in case of a unneeded retransmission */
1023 GMC_send_prebuilt_message (&msg->header, GNUNET_MESSAGE_TYPE_MESH_KX, 1023 GMC_send_prebuilt_message (&msg->header, GNUNET_MESSAGE_TYPE_CADET_KX,
1024 message->type, c, fwd, GNUNET_YES, NULL, NULL); 1024 message->type, c, fwd, GNUNET_YES, NULL, NULL);
1025} 1025}
1026 1026
@@ -1031,7 +1031,7 @@ send_kx (struct MeshTunnel3 *t,
1031 * @param t Tunnel on which to send the key. 1031 * @param t Tunnel on which to send the key.
1032 */ 1032 */
1033static void 1033static void
1034send_ephemeral (struct MeshTunnel3 *t) 1034send_ephemeral (struct CadetTunnel3 *t)
1035{ 1035{
1036 LOG (GNUNET_ERROR_TYPE_INFO, "=> EPHM for %s\n", GMT_2s (t)); 1036 LOG (GNUNET_ERROR_TYPE_INFO, "=> EPHM for %s\n", GMT_2s (t));
1037 1037
@@ -1045,13 +1045,13 @@ send_ephemeral (struct MeshTunnel3 *t)
1045 * @param t Tunnel on which to send the ping. 1045 * @param t Tunnel on which to send the ping.
1046 */ 1046 */
1047static void 1047static void
1048send_ping (struct MeshTunnel3 *t) 1048send_ping (struct CadetTunnel3 *t)
1049{ 1049{
1050 struct GNUNET_MESH_KX_Ping msg; 1050 struct GNUNET_CADET_KX_Ping msg;
1051 1051
1052 LOG (GNUNET_ERROR_TYPE_INFO, "=> PING for %s\n", GMT_2s (t)); 1052 LOG (GNUNET_ERROR_TYPE_INFO, "=> PING for %s\n", GMT_2s (t));
1053 msg.header.size = htons (sizeof (msg)); 1053 msg.header.size = htons (sizeof (msg));
1054 msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_KX_PING); 1054 msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_KX_PING);
1055 msg.iv = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX); 1055 msg.iv = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX);
1056 msg.target = *GMP_get_id (t->peer); 1056 msg.target = *GMP_get_id (t->peer);
1057 msg.nonce = t->kx_ctx->challenge; 1057 msg.nonce = t->kx_ctx->challenge;
@@ -1073,13 +1073,13 @@ send_ping (struct MeshTunnel3 *t)
1073 * @param challenge Value sent in the ping that we have to send back. 1073 * @param challenge Value sent in the ping that we have to send back.
1074 */ 1074 */
1075static void 1075static void
1076send_pong (struct MeshTunnel3 *t, uint32_t challenge) 1076send_pong (struct CadetTunnel3 *t, uint32_t challenge)
1077{ 1077{
1078 struct GNUNET_MESH_KX_Pong msg; 1078 struct GNUNET_CADET_KX_Pong msg;
1079 1079
1080 LOG (GNUNET_ERROR_TYPE_INFO, "=> PONG for %s\n", GMT_2s (t)); 1080 LOG (GNUNET_ERROR_TYPE_INFO, "=> PONG for %s\n", GMT_2s (t));
1081 msg.header.size = htons (sizeof (msg)); 1081 msg.header.size = htons (sizeof (msg));
1082 msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_KX_PONG); 1082 msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_KX_PONG);
1083 msg.iv = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX); 1083 msg.iv = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX);
1084 msg.nonce = challenge; 1084 msg.nonce = challenge;
1085 LOG (GNUNET_ERROR_TYPE_DEBUG, " sending %u\n", msg.nonce); 1085 LOG (GNUNET_ERROR_TYPE_DEBUG, " sending %u\n", msg.nonce);
@@ -1099,7 +1099,7 @@ send_pong (struct MeshTunnel3 *t, uint32_t challenge)
1099static void 1099static void
1100rekey_tunnel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 1100rekey_tunnel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1101{ 1101{
1102 struct MeshTunnel3 *t = cls; 1102 struct CadetTunnel3 *t = cls;
1103 1103
1104 t->rekey_task = GNUNET_SCHEDULER_NO_TASK; 1104 t->rekey_task = GNUNET_SCHEDULER_NO_TASK;
1105 1105
@@ -1110,7 +1110,7 @@ rekey_tunnel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1110 if (NULL == t->kx_ctx) 1110 if (NULL == t->kx_ctx)
1111 { 1111 {
1112 LOG (GNUNET_ERROR_TYPE_DEBUG, " new kx ctx\n"); 1112 LOG (GNUNET_ERROR_TYPE_DEBUG, " new kx ctx\n");
1113 t->kx_ctx = GNUNET_new (struct MeshTunnelKXCtx); 1113 t->kx_ctx = GNUNET_new (struct CadetTunnelKXCtx);
1114 t->kx_ctx->challenge = 1114 t->kx_ctx->challenge =
1115 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX); 1115 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX);
1116 t->kx_ctx->d_key_old = t->d_key; 1116 t->kx_ctx->d_key_old = t->d_key;
@@ -1120,15 +1120,15 @@ rekey_tunnel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1120 send_ephemeral (t); 1120 send_ephemeral (t);
1121 switch (t->estate) 1121 switch (t->estate)
1122 { 1122 {
1123 case MESH_TUNNEL3_KEY_UNINITIALIZED: 1123 case CADET_TUNNEL3_KEY_UNINITIALIZED:
1124 t->estate = MESH_TUNNEL3_KEY_SENT; 1124 t->estate = CADET_TUNNEL3_KEY_SENT;
1125 break; 1125 break;
1126 case MESH_TUNNEL3_KEY_SENT: 1126 case CADET_TUNNEL3_KEY_SENT:
1127 break; 1127 break;
1128 case MESH_TUNNEL3_KEY_PING: 1128 case CADET_TUNNEL3_KEY_PING:
1129 case MESH_TUNNEL3_KEY_OK: 1129 case CADET_TUNNEL3_KEY_OK:
1130 send_ping (t); 1130 send_ping (t);
1131 t->estate = MESH_TUNNEL3_KEY_PING; 1131 t->estate = CADET_TUNNEL3_KEY_PING;
1132 break; 1132 break;
1133 default: 1133 default:
1134 LOG (GNUNET_ERROR_TYPE_DEBUG, "Unexpected state %u\n", t->estate); 1134 LOG (GNUNET_ERROR_TYPE_DEBUG, "Unexpected state %u\n", t->estate);
@@ -1154,7 +1154,7 @@ rekey_iterator (void *cls,
1154 const struct GNUNET_PeerIdentity *key, 1154 const struct GNUNET_PeerIdentity *key,
1155 void *value) 1155 void *value)
1156{ 1156{
1157 struct MeshTunnel3 *t = value; 1157 struct CadetTunnel3 *t = value;
1158 struct GNUNET_TIME_Relative delay; 1158 struct GNUNET_TIME_Relative delay;
1159 long n = (long) cls; 1159 long n = (long) cls;
1160 uint32_t r; 1160 uint32_t r;
@@ -1226,7 +1226,7 @@ destroy_iterator (void *cls,
1226 const struct GNUNET_PeerIdentity *key, 1226 const struct GNUNET_PeerIdentity *key,
1227 void *value) 1227 void *value)
1228{ 1228{
1229 struct MeshTunnel3 *t = value; 1229 struct CadetTunnel3 *t = value;
1230 1230
1231 LOG (GNUNET_ERROR_TYPE_DEBUG, "GMT_shutdown destroying tunnel at %p\n", t); 1231 LOG (GNUNET_ERROR_TYPE_DEBUG, "GMT_shutdown destroying tunnel at %p\n", t);
1232 GMT_destroy (t); 1232 GMT_destroy (t);
@@ -1242,11 +1242,11 @@ destroy_iterator (void *cls,
1242 * @param gid ID of the channel. 1242 * @param gid ID of the channel.
1243 */ 1243 */
1244static void 1244static void
1245send_channel_destroy (struct MeshTunnel3 *t, unsigned int gid) 1245send_channel_destroy (struct CadetTunnel3 *t, unsigned int gid)
1246{ 1246{
1247 struct GNUNET_MESH_ChannelManage msg; 1247 struct GNUNET_CADET_ChannelManage msg;
1248 1248
1249 msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY); 1249 msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY);
1250 msg.header.size = htons (sizeof (msg)); 1250 msg.header.size = htons (sizeof (msg));
1251 msg.chid = htonl (gid); 1251 msg.chid = htonl (gid);
1252 1252
@@ -1268,17 +1268,17 @@ send_channel_destroy (struct MeshTunnel3 *t, unsigned int gid)
1268 * #GNUNET_SYSERR if message on a one-ended channel (remote) 1268 * #GNUNET_SYSERR if message on a one-ended channel (remote)
1269 */ 1269 */
1270static void 1270static void
1271handle_data (struct MeshTunnel3 *t, 1271handle_data (struct CadetTunnel3 *t,
1272 const struct GNUNET_MESH_Data *msg, 1272 const struct GNUNET_CADET_Data *msg,
1273 int fwd) 1273 int fwd)
1274{ 1274{
1275 struct MeshChannel *ch; 1275 struct CadetChannel *ch;
1276 size_t size; 1276 size_t size;
1277 1277
1278 /* Check size */ 1278 /* Check size */
1279 size = ntohs (msg->header.size); 1279 size = ntohs (msg->header.size);
1280 if (size < 1280 if (size <
1281 sizeof (struct GNUNET_MESH_Data) + 1281 sizeof (struct GNUNET_CADET_Data) +
1282 sizeof (struct GNUNET_MessageHeader)) 1282 sizeof (struct GNUNET_MessageHeader))
1283 { 1283 {
1284 GNUNET_break (0); 1284 GNUNET_break (0);
@@ -1314,16 +1314,16 @@ handle_data (struct MeshTunnel3 *t,
1314 * #GNUNET_SYSERR if message on a one-ended channel (remote) 1314 * #GNUNET_SYSERR if message on a one-ended channel (remote)
1315 */ 1315 */
1316static void 1316static void
1317handle_data_ack (struct MeshTunnel3 *t, 1317handle_data_ack (struct CadetTunnel3 *t,
1318 const struct GNUNET_MESH_DataACK *msg, 1318 const struct GNUNET_CADET_DataACK *msg,
1319 int fwd) 1319 int fwd)
1320{ 1320{
1321 struct MeshChannel *ch; 1321 struct CadetChannel *ch;
1322 size_t size; 1322 size_t size;
1323 1323
1324 /* Check size */ 1324 /* Check size */
1325 size = ntohs (msg->header.size); 1325 size = ntohs (msg->header.size);
1326 if (size != sizeof (struct GNUNET_MESH_DataACK)) 1326 if (size != sizeof (struct GNUNET_CADET_DataACK))
1327 { 1327 {
1328 GNUNET_break (0); 1328 GNUNET_break (0);
1329 return; 1329 return;
@@ -1351,15 +1351,15 @@ handle_data_ack (struct MeshTunnel3 *t,
1351 * @param msg Data message. 1351 * @param msg Data message.
1352 */ 1352 */
1353static void 1353static void
1354handle_ch_create (struct MeshTunnel3 *t, 1354handle_ch_create (struct CadetTunnel3 *t,
1355 const struct GNUNET_MESH_ChannelCreate *msg) 1355 const struct GNUNET_CADET_ChannelCreate *msg)
1356{ 1356{
1357 struct MeshChannel *ch; 1357 struct CadetChannel *ch;
1358 size_t size; 1358 size_t size;
1359 1359
1360 /* Check size */ 1360 /* Check size */
1361 size = ntohs (msg->header.size); 1361 size = ntohs (msg->header.size);
1362 if (size != sizeof (struct GNUNET_MESH_ChannelCreate)) 1362 if (size != sizeof (struct GNUNET_CADET_ChannelCreate))
1363 { 1363 {
1364 GNUNET_break (0); 1364 GNUNET_break (0);
1365 return; 1365 return;
@@ -1386,15 +1386,15 @@ handle_ch_create (struct MeshTunnel3 *t,
1386 * @param msg NACK message. 1386 * @param msg NACK message.
1387 */ 1387 */
1388static void 1388static void
1389handle_ch_nack (struct MeshTunnel3 *t, 1389handle_ch_nack (struct CadetTunnel3 *t,
1390 const struct GNUNET_MESH_ChannelManage *msg) 1390 const struct GNUNET_CADET_ChannelManage *msg)
1391{ 1391{
1392 struct MeshChannel *ch; 1392 struct CadetChannel *ch;
1393 size_t size; 1393 size_t size;
1394 1394
1395 /* Check size */ 1395 /* Check size */
1396 size = ntohs (msg->header.size); 1396 size = ntohs (msg->header.size);
1397 if (size != sizeof (struct GNUNET_MESH_ChannelManage)) 1397 if (size != sizeof (struct GNUNET_CADET_ChannelManage))
1398 { 1398 {
1399 GNUNET_break (0); 1399 GNUNET_break (0);
1400 return; 1400 return;
@@ -1426,16 +1426,16 @@ handle_ch_nack (struct MeshTunnel3 *t,
1426 * #GNUNET_SYSERR if message on a one-ended channel (remote) 1426 * #GNUNET_SYSERR if message on a one-ended channel (remote)
1427 */ 1427 */
1428static void 1428static void
1429handle_ch_ack (struct MeshTunnel3 *t, 1429handle_ch_ack (struct CadetTunnel3 *t,
1430 const struct GNUNET_MESH_ChannelManage *msg, 1430 const struct GNUNET_CADET_ChannelManage *msg,
1431 int fwd) 1431 int fwd)
1432{ 1432{
1433 struct MeshChannel *ch; 1433 struct CadetChannel *ch;
1434 size_t size; 1434 size_t size;
1435 1435
1436 /* Check size */ 1436 /* Check size */
1437 size = ntohs (msg->header.size); 1437 size = ntohs (msg->header.size);
1438 if (size != sizeof (struct GNUNET_MESH_ChannelManage)) 1438 if (size != sizeof (struct GNUNET_CADET_ChannelManage))
1439 { 1439 {
1440 GNUNET_break (0); 1440 GNUNET_break (0);
1441 return; 1441 return;
@@ -1468,16 +1468,16 @@ handle_ch_ack (struct MeshTunnel3 *t,
1468 * #GNUNET_SYSERR if message on a one-ended channel (remote) 1468 * #GNUNET_SYSERR if message on a one-ended channel (remote)
1469 */ 1469 */
1470static void 1470static void
1471handle_ch_destroy (struct MeshTunnel3 *t, 1471handle_ch_destroy (struct CadetTunnel3 *t,
1472 const struct GNUNET_MESH_ChannelManage *msg, 1472 const struct GNUNET_CADET_ChannelManage *msg,
1473 int fwd) 1473 int fwd)
1474{ 1474{
1475 struct MeshChannel *ch; 1475 struct CadetChannel *ch;
1476 size_t size; 1476 size_t size;
1477 1477
1478 /* Check size */ 1478 /* Check size */
1479 size = ntohs (msg->header.size); 1479 size = ntohs (msg->header.size);
1480 if (size != sizeof (struct GNUNET_MESH_ChannelManage)) 1480 if (size != sizeof (struct GNUNET_CADET_ChannelManage))
1481 { 1481 {
1482 GNUNET_break (0); 1482 GNUNET_break (0);
1483 return; 1483 return;
@@ -1502,8 +1502,8 @@ handle_ch_destroy (struct MeshTunnel3 *t,
1502 * @param msg Key eXchange message. 1502 * @param msg Key eXchange message.
1503 */ 1503 */
1504static void 1504static void
1505handle_ephemeral (struct MeshTunnel3 *t, 1505handle_ephemeral (struct CadetTunnel3 *t,
1506 const struct GNUNET_MESH_KX_Ephemeral *msg) 1506 const struct GNUNET_CADET_KX_Ephemeral *msg)
1507{ 1507{
1508 struct GNUNET_HashCode km; 1508 struct GNUNET_HashCode km;
1509 LOG (GNUNET_ERROR_TYPE_INFO, "<=== EPHM for %s\n", GMT_2s (t)); 1509 LOG (GNUNET_ERROR_TYPE_INFO, "<=== EPHM for %s\n", GMT_2s (t));
@@ -1517,11 +1517,11 @@ handle_ephemeral (struct MeshTunnel3 *t,
1517 LOG (GNUNET_ERROR_TYPE_DEBUG, " km is %s\n", GNUNET_h2s (&km)); 1517 LOG (GNUNET_ERROR_TYPE_DEBUG, " km is %s\n", GNUNET_h2s (&km));
1518 derive_symmertic (&t->e_key, &my_full_id, GMP_get_id (t->peer), &km); 1518 derive_symmertic (&t->e_key, &my_full_id, GMP_get_id (t->peer), &km);
1519 derive_symmertic (&t->d_key, GMP_get_id (t->peer), &my_full_id, &km); 1519 derive_symmertic (&t->d_key, GMP_get_id (t->peer), &my_full_id, &km);
1520 if (MESH_TUNNEL3_KEY_SENT == t->estate) 1520 if (CADET_TUNNEL3_KEY_SENT == t->estate)
1521 { 1521 {
1522 LOG (GNUNET_ERROR_TYPE_DEBUG, " our key was sent, send ping\n"); 1522 LOG (GNUNET_ERROR_TYPE_DEBUG, " our key was sent, send ping\n");
1523 send_ping (t); 1523 send_ping (t);
1524 t->estate = MESH_TUNNEL3_KEY_PING; 1524 t->estate = CADET_TUNNEL3_KEY_PING;
1525 } 1525 }
1526} 1526}
1527 1527
@@ -1534,10 +1534,10 @@ handle_ephemeral (struct MeshTunnel3 *t,
1534 * @param msg Key eXchange Ping message. 1534 * @param msg Key eXchange Ping message.
1535 */ 1535 */
1536static void 1536static void
1537handle_ping (struct MeshTunnel3 *t, 1537handle_ping (struct CadetTunnel3 *t,
1538 const struct GNUNET_MESH_KX_Ping *msg) 1538 const struct GNUNET_CADET_KX_Ping *msg)
1539{ 1539{
1540 struct GNUNET_MESH_KX_Ping res; 1540 struct GNUNET_CADET_KX_Ping res;
1541 1541
1542 if (ntohs (msg->header.size) != sizeof (res)) 1542 if (ntohs (msg->header.size) != sizeof (res))
1543 { 1543 {
@@ -1572,8 +1572,8 @@ handle_ping (struct MeshTunnel3 *t,
1572 * @param msg Key eXchange Pong message. 1572 * @param msg Key eXchange Pong message.
1573 */ 1573 */
1574static void 1574static void
1575handle_pong (struct MeshTunnel3 *t, 1575handle_pong (struct CadetTunnel3 *t,
1576 const struct GNUNET_MESH_KX_Pong *msg) 1576 const struct GNUNET_CADET_KX_Pong *msg)
1577{ 1577{
1578 uint32_t challenge; 1578 uint32_t challenge;
1579 1579
@@ -1597,7 +1597,7 @@ handle_pong (struct MeshTunnel3 *t,
1597 t->rekey_task = GNUNET_SCHEDULER_NO_TASK; 1597 t->rekey_task = GNUNET_SCHEDULER_NO_TASK;
1598 GNUNET_free (t->kx_ctx); 1598 GNUNET_free (t->kx_ctx);
1599 t->kx_ctx = NULL; 1599 t->kx_ctx = NULL;
1600 GMT_change_estate (t, MESH_TUNNEL3_KEY_OK); 1600 GMT_change_estate (t, CADET_TUNNEL3_KEY_OK);
1601} 1601}
1602 1602
1603 1603
@@ -1613,7 +1613,7 @@ handle_pong (struct MeshTunnel3 *t,
1613 * #GNUNET_SYSERR if message on a one-ended channel (remote) 1613 * #GNUNET_SYSERR if message on a one-ended channel (remote)
1614 */ 1614 */
1615static void 1615static void
1616handle_decrypted (struct MeshTunnel3 *t, 1616handle_decrypted (struct CadetTunnel3 *t,
1617 const struct GNUNET_MessageHeader *msgh, 1617 const struct GNUNET_MessageHeader *msgh,
1618 int fwd) 1618 int fwd)
1619{ 1619{
@@ -1624,39 +1624,39 @@ handle_decrypted (struct MeshTunnel3 *t,
1624 1624
1625 switch (type) 1625 switch (type)
1626 { 1626 {
1627 case GNUNET_MESSAGE_TYPE_MESH_KEEPALIVE: 1627 case GNUNET_MESSAGE_TYPE_CADET_KEEPALIVE:
1628 /* Do nothing, connection aleady got updated. */ 1628 /* Do nothing, connection aleady got updated. */
1629 GNUNET_STATISTICS_update (stats, "# keepalives received", 1, GNUNET_NO); 1629 GNUNET_STATISTICS_update (stats, "# keepalives received", 1, GNUNET_NO);
1630 break; 1630 break;
1631 1631
1632 case GNUNET_MESSAGE_TYPE_MESH_DATA: 1632 case GNUNET_MESSAGE_TYPE_CADET_DATA:
1633 /* Don't send hop ACK, wait for client to ACK */ 1633 /* Don't send hop ACK, wait for client to ACK */
1634 handle_data (t, (struct GNUNET_MESH_Data *) msgh, fwd); 1634 handle_data (t, (struct GNUNET_CADET_Data *) msgh, fwd);
1635 break; 1635 break;
1636 1636
1637 case GNUNET_MESSAGE_TYPE_MESH_DATA_ACK: 1637 case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK:
1638 handle_data_ack (t, (struct GNUNET_MESH_DataACK *) msgh, fwd); 1638 handle_data_ack (t, (struct GNUNET_CADET_DataACK *) msgh, fwd);
1639 break; 1639 break;
1640 1640
1641 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE: 1641 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE:
1642 handle_ch_create (t, 1642 handle_ch_create (t,
1643 (struct GNUNET_MESH_ChannelCreate *) msgh); 1643 (struct GNUNET_CADET_ChannelCreate *) msgh);
1644 break; 1644 break;
1645 1645
1646 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_NACK: 1646 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK:
1647 handle_ch_nack (t, 1647 handle_ch_nack (t,
1648 (struct GNUNET_MESH_ChannelManage *) msgh); 1648 (struct GNUNET_CADET_ChannelManage *) msgh);
1649 break; 1649 break;
1650 1650
1651 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK: 1651 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK:
1652 handle_ch_ack (t, 1652 handle_ch_ack (t,
1653 (struct GNUNET_MESH_ChannelManage *) msgh, 1653 (struct GNUNET_CADET_ChannelManage *) msgh,
1654 fwd); 1654 fwd);
1655 break; 1655 break;
1656 1656
1657 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY: 1657 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY:
1658 handle_ch_destroy (t, 1658 handle_ch_destroy (t,
1659 (struct GNUNET_MESH_ChannelManage *) msgh, 1659 (struct GNUNET_CADET_ChannelManage *) msgh,
1660 fwd); 1660 fwd);
1661 break; 1661 break;
1662 1662
@@ -1681,16 +1681,16 @@ handle_decrypted (struct MeshTunnel3 *t,
1681 * @param msg Encrypted message. 1681 * @param msg Encrypted message.
1682 */ 1682 */
1683void 1683void
1684GMT_handle_encrypted (struct MeshTunnel3 *t, 1684GMT_handle_encrypted (struct CadetTunnel3 *t,
1685 const struct GNUNET_MESH_Encrypted *msg) 1685 const struct GNUNET_CADET_Encrypted *msg)
1686{ 1686{
1687 size_t size = ntohs (msg->header.size); 1687 size_t size = ntohs (msg->header.size);
1688 size_t payload_size = size - sizeof (struct GNUNET_MESH_Encrypted); 1688 size_t payload_size = size - sizeof (struct GNUNET_CADET_Encrypted);
1689 size_t decrypted_size; 1689 size_t decrypted_size;
1690 char cbuf [payload_size]; 1690 char cbuf [payload_size];
1691 struct GNUNET_MessageHeader *msgh; 1691 struct GNUNET_MessageHeader *msgh;
1692 unsigned int off; 1692 unsigned int off;
1693 struct GNUNET_MESH_Hash hmac; 1693 struct GNUNET_CADET_Hash hmac;
1694 1694
1695 decrypted_size = t_decrypt (t, cbuf, &msg[1], payload_size, msg->iv); 1695 decrypted_size = t_decrypt (t, cbuf, &msg[1], payload_size, msg->iv);
1696 t_hmac (t, &msg[1], payload_size, msg->iv, GNUNET_NO, &hmac); 1696 t_hmac (t, &msg[1], payload_size, msg->iv, GNUNET_NO, &hmac);
@@ -1720,7 +1720,7 @@ GMT_handle_encrypted (struct MeshTunnel3 *t,
1720 * @param message Payload of KX message. 1720 * @param message Payload of KX message.
1721 */ 1721 */
1722void 1722void
1723GMT_handle_kx (struct MeshTunnel3 *t, 1723GMT_handle_kx (struct CadetTunnel3 *t,
1724 const struct GNUNET_MessageHeader *message) 1724 const struct GNUNET_MessageHeader *message)
1725{ 1725{
1726 uint16_t type; 1726 uint16_t type;
@@ -1729,16 +1729,16 @@ GMT_handle_kx (struct MeshTunnel3 *t,
1729 LOG (GNUNET_ERROR_TYPE_DEBUG, "kx message received\n", type); 1729 LOG (GNUNET_ERROR_TYPE_DEBUG, "kx message received\n", type);
1730 switch (type) 1730 switch (type)
1731 { 1731 {
1732 case GNUNET_MESSAGE_TYPE_MESH_KX_EPHEMERAL: 1732 case GNUNET_MESSAGE_TYPE_CADET_KX_EPHEMERAL:
1733 handle_ephemeral (t, (struct GNUNET_MESH_KX_Ephemeral *) message); 1733 handle_ephemeral (t, (struct GNUNET_CADET_KX_Ephemeral *) message);
1734 break; 1734 break;
1735 1735
1736 case GNUNET_MESSAGE_TYPE_MESH_KX_PING: 1736 case GNUNET_MESSAGE_TYPE_CADET_KX_PING:
1737 handle_ping (t, (struct GNUNET_MESH_KX_Ping *) message); 1737 handle_ping (t, (struct GNUNET_CADET_KX_Ping *) message);
1738 break; 1738 break;
1739 1739
1740 case GNUNET_MESSAGE_TYPE_MESH_KX_PONG: 1740 case GNUNET_MESSAGE_TYPE_CADET_KX_PONG:
1741 handle_pong (t, (struct GNUNET_MESH_KX_Pong *) message); 1741 handle_pong (t, (struct GNUNET_CADET_KX_Pong *) message);
1742 break; 1742 break;
1743 1743
1744 default: 1744 default:
@@ -1760,15 +1760,15 @@ GMT_init (const struct GNUNET_CONFIGURATION_Handle *c,
1760{ 1760{
1761 LOG (GNUNET_ERROR_TYPE_DEBUG, "init\n"); 1761 LOG (GNUNET_ERROR_TYPE_DEBUG, "init\n");
1762 if (GNUNET_OK != 1762 if (GNUNET_OK !=
1763 GNUNET_CONFIGURATION_get_value_number (c, "MESH", "DEFAULT_TTL", 1763 GNUNET_CONFIGURATION_get_value_number (c, "CADET", "DEFAULT_TTL",
1764 &default_ttl)) 1764 &default_ttl))
1765 { 1765 {
1766 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING, 1766 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_WARNING,
1767 "MESH", "DEFAULT_TTL", "USING DEFAULT"); 1767 "CADET", "DEFAULT_TTL", "USING DEFAULT");
1768 default_ttl = 64; 1768 default_ttl = 64;
1769 } 1769 }
1770 if (GNUNET_OK != 1770 if (GNUNET_OK !=
1771 GNUNET_CONFIGURATION_get_value_time (c, "MESH", "REKEY_PERIOD", 1771 GNUNET_CONFIGURATION_get_value_time (c, "CADET", "REKEY_PERIOD",
1772 &rekey_period)) 1772 &rekey_period))
1773 { 1773 {
1774 rekey_period = GNUNET_TIME_UNIT_DAYS; 1774 rekey_period = GNUNET_TIME_UNIT_DAYS;
@@ -1776,8 +1776,8 @@ GMT_init (const struct GNUNET_CONFIGURATION_Handle *c,
1776 1776
1777 my_private_key = key; 1777 my_private_key = key;
1778 kx_msg.header.size = htons (sizeof (kx_msg)); 1778 kx_msg.header.size = htons (sizeof (kx_msg));
1779 kx_msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_KX_EPHEMERAL); 1779 kx_msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_KX_EPHEMERAL);
1780 kx_msg.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_MESH_KX); 1780 kx_msg.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CADET_KX);
1781 kx_msg.purpose.size = htonl (ephemeral_purpose_size ()); 1781 kx_msg.purpose.size = htonl (ephemeral_purpose_size ());
1782 kx_msg.origin_identity = my_full_id; 1782 kx_msg.origin_identity = my_full_id;
1783 rekey_task = GNUNET_SCHEDULER_add_now (&rekey, NULL); 1783 rekey_task = GNUNET_SCHEDULER_add_now (&rekey, NULL);
@@ -1807,12 +1807,12 @@ GMT_shutdown (void)
1807 * 1807 *
1808 * @param destination Peer this tunnel is towards. 1808 * @param destination Peer this tunnel is towards.
1809 */ 1809 */
1810struct MeshTunnel3 * 1810struct CadetTunnel3 *
1811GMT_new (struct MeshPeer *destination) 1811GMT_new (struct CadetPeer *destination)
1812{ 1812{
1813 struct MeshTunnel3 *t; 1813 struct CadetTunnel3 *t;
1814 1814
1815 t = GNUNET_new (struct MeshTunnel3); 1815 t = GNUNET_new (struct CadetTunnel3);
1816 t->next_chid = 0; 1816 t->next_chid = 0;
1817 t->peer = destination; 1817 t->peer = destination;
1818 1818
@@ -1835,23 +1835,23 @@ GMT_new (struct MeshPeer *destination)
1835 * @param cstate New connection state. 1835 * @param cstate New connection state.
1836 */ 1836 */
1837void 1837void
1838GMT_change_cstate (struct MeshTunnel3* t, enum MeshTunnel3CState cstate) 1838GMT_change_cstate (struct CadetTunnel3* t, enum CadetTunnel3CState cstate)
1839{ 1839{
1840 if (NULL == t) 1840 if (NULL == t)
1841 return; 1841 return;
1842 LOG (GNUNET_ERROR_TYPE_DEBUG, "Tunnel %s cstate %s => %s\n", 1842 LOG (GNUNET_ERROR_TYPE_DEBUG, "Tunnel %s cstate %s => %s\n",
1843 GMP_2s (t->peer), cstate2s (t->cstate), cstate2s (cstate)); 1843 GMP_2s (t->peer), cstate2s (t->cstate), cstate2s (cstate));
1844 if (myid != GMP_get_short_id (t->peer) && 1844 if (myid != GMP_get_short_id (t->peer) &&
1845 MESH_TUNNEL3_READY != t->cstate && 1845 CADET_TUNNEL3_READY != t->cstate &&
1846 MESH_TUNNEL3_READY == cstate) 1846 CADET_TUNNEL3_READY == cstate)
1847 { 1847 {
1848 t->cstate = cstate; 1848 t->cstate = cstate;
1849 if (MESH_TUNNEL3_KEY_OK == t->estate) 1849 if (CADET_TUNNEL3_KEY_OK == t->estate)
1850 { 1850 {
1851 LOG (GNUNET_ERROR_TYPE_DEBUG, " cstate triggered send queued data\n"); 1851 LOG (GNUNET_ERROR_TYPE_DEBUG, " cstate triggered send queued data\n");
1852 send_queued_data (t); 1852 send_queued_data (t);
1853 } 1853 }
1854 else if (MESH_TUNNEL3_KEY_UNINITIALIZED == t->estate) 1854 else if (CADET_TUNNEL3_KEY_UNINITIALIZED == t->estate)
1855 { 1855 {
1856 LOG (GNUNET_ERROR_TYPE_DEBUG, " cstate triggered rekey\n"); 1856 LOG (GNUNET_ERROR_TYPE_DEBUG, " cstate triggered rekey\n");
1857 rekey_tunnel (t, NULL); 1857 rekey_tunnel (t, NULL);
@@ -1859,7 +1859,7 @@ GMT_change_cstate (struct MeshTunnel3* t, enum MeshTunnel3CState cstate)
1859 } 1859 }
1860 t->cstate = cstate; 1860 t->cstate = cstate;
1861 1861
1862 if (MESH_TUNNEL3_READY == cstate 1862 if (CADET_TUNNEL3_READY == cstate
1863 && CONNECTIONS_PER_TUNNEL <= GMT_count_connections (t)) 1863 && CONNECTIONS_PER_TUNNEL <= GMT_count_connections (t))
1864 { 1864 {
1865 LOG (GNUNET_ERROR_TYPE_DEBUG, " cstate triggered stop dht\n"); 1865 LOG (GNUNET_ERROR_TYPE_DEBUG, " cstate triggered stop dht\n");
@@ -1874,7 +1874,7 @@ GMT_change_cstate (struct MeshTunnel3* t, enum MeshTunnel3CState cstate)
1874 * @param state New encryption state. 1874 * @param state New encryption state.
1875 */ 1875 */
1876void 1876void
1877GMT_change_estate (struct MeshTunnel3* t, enum MeshTunnel3EState state) 1877GMT_change_estate (struct CadetTunnel3* t, enum CadetTunnel3EState state)
1878{ 1878{
1879 if (NULL == t) 1879 if (NULL == t)
1880 return; 1880 return;
@@ -1885,7 +1885,7 @@ GMT_change_estate (struct MeshTunnel3* t, enum MeshTunnel3EState state)
1885 "Tunnel %s estate is now %s\n", 1885 "Tunnel %s estate is now %s\n",
1886 GMP_2s (t->peer), estate2s (state)); 1886 GMP_2s (t->peer), estate2s (state));
1887 if (myid != GMP_get_short_id (t->peer) && 1887 if (myid != GMP_get_short_id (t->peer) &&
1888 MESH_TUNNEL3_KEY_OK != t->estate && MESH_TUNNEL3_KEY_OK == state) 1888 CADET_TUNNEL3_KEY_OK != t->estate && CADET_TUNNEL3_KEY_OK == state)
1889 { 1889 {
1890 t->estate = state; 1890 t->estate = state;
1891 send_queued_data (t); 1891 send_queued_data (t);
@@ -1908,15 +1908,15 @@ GMT_change_estate (struct MeshTunnel3* t, enum MeshTunnel3EState state)
1908static void 1908static void
1909trim_connections (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 1909trim_connections (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1910{ 1910{
1911 struct MeshTunnel3 *t = cls; 1911 struct CadetTunnel3 *t = cls;
1912 1912
1913 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 1913 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
1914 return; 1914 return;
1915 1915
1916 if (GMT_count_connections (t) > 2 * CONNECTIONS_PER_TUNNEL) 1916 if (GMT_count_connections (t) > 2 * CONNECTIONS_PER_TUNNEL)
1917 { 1917 {
1918 struct MeshTConnection *iter; 1918 struct CadetTConnection *iter;
1919 struct MeshTConnection *c; 1919 struct CadetTConnection *c;
1920 1920
1921 for (c = iter = t->connection_head; NULL != iter; iter = iter->next) 1921 for (c = iter = t->connection_head; NULL != iter; iter = iter->next)
1922 { 1922 {
@@ -1949,9 +1949,9 @@ trim_connections (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1949 * @param c Connection. 1949 * @param c Connection.
1950 */ 1950 */
1951void 1951void
1952GMT_add_connection (struct MeshTunnel3 *t, struct MeshConnection *c) 1952GMT_add_connection (struct CadetTunnel3 *t, struct CadetConnection *c)
1953{ 1953{
1954 struct MeshTConnection *aux; 1954 struct CadetTConnection *aux;
1955 1955
1956 GNUNET_assert (NULL != c); 1956 GNUNET_assert (NULL != c);
1957 1957
@@ -1961,7 +1961,7 @@ GMT_add_connection (struct MeshTunnel3 *t, struct MeshConnection *c)
1961 if (aux->c == c) 1961 if (aux->c == c)
1962 return; 1962 return;
1963 1963
1964 aux = GNUNET_new (struct MeshTConnection); 1964 aux = GNUNET_new (struct CadetTConnection);
1965 aux->c = c; 1965 aux->c = c;
1966 aux->created = GNUNET_TIME_absolute_get (); 1966 aux->created = GNUNET_TIME_absolute_get ();
1967 1967
@@ -1978,7 +1978,7 @@ GMT_add_connection (struct MeshTunnel3 *t, struct MeshConnection *c)
1978 * @param path Invalid path to remove. Is destroyed after removal. 1978 * @param path Invalid path to remove. Is destroyed after removal.
1979 */ 1979 */
1980void 1980void
1981GMT_remove_path (struct MeshTunnel3 *t, struct MeshPeerPath *path) 1981GMT_remove_path (struct CadetTunnel3 *t, struct CadetPeerPath *path)
1982{ 1982{
1983 GMP_remove_path (t->peer, path); 1983 GMP_remove_path (t->peer, path);
1984} 1984}
@@ -1991,11 +1991,11 @@ GMT_remove_path (struct MeshTunnel3 *t, struct MeshPeerPath *path)
1991 * @param c Connection. 1991 * @param c Connection.
1992 */ 1992 */
1993void 1993void
1994GMT_remove_connection (struct MeshTunnel3 *t, 1994GMT_remove_connection (struct CadetTunnel3 *t,
1995 struct MeshConnection *c) 1995 struct CadetConnection *c)
1996{ 1996{
1997 struct MeshTConnection *aux; 1997 struct CadetTConnection *aux;
1998 struct MeshTConnection *next; 1998 struct CadetTConnection *next;
1999 1999
2000 LOG (GNUNET_ERROR_TYPE_DEBUG, "Removing connection %s from tunnel %s\n", 2000 LOG (GNUNET_ERROR_TYPE_DEBUG, "Removing connection %s from tunnel %s\n",
2001 GMC_2s (c), GMT_2s (t)); 2001 GMC_2s (c), GMT_2s (t));
@@ -2012,25 +2012,25 @@ GMT_remove_connection (struct MeshTunnel3 *t,
2012 /* Start new connections if needed */ 2012 /* Start new connections if needed */
2013 if (CONNECTIONS_PER_TUNNEL < GMT_count_connections (t) 2013 if (CONNECTIONS_PER_TUNNEL < GMT_count_connections (t)
2014 && GNUNET_SCHEDULER_NO_TASK == t->destroy_task 2014 && GNUNET_SCHEDULER_NO_TASK == t->destroy_task
2015 && MESH_TUNNEL3_SHUTDOWN != t->cstate 2015 && CADET_TUNNEL3_SHUTDOWN != t->cstate
2016 && GNUNET_NO == shutting_down) 2016 && GNUNET_NO == shutting_down)
2017 { 2017 {
2018 LOG (GNUNET_ERROR_TYPE_DEBUG, " no more connections, getting new ones\n"); 2018 LOG (GNUNET_ERROR_TYPE_DEBUG, " no more connections, getting new ones\n");
2019 t->cstate = MESH_TUNNEL3_SEARCHING; 2019 t->cstate = CADET_TUNNEL3_SEARCHING;
2020 GMP_connect (t->peer); 2020 GMP_connect (t->peer);
2021 return; 2021 return;
2022 } 2022 }
2023 2023
2024 /* If not marked as ready, no change is needed */ 2024 /* If not marked as ready, no change is needed */
2025 if (MESH_TUNNEL3_READY != t->cstate) 2025 if (CADET_TUNNEL3_READY != t->cstate)
2026 return; 2026 return;
2027 2027
2028 /* Check if any connection is ready to maintaing cstate */ 2028 /* Check if any connection is ready to maintaing cstate */
2029 for (aux = t->connection_head; aux != NULL; aux = aux->next) 2029 for (aux = t->connection_head; aux != NULL; aux = aux->next)
2030 if (MESH_CONNECTION_READY == GMC_get_state (aux->c)) 2030 if (CADET_CONNECTION_READY == GMC_get_state (aux->c))
2031 return; 2031 return;
2032 2032
2033 t->cstate = MESH_TUNNEL3_WAITING; 2033 t->cstate = CADET_TUNNEL3_WAITING;
2034} 2034}
2035 2035
2036 2036
@@ -2041,9 +2041,9 @@ GMT_remove_connection (struct MeshTunnel3 *t,
2041 * @param ch Channel. 2041 * @param ch Channel.
2042 */ 2042 */
2043void 2043void
2044GMT_add_channel (struct MeshTunnel3 *t, struct MeshChannel *ch) 2044GMT_add_channel (struct CadetTunnel3 *t, struct CadetChannel *ch)
2045{ 2045{
2046 struct MeshTChannel *aux; 2046 struct CadetTChannel *aux;
2047 2047
2048 GNUNET_assert (NULL != ch); 2048 GNUNET_assert (NULL != ch);
2049 2049
@@ -2056,7 +2056,7 @@ GMT_add_channel (struct MeshTunnel3 *t, struct MeshChannel *ch)
2056 return; 2056 return;
2057 } 2057 }
2058 2058
2059 aux = GNUNET_new (struct MeshTChannel); 2059 aux = GNUNET_new (struct CadetTChannel);
2060 aux->ch = ch; 2060 aux->ch = ch;
2061 LOG (GNUNET_ERROR_TYPE_DEBUG, " adding %p to %p\n", aux, t->channel_head); 2061 LOG (GNUNET_ERROR_TYPE_DEBUG, " adding %p to %p\n", aux, t->channel_head);
2062 GNUNET_CONTAINER_DLL_insert_tail (t->channel_head, t->channel_tail, aux); 2062 GNUNET_CONTAINER_DLL_insert_tail (t->channel_head, t->channel_tail, aux);
@@ -2077,9 +2077,9 @@ GMT_add_channel (struct MeshTunnel3 *t, struct MeshChannel *ch)
2077 * @param ch Channel. 2077 * @param ch Channel.
2078 */ 2078 */
2079void 2079void
2080GMT_remove_channel (struct MeshTunnel3 *t, struct MeshChannel *ch) 2080GMT_remove_channel (struct CadetTunnel3 *t, struct CadetChannel *ch)
2081{ 2081{
2082 struct MeshTChannel *aux; 2082 struct CadetTChannel *aux;
2083 2083
2084 LOG (GNUNET_ERROR_TYPE_DEBUG, "Removing channel %p from tunnel %p\n", ch, t); 2084 LOG (GNUNET_ERROR_TYPE_DEBUG, "Removing channel %p from tunnel %p\n", ch, t);
2085 for (aux = t->channel_head; aux != NULL; aux = aux->next) 2085 for (aux = t->channel_head; aux != NULL; aux = aux->next)
@@ -2103,10 +2103,10 @@ GMT_remove_channel (struct MeshTunnel3 *t, struct MeshChannel *ch)
2103 * 2103 *
2104 * @return channel handler, NULL if doesn't exist 2104 * @return channel handler, NULL if doesn't exist
2105 */ 2105 */
2106struct MeshChannel * 2106struct CadetChannel *
2107GMT_get_channel (struct MeshTunnel3 *t, MESH_ChannelNumber chid) 2107GMT_get_channel (struct CadetTunnel3 *t, CADET_ChannelNumber chid)
2108{ 2108{
2109 struct MeshTChannel *iter; 2109 struct CadetTChannel *iter;
2110 2110
2111 if (NULL == t) 2111 if (NULL == t)
2112 return NULL; 2112 return NULL;
@@ -2134,8 +2134,8 @@ GMT_get_channel (struct MeshTunnel3 *t, MESH_ChannelNumber chid)
2134static void 2134static void
2135delayed_destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 2135delayed_destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2136{ 2136{
2137 struct MeshTunnel3 *t = cls; 2137 struct CadetTunnel3 *t = cls;
2138 struct MeshTConnection *iter; 2138 struct CadetTConnection *iter;
2139 2139
2140 LOG (GNUNET_ERROR_TYPE_DEBUG, "delayed destroying tunnel %p\n", t); 2140 LOG (GNUNET_ERROR_TYPE_DEBUG, "delayed destroying tunnel %p\n", t);
2141 if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) 2141 if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
@@ -2146,7 +2146,7 @@ delayed_destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2146 return; 2146 return;
2147 } 2147 }
2148 t->destroy_task = GNUNET_SCHEDULER_NO_TASK; 2148 t->destroy_task = GNUNET_SCHEDULER_NO_TASK;
2149 t->cstate = MESH_TUNNEL3_SHUTDOWN; 2149 t->cstate = CADET_TUNNEL3_SHUTDOWN;
2150 2150
2151 for (iter = t->connection_head; NULL != iter; iter = iter->next) 2151 for (iter = t->connection_head; NULL != iter; iter = iter->next)
2152 { 2152 {
@@ -2164,7 +2164,7 @@ delayed_destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2164 * @param t Tunnel to destroy. 2164 * @param t Tunnel to destroy.
2165 */ 2165 */
2166void 2166void
2167GMT_destroy_empty (struct MeshTunnel3 *t) 2167GMT_destroy_empty (struct CadetTunnel3 *t)
2168{ 2168{
2169 if (GNUNET_YES == shutting_down) 2169 if (GNUNET_YES == shutting_down)
2170 return; /* Will be destroyed immediately anyway */ 2170 return; /* Will be destroyed immediately anyway */
@@ -2198,7 +2198,7 @@ GMT_destroy_empty (struct MeshTunnel3 *t)
2198 * @param t Tunnel to destroy if empty. 2198 * @param t Tunnel to destroy if empty.
2199 */ 2199 */
2200void 2200void
2201GMT_destroy_if_empty (struct MeshTunnel3 *t) 2201GMT_destroy_if_empty (struct CadetTunnel3 *t)
2202{ 2202{
2203 LOG (GNUNET_ERROR_TYPE_DEBUG, "Tunnel %s destroy if empty\n", GMT_2s (t)); 2203 LOG (GNUNET_ERROR_TYPE_DEBUG, "Tunnel %s destroy if empty\n", GMT_2s (t));
2204 if (1 < GMT_count_channels (t)) 2204 if (1 < GMT_count_channels (t))
@@ -2220,12 +2220,12 @@ GMT_destroy_if_empty (struct MeshTunnel3 *t)
2220 * @param t The tunnel to destroy. 2220 * @param t The tunnel to destroy.
2221 */ 2221 */
2222void 2222void
2223GMT_destroy (struct MeshTunnel3 *t) 2223GMT_destroy (struct CadetTunnel3 *t)
2224{ 2224{
2225 struct MeshTConnection *iter_c; 2225 struct CadetTConnection *iter_c;
2226 struct MeshTConnection *next_c; 2226 struct CadetTConnection *next_c;
2227 struct MeshTChannel *iter_ch; 2227 struct CadetTChannel *iter_ch;
2228 struct MeshTChannel *next_ch; 2228 struct CadetTChannel *next_ch;
2229 2229
2230 if (NULL == t) 2230 if (NULL == t)
2231 return; 2231 return;
@@ -2282,11 +2282,11 @@ GMT_destroy (struct MeshTunnel3 *t)
2282 * 2282 *
2283 * @return Connection created. 2283 * @return Connection created.
2284 */ 2284 */
2285struct MeshConnection * 2285struct CadetConnection *
2286GMT_use_path (struct MeshTunnel3 *t, struct MeshPeerPath *p) 2286GMT_use_path (struct CadetTunnel3 *t, struct CadetPeerPath *p)
2287{ 2287{
2288 struct MeshConnection *c; 2288 struct CadetConnection *c;
2289 struct GNUNET_MESH_Hash cid; 2289 struct GNUNET_CADET_Hash cid;
2290 unsigned int own_pos; 2290 unsigned int own_pos;
2291 2291
2292 if (NULL == t || NULL == p) 2292 if (NULL == t || NULL == p)
@@ -2295,7 +2295,7 @@ GMT_use_path (struct MeshTunnel3 *t, struct MeshPeerPath *p)
2295 return NULL; 2295 return NULL;
2296 } 2296 }
2297 2297
2298 if (MESH_TUNNEL3_SHUTDOWN == t->cstate) 2298 if (CADET_TUNNEL3_SHUTDOWN == t->cstate)
2299 { 2299 {
2300 GNUNET_break (0); 2300 GNUNET_break (0);
2301 return NULL; 2301 return NULL;
@@ -2332,16 +2332,16 @@ GMT_use_path (struct MeshTunnel3 *t, struct MeshPeerPath *p)
2332 * @return Number of connections. 2332 * @return Number of connections.
2333 */ 2333 */
2334unsigned int 2334unsigned int
2335GMT_count_connections (struct MeshTunnel3 *t) 2335GMT_count_connections (struct CadetTunnel3 *t)
2336{ 2336{
2337 struct MeshTConnection *iter; 2337 struct CadetTConnection *iter;
2338 unsigned int count; 2338 unsigned int count;
2339 2339
2340 if (NULL == t) 2340 if (NULL == t)
2341 return 0; 2341 return 0;
2342 2342
2343 for (count = 0, iter = t->connection_head; NULL != iter; iter = iter->next) 2343 for (count = 0, iter = t->connection_head; NULL != iter; iter = iter->next)
2344 if (MESH_CONNECTION_DESTROYED != GMC_get_state (iter->c)) 2344 if (CADET_CONNECTION_DESTROYED != GMC_get_state (iter->c))
2345 count++; 2345 count++;
2346 2346
2347 return count; 2347 return count;
@@ -2355,9 +2355,9 @@ GMT_count_connections (struct MeshTunnel3 *t)
2355 * @return Number of channels. 2355 * @return Number of channels.
2356 */ 2356 */
2357unsigned int 2357unsigned int
2358GMT_count_channels (struct MeshTunnel3 *t) 2358GMT_count_channels (struct CadetTunnel3 *t)
2359{ 2359{
2360 struct MeshTChannel *iter; 2360 struct CadetTChannel *iter;
2361 unsigned int count; 2361 unsigned int count;
2362 2362
2363 for (count = 0, iter = t->channel_head; 2363 for (count = 0, iter = t->channel_head;
@@ -2375,13 +2375,13 @@ GMT_count_channels (struct MeshTunnel3 *t)
2375 * 2375 *
2376 * @return Tunnel's connectivity state. 2376 * @return Tunnel's connectivity state.
2377 */ 2377 */
2378enum MeshTunnel3CState 2378enum CadetTunnel3CState
2379GMT_get_cstate (struct MeshTunnel3 *t) 2379GMT_get_cstate (struct CadetTunnel3 *t)
2380{ 2380{
2381 if (NULL == t) 2381 if (NULL == t)
2382 { 2382 {
2383 GNUNET_assert (0); 2383 GNUNET_assert (0);
2384 return (enum MeshTunnel3CState) -1; 2384 return (enum CadetTunnel3CState) -1;
2385 } 2385 }
2386 return t->cstate; 2386 return t->cstate;
2387} 2387}
@@ -2394,13 +2394,13 @@ GMT_get_cstate (struct MeshTunnel3 *t)
2394 * 2394 *
2395 * @return Tunnel's encryption state. 2395 * @return Tunnel's encryption state.
2396 */ 2396 */
2397enum MeshTunnel3EState 2397enum CadetTunnel3EState
2398GMT_get_estate (struct MeshTunnel3 *t) 2398GMT_get_estate (struct CadetTunnel3 *t)
2399{ 2399{
2400 if (NULL == t) 2400 if (NULL == t)
2401 { 2401 {
2402 GNUNET_assert (0); 2402 GNUNET_assert (0);
2403 return (enum MeshTunnel3EState) -1; 2403 return (enum CadetTunnel3EState) -1;
2404 } 2404 }
2405 return t->estate; 2405 return t->estate;
2406} 2406}
@@ -2413,9 +2413,9 @@ GMT_get_estate (struct MeshTunnel3 *t)
2413 * @return Biggest buffer space offered by any channel in the tunnel. 2413 * @return Biggest buffer space offered by any channel in the tunnel.
2414 */ 2414 */
2415unsigned int 2415unsigned int
2416GMT_get_channels_buffer (struct MeshTunnel3 *t) 2416GMT_get_channels_buffer (struct CadetTunnel3 *t)
2417{ 2417{
2418 struct MeshTChannel *iter; 2418 struct CadetTChannel *iter;
2419 unsigned int buffer; 2419 unsigned int buffer;
2420 unsigned int ch_buf; 2420 unsigned int ch_buf;
2421 2421
@@ -2444,15 +2444,15 @@ GMT_get_channels_buffer (struct MeshTunnel3 *t)
2444 * @return Buffer space offered by all connections in the tunnel. 2444 * @return Buffer space offered by all connections in the tunnel.
2445 */ 2445 */
2446unsigned int 2446unsigned int
2447GMT_get_connections_buffer (struct MeshTunnel3 *t) 2447GMT_get_connections_buffer (struct CadetTunnel3 *t)
2448{ 2448{
2449 struct MeshTConnection *iter; 2449 struct CadetTConnection *iter;
2450 unsigned int buffer; 2450 unsigned int buffer;
2451 2451
2452 buffer = 0; 2452 buffer = 0;
2453 for (iter = t->connection_head; NULL != iter; iter = iter->next) 2453 for (iter = t->connection_head; NULL != iter; iter = iter->next)
2454 { 2454 {
2455 if (GMC_get_state (iter->c) != MESH_CONNECTION_READY) 2455 if (GMC_get_state (iter->c) != CADET_CONNECTION_READY)
2456 { 2456 {
2457 continue; 2457 continue;
2458 } 2458 }
@@ -2471,7 +2471,7 @@ GMT_get_connections_buffer (struct MeshTunnel3 *t)
2471 * @return ID of the destination peer. 2471 * @return ID of the destination peer.
2472 */ 2472 */
2473const struct GNUNET_PeerIdentity * 2473const struct GNUNET_PeerIdentity *
2474GMT_get_destination (struct MeshTunnel3 *t) 2474GMT_get_destination (struct CadetTunnel3 *t)
2475{ 2475{
2476 return GMP_get_id (t->peer); 2476 return GMP_get_id (t->peer);
2477} 2477}
@@ -2484,11 +2484,11 @@ GMT_get_destination (struct MeshTunnel3 *t)
2484 * 2484 *
2485 * @return GID of a channel free to use. 2485 * @return GID of a channel free to use.
2486 */ 2486 */
2487MESH_ChannelNumber 2487CADET_ChannelNumber
2488GMT_get_next_chid (struct MeshTunnel3 *t) 2488GMT_get_next_chid (struct CadetTunnel3 *t)
2489{ 2489{
2490 MESH_ChannelNumber chid; 2490 CADET_ChannelNumber chid;
2491 MESH_ChannelNumber mask; 2491 CADET_ChannelNumber mask;
2492 int result; 2492 int result;
2493 2493
2494 /* Set bit 30 depending on the ID relationship. Bit 31 is always 0 for GID. 2494 /* Set bit 30 depending on the ID relationship. Bit 31 is always 0 for GID.
@@ -2505,11 +2505,11 @@ GMT_get_next_chid (struct MeshTunnel3 *t)
2505 while (NULL != GMT_get_channel (t, t->next_chid)) 2505 while (NULL != GMT_get_channel (t, t->next_chid))
2506 { 2506 {
2507 LOG (GNUNET_ERROR_TYPE_DEBUG, "Channel %u exists...\n", t->next_chid); 2507 LOG (GNUNET_ERROR_TYPE_DEBUG, "Channel %u exists...\n", t->next_chid);
2508 t->next_chid = (t->next_chid + 1) & ~GNUNET_MESH_LOCAL_CHANNEL_ID_CLI; 2508 t->next_chid = (t->next_chid + 1) & ~GNUNET_CADET_LOCAL_CHANNEL_ID_CLI;
2509 t->next_chid |= mask; 2509 t->next_chid |= mask;
2510 } 2510 }
2511 chid = t->next_chid; 2511 chid = t->next_chid;
2512 t->next_chid = (t->next_chid + 1) & ~GNUNET_MESH_LOCAL_CHANNEL_ID_CLI; 2512 t->next_chid = (t->next_chid + 1) & ~GNUNET_CADET_LOCAL_CHANNEL_ID_CLI;
2513 t->next_chid |= mask; 2513 t->next_chid |= mask;
2514 2514
2515 return chid; 2515 return chid;
@@ -2522,13 +2522,13 @@ GMT_get_next_chid (struct MeshTunnel3 *t)
2522 * @param t Channel which has some free buffer space. 2522 * @param t Channel which has some free buffer space.
2523 */ 2523 */
2524void 2524void
2525GMT_unchoke_channels (struct MeshTunnel3 *t) 2525GMT_unchoke_channels (struct CadetTunnel3 *t)
2526{ 2526{
2527 struct MeshTChannel *iter; 2527 struct CadetTChannel *iter;
2528 unsigned int buffer; 2528 unsigned int buffer;
2529 unsigned int channels = GMT_count_channels (t); 2529 unsigned int channels = GMT_count_channels (t);
2530 unsigned int choked_n; 2530 unsigned int choked_n;
2531 struct MeshChannel *choked[channels]; 2531 struct CadetChannel *choked[channels];
2532 2532
2533 LOG (GNUNET_ERROR_TYPE_DEBUG, "GMT_unchoke_channels on %s\n", GMT_2s (t)); 2533 LOG (GNUNET_ERROR_TYPE_DEBUG, "GMT_unchoke_channels on %s\n", GMT_2s (t));
2534 LOG (GNUNET_ERROR_TYPE_DEBUG, " head: %p\n", t->channel_head); 2534 LOG (GNUNET_ERROR_TYPE_DEBUG, " head: %p\n", t->channel_head);
@@ -2573,9 +2573,9 @@ GMT_unchoke_channels (struct MeshTunnel3 *t)
2573 * @param t Tunnel. 2573 * @param t Tunnel.
2574 */ 2574 */
2575void 2575void
2576GMT_send_connection_acks (struct MeshTunnel3 *t) 2576GMT_send_connection_acks (struct CadetTunnel3 *t)
2577{ 2577{
2578 struct MeshTConnection *iter; 2578 struct CadetTConnection *iter;
2579 uint32_t allowed; 2579 uint32_t allowed;
2580 uint32_t to_allow; 2580 uint32_t to_allow;
2581 uint32_t allow_per_connection; 2581 uint32_t allow_per_connection;
@@ -2640,7 +2640,7 @@ GMT_send_connection_acks (struct MeshTunnel3 *t)
2640 * @param q Handle to the queue. 2640 * @param q Handle to the queue.
2641 */ 2641 */
2642void 2642void
2643GMT_cancel (struct MeshTunnel3Queue *q) 2643GMT_cancel (struct CadetTunnel3Queue *q)
2644{ 2644{
2645 if (NULL != q->cq) 2645 if (NULL != q->cq)
2646 { 2646 {
@@ -2675,9 +2675,9 @@ GMT_cancel (struct MeshTunnel3Queue *q)
2675 * 2675 *
2676 * @return Handle to cancel message. NULL if @c cont is NULL. 2676 * @return Handle to cancel message. NULL if @c cont is NULL.
2677 */ 2677 */
2678struct MeshTunnel3Queue * 2678struct CadetTunnel3Queue *
2679GMT_send_prebuilt_message (const struct GNUNET_MessageHeader *message, 2679GMT_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
2680 struct MeshTunnel3 *t, struct MeshConnection *c, 2680 struct CadetTunnel3 *t, struct CadetConnection *c,
2681 int force, GMT_sent cont, void *cont_cls) 2681 int force, GMT_sent cont, void *cont_cls)
2682{ 2682{
2683 return send_prebuilt_message (message, t, c, force, cont, cont_cls, NULL); 2683 return send_prebuilt_message (message, t, c, force, cont, cont_cls, NULL);
@@ -2692,7 +2692,7 @@ GMT_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
2692 * @return #GNUNET_YES if it is loopback. 2692 * @return #GNUNET_YES if it is loopback.
2693 */ 2693 */
2694int 2694int
2695GMT_is_loopback (const struct MeshTunnel3 *t) 2695GMT_is_loopback (const struct CadetTunnel3 *t)
2696{ 2696{
2697 return (myid == GMP_get_short_id (t->peer)); 2697 return (myid == GMP_get_short_id (t->peer));
2698} 2698}
@@ -2707,9 +2707,9 @@ GMT_is_loopback (const struct MeshTunnel3 *t)
2707 * @return #GNUNET_YES a connection uses this path. 2707 * @return #GNUNET_YES a connection uses this path.
2708 */ 2708 */
2709int 2709int
2710GMT_is_path_used (const struct MeshTunnel3 *t, const struct MeshPeerPath *p) 2710GMT_is_path_used (const struct CadetTunnel3 *t, const struct CadetPeerPath *p)
2711{ 2711{
2712 struct MeshTConnection *iter; 2712 struct CadetTConnection *iter;
2713 2713
2714 for (iter = t->connection_head; NULL != iter; iter = iter->next) 2714 for (iter = t->connection_head; NULL != iter; iter = iter->next)
2715 if (GMC_get_path (iter->c) == p) 2715 if (GMC_get_path (iter->c) == p)
@@ -2728,11 +2728,11 @@ GMT_is_path_used (const struct MeshTunnel3 *t, const struct MeshPeerPath *p)
2728 * @return Cost of the path (path length + number of overlapping nodes) 2728 * @return Cost of the path (path length + number of overlapping nodes)
2729 */ 2729 */
2730unsigned int 2730unsigned int
2731GMT_get_path_cost (const struct MeshTunnel3 *t, 2731GMT_get_path_cost (const struct CadetTunnel3 *t,
2732 const struct MeshPeerPath *path) 2732 const struct CadetPeerPath *path)
2733{ 2733{
2734 struct MeshTConnection *iter; 2734 struct CadetTConnection *iter;
2735 const struct MeshPeerPath *aux; 2735 const struct CadetPeerPath *aux;
2736 unsigned int overlap; 2736 unsigned int overlap;
2737 unsigned int i; 2737 unsigned int i;
2738 unsigned int j; 2738 unsigned int j;
@@ -2773,7 +2773,7 @@ GMT_get_path_cost (const struct MeshTunnel3 *t,
2773 * @return Static string the destination peer's ID. 2773 * @return Static string the destination peer's ID.
2774 */ 2774 */
2775const char * 2775const char *
2776GMT_2s (const struct MeshTunnel3 *t) 2776GMT_2s (const struct CadetTunnel3 *t)
2777{ 2777{
2778 if (NULL == t) 2778 if (NULL == t)
2779 return "(NULL)"; 2779 return "(NULL)";
@@ -2793,10 +2793,10 @@ GMT_2s (const struct MeshTunnel3 *t)
2793 * @param t Tunnel to debug. 2793 * @param t Tunnel to debug.
2794 */ 2794 */
2795void 2795void
2796GMT_debug (const struct MeshTunnel3 *t) 2796GMT_debug (const struct CadetTunnel3 *t)
2797{ 2797{
2798 struct MeshTChannel *iterch; 2798 struct CadetTChannel *iterch;
2799 struct MeshTConnection *iterc; 2799 struct CadetTConnection *iterc;
2800 2800
2801 LOG (GNUNET_ERROR_TYPE_DEBUG, "TTT DEBUG TUNNEL TOWARDS %s\n", GMT_2s (t)); 2801 LOG (GNUNET_ERROR_TYPE_DEBUG, "TTT DEBUG TUNNEL TOWARDS %s\n", GMT_2s (t));
2802 LOG (GNUNET_ERROR_TYPE_DEBUG, "TTT cstate %s, estate %s\n", 2802 LOG (GNUNET_ERROR_TYPE_DEBUG, "TTT cstate %s, estate %s\n",
@@ -2861,9 +2861,9 @@ GMT_count_all (void)
2861 * @param cls Closure for @c iter. 2861 * @param cls Closure for @c iter.
2862 */ 2862 */
2863void 2863void
2864GMT_iterate_connections (struct MeshTunnel3 *t, GMT_conn_iter iter, void *cls) 2864GMT_iterate_connections (struct CadetTunnel3 *t, GMT_conn_iter iter, void *cls)
2865{ 2865{
2866 struct MeshTConnection *ct; 2866 struct CadetTConnection *ct;
2867 2867
2868 for (ct = t->connection_head; NULL != ct; ct = ct->next) 2868 for (ct = t->connection_head; NULL != ct; ct = ct->next)
2869 iter (cls, ct->c); 2869 iter (cls, ct->c);
@@ -2878,9 +2878,9 @@ GMT_iterate_connections (struct MeshTunnel3 *t, GMT_conn_iter iter, void *cls)
2878 * @param cls Closure for @c iter. 2878 * @param cls Closure for @c iter.
2879 */ 2879 */
2880void 2880void
2881GMT_iterate_channels (struct MeshTunnel3 *t, GMT_chan_iter iter, void *cls) 2881GMT_iterate_channels (struct CadetTunnel3 *t, GMT_chan_iter iter, void *cls)
2882{ 2882{
2883 struct MeshTChannel *cht; 2883 struct CadetTChannel *cht;
2884 2884
2885 for (cht = t->channel_head; NULL != cht; cht = cht->next) 2885 for (cht = t->channel_head; NULL != cht; cht = cht->next)
2886 iter (cls, cht->ch); 2886 iter (cls, cht->ch);
diff --git a/src/mesh/gnunet-service-mesh_tunnel.h b/src/mesh/gnunet-service-mesh_tunnel.h
index 59f9b6657..16616de59 100644
--- a/src/mesh/gnunet-service-mesh_tunnel.h
+++ b/src/mesh/gnunet-service-mesh_tunnel.h
@@ -19,15 +19,15 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file mesh/gnunet-service-mesh_tunnel.h 22 * @file cadet/gnunet-service-cadet_tunnel.h
23 * @brief mesh service; dealing with tunnels and crypto 23 * @brief cadet service; dealing with tunnels and crypto
24 * @author Bartlomiej Polot 24 * @author Bartlomiej Polot
25 * 25 *
26 * All functions in this file should use the prefix GMT (Gnunet Mesh Tunnel) 26 * All functions in this file should use the prefix GMT (Gnunet Cadet Tunnel)
27 */ 27 */
28 28
29#ifndef GNUNET_SERVICE_MESH_TUNNEL_H 29#ifndef GNUNET_SERVICE_CADET_TUNNEL_H
30#define GNUNET_SERVICE_MESH_TUNNEL_H 30#define GNUNET_SERVICE_CADET_TUNNEL_H
31 31
32#ifdef __cplusplus 32#ifdef __cplusplus
33extern "C" 33extern "C"
@@ -43,77 +43,77 @@ extern "C"
43/** 43/**
44 * All the connectivity states a tunnel can be in. 44 * All the connectivity states a tunnel can be in.
45 */ 45 */
46enum MeshTunnel3CState 46enum CadetTunnel3CState
47{ 47{
48 /** 48 /**
49 * Uninitialized status, should never appear in operation. 49 * Uninitialized status, should never appear in operation.
50 */ 50 */
51 MESH_TUNNEL3_NEW, 51 CADET_TUNNEL3_NEW,
52 52
53 /** 53 /**
54 * Path to the peer not known yet. 54 * Path to the peer not known yet.
55 */ 55 */
56 MESH_TUNNEL3_SEARCHING, 56 CADET_TUNNEL3_SEARCHING,
57 57
58 /** 58 /**
59 * Request sent, not yet answered. 59 * Request sent, not yet answered.
60 */ 60 */
61 MESH_TUNNEL3_WAITING, 61 CADET_TUNNEL3_WAITING,
62 62
63 /** 63 /**
64 * Peer connected and ready to accept data. 64 * Peer connected and ready to accept data.
65 */ 65 */
66 MESH_TUNNEL3_READY, 66 CADET_TUNNEL3_READY,
67 67
68 /** 68 /**
69 * Tunnel being shut down, don't try to keep it alive. 69 * Tunnel being shut down, don't try to keep it alive.
70 */ 70 */
71 MESH_TUNNEL3_SHUTDOWN 71 CADET_TUNNEL3_SHUTDOWN
72}; 72};
73 73
74 74
75/** 75/**
76 * All the encryption states a tunnel can be in. 76 * All the encryption states a tunnel can be in.
77 */ 77 */
78enum MeshTunnel3EState 78enum CadetTunnel3EState
79{ 79{
80 /** 80 /**
81 * Uninitialized status, should never appear in operation. 81 * Uninitialized status, should never appear in operation.
82 */ 82 */
83 MESH_TUNNEL3_KEY_UNINITIALIZED, 83 CADET_TUNNEL3_KEY_UNINITIALIZED,
84 84
85 /** 85 /**
86 * Ephemeral key sent, waiting for peer's key. 86 * Ephemeral key sent, waiting for peer's key.
87 */ 87 */
88 MESH_TUNNEL3_KEY_SENT, 88 CADET_TUNNEL3_KEY_SENT,
89 89
90 /** 90 /**
91 * New ephemeral key and ping sent, waiting for pong. 91 * New ephemeral key and ping sent, waiting for pong.
92 * This means that we DO have the peer's ephemeral key, otherwise the 92 * This means that we DO have the peer's ephemeral key, otherwise the
93 * state would be KEY_SENT. 93 * state would be KEY_SENT.
94 */ 94 */
95 MESH_TUNNEL3_KEY_PING, 95 CADET_TUNNEL3_KEY_PING,
96 96
97 /** 97 /**
98 * Handshake completed: session key available. 98 * Handshake completed: session key available.
99 */ 99 */
100 MESH_TUNNEL3_KEY_OK, 100 CADET_TUNNEL3_KEY_OK,
101}; 101};
102 102
103/** 103/**
104 * Struct containing all information regarding a given peer 104 * Struct containing all information regarding a given peer
105 */ 105 */
106struct MeshTunnel3; 106struct CadetTunnel3;
107 107
108 108
109#include "gnunet-service-mesh_channel.h" 109#include "gnunet-service-cadet_channel.h"
110#include "gnunet-service-mesh_connection.h" 110#include "gnunet-service-cadet_connection.h"
111#include "gnunet-service-mesh_peer.h" 111#include "gnunet-service-cadet_peer.h"
112 112
113/** 113/**
114 * Handle for messages queued but not yet sent. 114 * Handle for messages queued but not yet sent.
115 */ 115 */
116struct MeshTunnel3Queue; 116struct CadetTunnel3Queue;
117 117
118/** 118/**
119 * Callback called when a queued message is sent. 119 * Callback called when a queued message is sent.
@@ -124,12 +124,12 @@ struct MeshTunnel3Queue;
124 * @param size Size of the message. 124 * @param size Size of the message.
125 */ 125 */
126typedef void (*GMT_sent) (void *cls, 126typedef void (*GMT_sent) (void *cls,
127 struct MeshTunnel3 *t, 127 struct CadetTunnel3 *t,
128 struct MeshTunnel3Queue *q, 128 struct CadetTunnel3Queue *q,
129 uint16_t type, size_t size); 129 uint16_t type, size_t size);
130 130
131typedef void (*GMT_conn_iter) (void *cls, struct MeshConnection *c); 131typedef void (*GMT_conn_iter) (void *cls, struct CadetConnection *c);
132typedef void (*GMT_chan_iter) (void *cls, struct MeshChannel *ch); 132typedef void (*GMT_chan_iter) (void *cls, struct CadetChannel *ch);
133 133
134 134
135/******************************************************************************/ 135/******************************************************************************/
@@ -157,8 +157,8 @@ GMT_shutdown (void);
157 * 157 *
158 * @param destination Peer this tunnel is towards. 158 * @param destination Peer this tunnel is towards.
159 */ 159 */
160struct MeshTunnel3 * 160struct CadetTunnel3 *
161GMT_new (struct MeshPeer *destination); 161GMT_new (struct CadetPeer *destination);
162 162
163/** 163/**
164 * Tunnel is empty: destroy it. 164 * Tunnel is empty: destroy it.
@@ -168,7 +168,7 @@ GMT_new (struct MeshPeer *destination);
168 * @param t Tunnel to destroy. 168 * @param t Tunnel to destroy.
169 */ 169 */
170void 170void
171GMT_destroy_empty (struct MeshTunnel3 *t); 171GMT_destroy_empty (struct CadetTunnel3 *t);
172 172
173/** 173/**
174 * Destroy tunnel if empty (no more channels). 174 * Destroy tunnel if empty (no more channels).
@@ -176,7 +176,7 @@ GMT_destroy_empty (struct MeshTunnel3 *t);
176 * @param t Tunnel to destroy if empty. 176 * @param t Tunnel to destroy if empty.
177 */ 177 */
178void 178void
179GMT_destroy_if_empty (struct MeshTunnel3 *t); 179GMT_destroy_if_empty (struct CadetTunnel3 *t);
180 180
181/** 181/**
182 * Destroy the tunnel. 182 * Destroy the tunnel.
@@ -190,7 +190,7 @@ GMT_destroy_if_empty (struct MeshTunnel3 *t);
190 * @param t The tunnel to destroy. 190 * @param t The tunnel to destroy.
191 */ 191 */
192void 192void
193GMT_destroy (struct MeshTunnel3 *t); 193GMT_destroy (struct CadetTunnel3 *t);
194 194
195 195
196/** 196/**
@@ -200,7 +200,7 @@ GMT_destroy (struct MeshTunnel3 *t);
200 * @param cstate New connection state. 200 * @param cstate New connection state.
201 */ 201 */
202void 202void
203GMT_change_cstate (struct MeshTunnel3* t, enum MeshTunnel3CState cstate); 203GMT_change_cstate (struct CadetTunnel3* t, enum CadetTunnel3CState cstate);
204 204
205 205
206/** 206/**
@@ -210,7 +210,7 @@ GMT_change_cstate (struct MeshTunnel3* t, enum MeshTunnel3CState cstate);
210 * @param state New encryption state. 210 * @param state New encryption state.
211 */ 211 */
212void 212void
213GMT_change_estate (struct MeshTunnel3* t, enum MeshTunnel3EState state); 213GMT_change_estate (struct CadetTunnel3* t, enum CadetTunnel3EState state);
214 214
215/** 215/**
216 * Add a connection to a tunnel. 216 * Add a connection to a tunnel.
@@ -219,7 +219,7 @@ GMT_change_estate (struct MeshTunnel3* t, enum MeshTunnel3EState state);
219 * @param c Connection. 219 * @param c Connection.
220 */ 220 */
221void 221void
222GMT_add_connection (struct MeshTunnel3 *t, struct MeshConnection *c); 222GMT_add_connection (struct CadetTunnel3 *t, struct CadetConnection *c);
223 223
224/** 224/**
225 * Mark a path as no longer valid for this tunnel: has been tried and failed. 225 * Mark a path as no longer valid for this tunnel: has been tried and failed.
@@ -228,7 +228,7 @@ GMT_add_connection (struct MeshTunnel3 *t, struct MeshConnection *c);
228 * @param path Invalid path to remove. Is destroyed after removal. 228 * @param path Invalid path to remove. Is destroyed after removal.
229 */ 229 */
230void 230void
231GMT_remove_path (struct MeshTunnel3 *t, struct MeshPeerPath *path); 231GMT_remove_path (struct CadetTunnel3 *t, struct CadetPeerPath *path);
232 232
233/** 233/**
234 * Remove a connection from a tunnel. 234 * Remove a connection from a tunnel.
@@ -237,7 +237,7 @@ GMT_remove_path (struct MeshTunnel3 *t, struct MeshPeerPath *path);
237 * @param c Connection. 237 * @param c Connection.
238 */ 238 */
239void 239void
240GMT_remove_connection (struct MeshTunnel3 *t, struct MeshConnection *c); 240GMT_remove_connection (struct CadetTunnel3 *t, struct CadetConnection *c);
241 241
242/** 242/**
243 * Add a channel to a tunnel. 243 * Add a channel to a tunnel.
@@ -246,7 +246,7 @@ GMT_remove_connection (struct MeshTunnel3 *t, struct MeshConnection *c);
246 * @param ch Channel. 246 * @param ch Channel.
247 */ 247 */
248void 248void
249GMT_add_channel (struct MeshTunnel3 *t, struct MeshChannel *ch); 249GMT_add_channel (struct CadetTunnel3 *t, struct CadetChannel *ch);
250 250
251/** 251/**
252 * Remove a channel from a tunnel. 252 * Remove a channel from a tunnel.
@@ -255,7 +255,7 @@ GMT_add_channel (struct MeshTunnel3 *t, struct MeshChannel *ch);
255 * @param ch Channel. 255 * @param ch Channel.
256 */ 256 */
257void 257void
258GMT_remove_channel (struct MeshTunnel3 *t, struct MeshChannel *ch); 258GMT_remove_channel (struct CadetTunnel3 *t, struct CadetChannel *ch);
259 259
260/** 260/**
261 * Search for a channel by global ID. 261 * Search for a channel by global ID.
@@ -265,8 +265,8 @@ GMT_remove_channel (struct MeshTunnel3 *t, struct MeshChannel *ch);
265 * 265 *
266 * @return channel handler, NULL if doesn't exist 266 * @return channel handler, NULL if doesn't exist
267 */ 267 */
268struct MeshChannel * 268struct CadetChannel *
269GMT_get_channel (struct MeshTunnel3 *t, MESH_ChannelNumber chid); 269GMT_get_channel (struct CadetTunnel3 *t, CADET_ChannelNumber chid);
270 270
271/** 271/**
272 * Decrypt and demultiplex by message type. Call appropriate handler 272 * Decrypt and demultiplex by message type. Call appropriate handler
@@ -277,8 +277,8 @@ GMT_get_channel (struct MeshTunnel3 *t, MESH_ChannelNumber chid);
277 * @param msg Message header. 277 * @param msg Message header.
278 */ 278 */
279void 279void
280GMT_handle_encrypted (struct MeshTunnel3 *t, 280GMT_handle_encrypted (struct CadetTunnel3 *t,
281 const struct GNUNET_MESH_Encrypted *msg); 281 const struct GNUNET_CADET_Encrypted *msg);
282 282
283/** 283/**
284 * Demultiplex an encapsulated KX message by message type. 284 * Demultiplex an encapsulated KX message by message type.
@@ -287,7 +287,7 @@ GMT_handle_encrypted (struct MeshTunnel3 *t,
287 * @param message KX message itself. 287 * @param message KX message itself.
288 */ 288 */
289void 289void
290GMT_handle_kx (struct MeshTunnel3 *t, 290GMT_handle_kx (struct CadetTunnel3 *t,
291 const struct GNUNET_MessageHeader *message); 291 const struct GNUNET_MessageHeader *message);
292 292
293/** 293/**
@@ -300,8 +300,8 @@ GMT_handle_kx (struct MeshTunnel3 *t,
300 * 300 *
301 * @return Connection created. 301 * @return Connection created.
302 */ 302 */
303struct MeshConnection * 303struct CadetConnection *
304GMT_use_path (struct MeshTunnel3 *t, struct MeshPeerPath *p); 304GMT_use_path (struct CadetTunnel3 *t, struct CadetPeerPath *p);
305 305
306/** 306/**
307 * Count established (ready) connections of a tunnel. 307 * Count established (ready) connections of a tunnel.
@@ -311,7 +311,7 @@ GMT_use_path (struct MeshTunnel3 *t, struct MeshPeerPath *p);
311 * @return Number of connections. 311 * @return Number of connections.
312 */ 312 */
313unsigned int 313unsigned int
314GMT_count_connections (struct MeshTunnel3 *t); 314GMT_count_connections (struct CadetTunnel3 *t);
315 315
316/** 316/**
317 * Count channels of a tunnel. 317 * Count channels of a tunnel.
@@ -321,7 +321,7 @@ GMT_count_connections (struct MeshTunnel3 *t);
321 * @return Number of channels. 321 * @return Number of channels.
322 */ 322 */
323unsigned int 323unsigned int
324GMT_count_channels (struct MeshTunnel3 *t); 324GMT_count_channels (struct CadetTunnel3 *t);
325 325
326/** 326/**
327 * Get the connectivity state of a tunnel. 327 * Get the connectivity state of a tunnel.
@@ -330,8 +330,8 @@ GMT_count_channels (struct MeshTunnel3 *t);
330 * 330 *
331 * @return Tunnel's connectivity state. 331 * @return Tunnel's connectivity state.
332 */ 332 */
333enum MeshTunnel3CState 333enum CadetTunnel3CState
334GMT_get_cstate (struct MeshTunnel3 *t); 334GMT_get_cstate (struct CadetTunnel3 *t);
335 335
336/** 336/**
337 * Get the encryption state of a tunnel. 337 * Get the encryption state of a tunnel.
@@ -340,8 +340,8 @@ GMT_get_cstate (struct MeshTunnel3 *t);
340 * 340 *
341 * @return Tunnel's encryption state. 341 * @return Tunnel's encryption state.
342 */ 342 */
343enum MeshTunnel3EState 343enum CadetTunnel3EState
344GMT_get_estate (struct MeshTunnel3 *t); 344GMT_get_estate (struct CadetTunnel3 *t);
345 345
346/** 346/**
347 * Get the maximum buffer space for a tunnel towards a local client. 347 * Get the maximum buffer space for a tunnel towards a local client.
@@ -351,7 +351,7 @@ GMT_get_estate (struct MeshTunnel3 *t);
351 * @return Biggest buffer space offered by any channel in the tunnel. 351 * @return Biggest buffer space offered by any channel in the tunnel.
352 */ 352 */
353unsigned int 353unsigned int
354GMT_get_channels_buffer (struct MeshTunnel3 *t); 354GMT_get_channels_buffer (struct CadetTunnel3 *t);
355 355
356/** 356/**
357 * Get the total buffer space for a tunnel for P2P traffic. 357 * Get the total buffer space for a tunnel for P2P traffic.
@@ -361,7 +361,7 @@ GMT_get_channels_buffer (struct MeshTunnel3 *t);
361 * @return Buffer space offered by all connections in the tunnel. 361 * @return Buffer space offered by all connections in the tunnel.
362 */ 362 */
363unsigned int 363unsigned int
364GMT_get_connections_buffer (struct MeshTunnel3 *t); 364GMT_get_connections_buffer (struct CadetTunnel3 *t);
365 365
366/** 366/**
367 * Get the tunnel's destination. 367 * Get the tunnel's destination.
@@ -371,7 +371,7 @@ GMT_get_connections_buffer (struct MeshTunnel3 *t);
371 * @return ID of the destination peer. 371 * @return ID of the destination peer.
372 */ 372 */
373const struct GNUNET_PeerIdentity * 373const struct GNUNET_PeerIdentity *
374GMT_get_destination (struct MeshTunnel3 *t); 374GMT_get_destination (struct CadetTunnel3 *t);
375 375
376/** 376/**
377 * Get the tunnel's next free Channel ID. 377 * Get the tunnel's next free Channel ID.
@@ -380,8 +380,8 @@ GMT_get_destination (struct MeshTunnel3 *t);
380 * 380 *
381 * @return ID of a channel free to use. 381 * @return ID of a channel free to use.
382 */ 382 */
383MESH_ChannelNumber 383CADET_ChannelNumber
384GMT_get_next_chid (struct MeshTunnel3 *t); 384GMT_get_next_chid (struct CadetTunnel3 *t);
385 385
386/** 386/**
387 * Send ACK on one or more channels due to buffer in connections. 387 * Send ACK on one or more channels due to buffer in connections.
@@ -389,7 +389,7 @@ GMT_get_next_chid (struct MeshTunnel3 *t);
389 * @param t Channel which has some free buffer space. 389 * @param t Channel which has some free buffer space.
390 */ 390 */
391void 391void
392GMT_unchoke_channels (struct MeshTunnel3 *t); 392GMT_unchoke_channels (struct CadetTunnel3 *t);
393 393
394/** 394/**
395 * Send ACK on one or more connections due to buffer space to the client. 395 * Send ACK on one or more connections due to buffer space to the client.
@@ -399,7 +399,7 @@ GMT_unchoke_channels (struct MeshTunnel3 *t);
399 * @param t Tunnel which has some free buffer space. 399 * @param t Tunnel which has some free buffer space.
400 */ 400 */
401void 401void
402GMT_send_connection_acks (struct MeshTunnel3 *t); 402GMT_send_connection_acks (struct CadetTunnel3 *t);
403 403
404/** 404/**
405 * Cancel a previously sent message while it's in the queue. 405 * Cancel a previously sent message while it's in the queue.
@@ -411,7 +411,7 @@ GMT_send_connection_acks (struct MeshTunnel3 *t);
411 * @param q Handle to the queue. 411 * @param q Handle to the queue.
412 */ 412 */
413void 413void
414GMT_cancel (struct MeshTunnel3Queue *q); 414GMT_cancel (struct CadetTunnel3Queue *q);
415 415
416/** 416/**
417 * Sends an already built message on a tunnel, encrypting it and 417 * Sends an already built message on a tunnel, encrypting it and
@@ -426,9 +426,9 @@ GMT_cancel (struct MeshTunnel3Queue *q);
426 * 426 *
427 * @return Handle to cancel message. NULL if @c cont is NULL. 427 * @return Handle to cancel message. NULL if @c cont is NULL.
428 */ 428 */
429struct MeshTunnel3Queue * 429struct CadetTunnel3Queue *
430GMT_send_prebuilt_message (const struct GNUNET_MessageHeader *message, 430GMT_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
431 struct MeshTunnel3 *t, struct MeshConnection *c, 431 struct CadetTunnel3 *t, struct CadetConnection *c,
432 int force, GMT_sent cont, void *cont_cls); 432 int force, GMT_sent cont, void *cont_cls);
433 433
434/** 434/**
@@ -439,7 +439,7 @@ GMT_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
439 * @return #GNUNET_YES if it is loopback. 439 * @return #GNUNET_YES if it is loopback.
440 */ 440 */
441int 441int
442GMT_is_loopback (const struct MeshTunnel3 *t); 442GMT_is_loopback (const struct CadetTunnel3 *t);
443 443
444/** 444/**
445 * Is the tunnel using this path already? 445 * Is the tunnel using this path already?
@@ -450,7 +450,7 @@ GMT_is_loopback (const struct MeshTunnel3 *t);
450 * @return #GNUNET_YES a connection uses this path. 450 * @return #GNUNET_YES a connection uses this path.
451 */ 451 */
452int 452int
453GMT_is_path_used (const struct MeshTunnel3 *t, const struct MeshPeerPath *p); 453GMT_is_path_used (const struct CadetTunnel3 *t, const struct CadetPeerPath *p);
454 454
455/** 455/**
456 * Get a cost of a path for a tunnel considering existing connections. 456 * Get a cost of a path for a tunnel considering existing connections.
@@ -461,8 +461,8 @@ GMT_is_path_used (const struct MeshTunnel3 *t, const struct MeshPeerPath *p);
461 * @return Cost of the path (path length + number of overlapping nodes) 461 * @return Cost of the path (path length + number of overlapping nodes)
462 */ 462 */
463unsigned int 463unsigned int
464GMT_get_path_cost (const struct MeshTunnel3 *t, 464GMT_get_path_cost (const struct CadetTunnel3 *t,
465 const struct MeshPeerPath *path); 465 const struct CadetPeerPath *path);
466 466
467/** 467/**
468 * Get the static string for the peer this tunnel is directed. 468 * Get the static string for the peer this tunnel is directed.
@@ -472,7 +472,7 @@ GMT_get_path_cost (const struct MeshTunnel3 *t,
472 * @return Static string the destination peer's ID. 472 * @return Static string the destination peer's ID.
473 */ 473 */
474const char * 474const char *
475GMT_2s (const struct MeshTunnel3 *t); 475GMT_2s (const struct CadetTunnel3 *t);
476 476
477/** 477/**
478 * Log all possible info about the tunnel state. 478 * Log all possible info about the tunnel state.
@@ -480,7 +480,7 @@ GMT_2s (const struct MeshTunnel3 *t);
480 * @param t Tunnel to debug. 480 * @param t Tunnel to debug.
481 */ 481 */
482void 482void
483GMT_debug (const struct MeshTunnel3 *t); 483GMT_debug (const struct CadetTunnel3 *t);
484 484
485/** 485/**
486 * Iterate all tunnels. 486 * Iterate all tunnels.
@@ -507,7 +507,7 @@ GMT_count_all (void);
507 * @param cls Closure for @c iter. 507 * @param cls Closure for @c iter.
508 */ 508 */
509void 509void
510GMT_iterate_connections (struct MeshTunnel3 *t, GMT_conn_iter iter, void *cls); 510GMT_iterate_connections (struct CadetTunnel3 *t, GMT_conn_iter iter, void *cls);
511 511
512/** 512/**
513 * Iterate all channels of a tunnel. 513 * Iterate all channels of a tunnel.
@@ -517,7 +517,7 @@ GMT_iterate_connections (struct MeshTunnel3 *t, GMT_conn_iter iter, void *cls);
517 * @param cls Closure for @c iter. 517 * @param cls Closure for @c iter.
518 */ 518 */
519void 519void
520GMT_iterate_channels (struct MeshTunnel3 *t, GMT_chan_iter iter, void *cls); 520GMT_iterate_channels (struct CadetTunnel3 *t, GMT_chan_iter iter, void *cls);
521 521
522#if 0 /* keep Emacsens' auto-indent happy */ 522#if 0 /* keep Emacsens' auto-indent happy */
523{ 523{
@@ -526,6 +526,6 @@ GMT_iterate_channels (struct MeshTunnel3 *t, GMT_chan_iter iter, void *cls);
526} 526}
527#endif 527#endif
528 528
529/* ifndef GNUNET_MESH_SERVICE_TUNNEL_H */ 529/* ifndef GNUNET_CADET_SERVICE_TUNNEL_H */
530#endif 530#endif
531/* end of gnunet-mesh-service_tunnel.h */ 531/* end of gnunet-cadet-service_tunnel.h */
diff --git a/src/mesh/mesh.h b/src/mesh/mesh.h
index 6e7506fd2..757f8c501 100644
--- a/src/mesh/mesh.h
+++ b/src/mesh/mesh.h
@@ -20,11 +20,11 @@
20 20
21/** 21/**
22 * @author Bartlomiej Polot 22 * @author Bartlomiej Polot
23 * @file mesh/mesh.h 23 * @file cadet/cadet.h
24 */ 24 */
25 25
26#ifndef MESH_H_ 26#ifndef CADET_H_
27#define MESH_H_ 27#define CADET_H_
28 28
29#ifdef __cplusplus 29#ifdef __cplusplus
30extern "C" 30extern "C"
@@ -36,21 +36,21 @@ extern "C"
36 36
37#include <stdint.h> 37#include <stdint.h>
38 38
39#define MESH_DEBUG GNUNET_YES 39#define CADET_DEBUG GNUNET_YES
40 40
41#include "platform.h" 41#include "platform.h"
42#include "gnunet_util_lib.h" 42#include "gnunet_util_lib.h"
43#include "gnunet_peer_lib.h" 43#include "gnunet_peer_lib.h"
44#include "gnunet_core_service.h" 44#include "gnunet_core_service.h"
45#include "gnunet_protocols.h" 45#include "gnunet_protocols.h"
46#include <gnunet_mesh_service.h> 46#include <gnunet_cadet_service.h>
47 47
48/******************************************************************************/ 48/******************************************************************************/
49/************************** CONSTANTS ******************************/ 49/************************** CONSTANTS ******************************/
50/******************************************************************************/ 50/******************************************************************************/
51 51
52#define GNUNET_MESH_LOCAL_CHANNEL_ID_CLI 0x80000000 52#define GNUNET_CADET_LOCAL_CHANNEL_ID_CLI 0x80000000
53#define GNUNET_MESH_LOCAL_CHANNEL_ID_SERV 0xB0000000 53#define GNUNET_CADET_LOCAL_CHANNEL_ID_SERV 0xB0000000
54 54
55#define HIGH_PID 0xFFFF0000 55#define HIGH_PID 0xFFFF0000
56#define LOW_PID 0x0000FFFF 56#define LOW_PID 0x0000FFFF
@@ -66,13 +66,13 @@ GNUNET_NETWORK_STRUCT_BEGIN
66/** 66/**
67 * Message for a client to register to the service 67 * Message for a client to register to the service
68 */ 68 */
69struct GNUNET_MESH_ClientConnect 69struct GNUNET_CADET_ClientConnect
70{ 70{
71 /** 71 /**
72 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT 72 * Type: GNUNET_MESSAGE_TYPE_CADET_LOCAL_CONNECT
73 * 73 *
74 * Size: sizeof(struct GNUNET_MESH_ClientConnect) + 74 * Size: sizeof(struct GNUNET_CADET_ClientConnect) +
75 * sizeof(MESH_ApplicationType) * applications + 75 * sizeof(CADET_ApplicationType) * applications +
76 * sizeof(uint16_t) * types 76 * sizeof(uint16_t) * types
77 */ 77 */
78 struct GNUNET_MessageHeader header; 78 struct GNUNET_MessageHeader header;
@@ -86,25 +86,25 @@ struct GNUNET_MESH_ClientConnect
86 * - Local channel numbers given by the client (created) are >= 0x80000000 86 * - Local channel numbers given by the client (created) are >= 0x80000000
87 * - Global channel numbers are < 0x80000000 87 * - Global channel numbers are < 0x80000000
88 */ 88 */
89typedef uint32_t MESH_ChannelNumber; 89typedef uint32_t CADET_ChannelNumber;
90 90
91 91
92/** 92/**
93 * Message for a client to create and destroy channels. 93 * Message for a client to create and destroy channels.
94 */ 94 */
95struct GNUNET_MESH_ChannelMessage 95struct GNUNET_CADET_ChannelMessage
96{ 96{
97 /** 97 /**
98 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_[CREATE|DESTROY] 98 * Type: GNUNET_MESSAGE_TYPE_CADET_LOCAL_TUNNEL_[CREATE|DESTROY]
99 * 99 *
100 * Size: sizeof(struct GNUNET_MESH_ChannelMessage) 100 * Size: sizeof(struct GNUNET_CADET_ChannelMessage)
101 */ 101 */
102 struct GNUNET_MessageHeader header; 102 struct GNUNET_MessageHeader header;
103 103
104 /** 104 /**
105 * ID of a channel controlled by this client. 105 * ID of a channel controlled by this client.
106 */ 106 */
107 MESH_ChannelNumber channel_id GNUNET_PACKED; 107 CADET_ChannelNumber channel_id GNUNET_PACKED;
108 108
109 /** 109 /**
110 * Channel's peer 110 * Channel's peer
@@ -124,12 +124,12 @@ struct GNUNET_MESH_ChannelMessage
124 124
125 125
126/** 126/**
127 * Message for mesh data traffic. 127 * Message for cadet data traffic.
128 */ 128 */
129struct GNUNET_MESH_LocalData 129struct GNUNET_CADET_LocalData
130{ 130{
131 /** 131 /**
132 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA 132 * Type: GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA
133 */ 133 */
134 struct GNUNET_MessageHeader header; 134 struct GNUNET_MessageHeader header;
135 135
@@ -148,17 +148,17 @@ struct GNUNET_MESH_LocalData
148 * Message to allow the client send more data to the service 148 * Message to allow the client send more data to the service
149 * (always service -> client). 149 * (always service -> client).
150 */ 150 */
151struct GNUNET_MESH_LocalAck 151struct GNUNET_CADET_LocalAck
152{ 152{
153 /** 153 /**
154 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK 154 * Type: GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK
155 */ 155 */
156 struct GNUNET_MessageHeader header; 156 struct GNUNET_MessageHeader header;
157 157
158 /** 158 /**
159 * ID of the channel allowed to send more data. 159 * ID of the channel allowed to send more data.
160 */ 160 */
161 MESH_ChannelNumber channel_id GNUNET_PACKED; 161 CADET_ChannelNumber channel_id GNUNET_PACKED;
162 162
163}; 163};
164 164
@@ -166,17 +166,17 @@ struct GNUNET_MESH_LocalAck
166/** 166/**
167 * Message to inform the client about channels in the service. 167 * Message to inform the client about channels in the service.
168 */ 168 */
169struct GNUNET_MESH_LocalInfo 169struct GNUNET_CADET_LocalInfo
170{ 170{
171 /** 171 /**
172 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO[_TUNNEL,_PEER] 172 * Type: GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO[_TUNNEL,_PEER]
173 */ 173 */
174 struct GNUNET_MessageHeader header; 174 struct GNUNET_MessageHeader header;
175 175
176 /** 176 /**
177 * ID of the channel allowed to send more data. 177 * ID of the channel allowed to send more data.
178 */ 178 */
179 MESH_ChannelNumber channel_id GNUNET_PACKED; 179 CADET_ChannelNumber channel_id GNUNET_PACKED;
180 180
181 /** 181 /**
182 * ID of the owner of the channel (can be local peer). 182 * ID of the owner of the channel (can be local peer).
@@ -193,10 +193,10 @@ struct GNUNET_MESH_LocalInfo
193/** 193/**
194 * Message to inform the client about one of the peers in the service. 194 * Message to inform the client about one of the peers in the service.
195 */ 195 */
196struct GNUNET_MESH_LocalInfoPeer 196struct GNUNET_CADET_LocalInfoPeer
197{ 197{
198 /** 198 /**
199 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_PEER[S] 199 * Type: GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER[S]
200 */ 200 */
201 struct GNUNET_MessageHeader header; 201 struct GNUNET_MessageHeader header;
202 202
@@ -222,10 +222,10 @@ struct GNUNET_MESH_LocalInfoPeer
222/** 222/**
223 * Message to inform the client about one of the tunnels in the service. 223 * Message to inform the client about one of the tunnels in the service.
224 */ 224 */
225struct GNUNET_MESH_LocalInfoTunnel 225struct GNUNET_CADET_LocalInfoTunnel
226{ 226{
227 /** 227 /**
228 * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNEL[S] 228 * Type: GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL[S]
229 */ 229 */
230 struct GNUNET_MessageHeader header; 230 struct GNUNET_MessageHeader header;
231 231
@@ -311,7 +311,7 @@ GM_min_pid (uint32_t a, uint32_t b);
311 311
312 312
313/** 313/**
314 * Convert a 256 bit MeshHash into a 512 HashCode to use in GNUNET_h2s, 314 * Convert a 256 bit CadetHash into a 512 HashCode to use in GNUNET_h2s,
315 * multihashmap, and other HashCode-based functions. 315 * multihashmap, and other HashCode-based functions.
316 * 316 *
317 * @param id A 256 bit hash to expand. 317 * @param id A 256 bit hash to expand.
@@ -319,14 +319,14 @@ GM_min_pid (uint32_t a, uint32_t b);
319 * @return A HashCode containing the original 256 bit hash right-padded with 0. 319 * @return A HashCode containing the original 256 bit hash right-padded with 0.
320 */ 320 */
321const struct GNUNET_HashCode * 321const struct GNUNET_HashCode *
322GM_h2hc (const struct GNUNET_MESH_Hash *id); 322GM_h2hc (const struct GNUNET_CADET_Hash *id);
323 323
324/** 324/**
325 * Get a string from a Mesh Hash (256 bits). 325 * Get a string from a Cadet Hash (256 bits).
326 * WARNING: Not reentrant (based on GNUNET_h2s). 326 * WARNING: Not reentrant (based on GNUNET_h2s).
327 */ 327 */
328const char * 328const char *
329GM_h2s (const struct GNUNET_MESH_Hash *id); 329GM_h2s (const struct GNUNET_CADET_Hash *id);
330 330
331/** 331/**
332 * Convert a message type into a string to help debug 332 * Convert a message type into a string to help debug
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 */
39struct GNUNET_MESH_TransmitHandle 39struct 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
89union MeshInfoCB { 89union 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 */
121struct GNUNET_MESH_Handle 121struct 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 */
230struct GNUNET_MESH_Peer 230struct 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 */
247struct GNUNET_MESH_Channel 247struct 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 */
306struct MeshMQState 306struct 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 */
351static int 351static int
352th_is_payload (struct GNUNET_MESH_TransmitHandle *th) 352th_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 */
366static size_t 366static size_t
367message_ready_size (struct GNUNET_MESH_Handle *h) 367message_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 */
396static struct GNUNET_MESH_Channel * 396static struct GNUNET_CADET_Channel *
397retrieve_channel (struct GNUNET_MESH_Handle *h, MESH_ChannelNumber chid) 397retrieve_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 */
420static struct GNUNET_MESH_Channel * 420static struct GNUNET_CADET_Channel *
421create_channel (struct GNUNET_MESH_Handle *h, MESH_ChannelNumber chid) 421create_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 */
459static void 459static void
460destroy_channel (struct GNUNET_MESH_Channel *ch, int call_cleaner) 460destroy_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)
525static void 525static void
526timeout_transmission (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 526timeout_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 */
553static void 553static void
554add_to_queue (struct GNUNET_MESH_Handle *h, 554add_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 */
575static void 575static void
576send_packet (struct GNUNET_MESH_Handle *h, 576send_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 */
586static void 586static void
587send_ack (struct GNUNET_MESH_Channel *ch) 587send_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 */
608static void 608static 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 */
619static void 619static void
620send_connect (struct GNUNET_MESH_Handle *h) 620send_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 */
659static int 659static int
660do_reconnect (struct GNUNET_MESH_Handle *h) 660do_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 */
709static void 709static void
710reconnect_cbk (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 710reconnect_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 */
729static void 729static void
730reconnect (struct GNUNET_MESH_Handle *h) 730reconnect (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 */
759static void 759static void
760process_channel_created (struct GNUNET_MESH_Handle *h, 760process_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 */
818static void 818static void
819process_channel_destroy (struct GNUNET_MESH_Handle *h, 819process_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 */
845static void 845static void
846process_incoming_data (struct GNUNET_MESH_Handle *h, 846process_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 */
915static void 915static void
916process_ack (struct GNUNET_MESH_Handle *h, 916process_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 */
1036static void 1036static void
1037process_get_peers (struct GNUNET_MESH_Handle *h, 1037process_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 */
1074static void 1074static void
1075process_get_peer (struct GNUNET_MESH_Handle *h, 1075process_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 */
1138static void 1138static void
1139process_get_tunnels (struct GNUNET_MESH_Handle *h, 1139process_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 */
1176static void 1176static void
1177process_get_tunnel (struct GNUNET_MESH_Handle *h, 1177process_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:
1240static void 1240static void
1241msg_received (void *cls, const struct GNUNET_MessageHeader *msg) 1241msg_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)
1329static size_t 1329static size_t
1330send_callback (void *cls, size_t size, void *buf) 1330send_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 */
1451static void 1451static void
1452send_packet (struct GNUNET_MESH_Handle *h, 1452send_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
1483struct GNUNET_MESH_Handle * 1483struct GNUNET_CADET_Handle *
1484GNUNET_MESH_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, void *cls, 1484GNUNET_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
1537void 1537void
1538GNUNET_MESH_disconnect (struct GNUNET_MESH_Handle *handle) 1538GNUNET_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 */
1623struct GNUNET_MESH_Channel * 1623struct GNUNET_CADET_Channel *
1624GNUNET_MESH_channel_create (struct GNUNET_MESH_Handle *h, 1624GNUNET_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
1653void 1653void
1654GNUNET_MESH_channel_destroy (struct GNUNET_MESH_Channel *channel) 1654GNUNET_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 */
1701const union GNUNET_MESH_ChannelInfo * 1701const union GNUNET_CADET_ChannelInfo *
1702GNUNET_MESH_channel_get_info (struct GNUNET_MESH_Channel *channel, 1702GNUNET_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
1730struct GNUNET_MESH_TransmitHandle * 1730struct GNUNET_CADET_TransmitHandle *
1731GNUNET_MESH_notify_transmit_ready (struct GNUNET_MESH_Channel *channel, int cork, 1731GNUNET_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
1774void 1774void
1775GNUNET_MESH_notify_transmit_ready_cancel (struct GNUNET_MESH_TransmitHandle *th) 1775GNUNET_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
1794void 1794void
1795GNUNET_MESH_receive_done (struct GNUNET_MESH_Channel *channel) 1795GNUNET_CADET_receive_done (struct GNUNET_CADET_Channel *channel)
1796{ 1796{
1797 send_ack (channel); 1797 send_ack (channel);
1798} 1798}
1799 1799
1800 1800
1801static void 1801static void
1802send_info_request (struct GNUNET_MESH_Handle *h, uint16_t type) 1802send_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 */
1826int 1826int
1827GNUNET_MESH_get_peers (struct GNUNET_MESH_Handle *h, 1827GNUNET_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 */
1852void * 1852void *
1853GNUNET_MESH_get_peers_cancel (struct GNUNET_MESH_Handle *h) 1853GNUNET_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 */
1878int 1878int
1879GNUNET_MESH_get_peer (struct GNUNET_MESH_Handle *h, 1879GNUNET_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 */
1916int 1916int
1917GNUNET_MESH_get_tunnels (struct GNUNET_MESH_Handle *h, 1917GNUNET_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 */
1940void * 1940void *
1941GNUNET_MESH_get_tunnels_cancel (struct GNUNET_MESH_Handle *h) 1941GNUNET_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 */
1968int 1968int
1969GNUNET_MESH_get_tunnel (struct GNUNET_MESH_Handle *h, 1969GNUNET_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 */
2007int 2007int
2008GNUNET_MESH_show_channel (struct GNUNET_MESH_Handle *h, 2008GNUNET_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 */
2045static size_t 2045static size_t
2046mesh_mq_ntr (void *cls, size_t size, 2046cadet_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 */
2076static void 2076static void
2077mesh_mq_send_impl (struct GNUNET_MQ_Handle *mq, 2077cadet_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 */
2103static void 2103static void
2104mesh_mq_destroy_impl (struct GNUNET_MQ_Handle *mq, void *impl_state) 2104cadet_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 */
2123struct GNUNET_MQ_Handle * 2123struct GNUNET_MQ_Handle *
2124GNUNET_MESH_mq_create (struct GNUNET_MESH_Channel *channel) 2124GNUNET_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 */
diff --git a/src/mesh/mesh_common.c b/src/mesh/mesh_common.c
index 242d9fab8..855e9e20c 100644
--- a/src/mesh/mesh_common.c
+++ b/src/mesh/mesh_common.c
@@ -19,12 +19,12 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file mesh/mesh_common.c 22 * @file cadet/cadet_common.c
23 * @brief MESH helper functions 23 * @brief CADET helper functions
24 * @author Bartlomiej Polot 24 * @author Bartlomiej Polot
25 */ 25 */
26 26
27#include "mesh.h" 27#include "cadet.h"
28 28
29/** 29/**
30 * @brief Translate a fwd variable into a string representation, for logging. 30 * @brief Translate a fwd variable into a string representation, for logging.
@@ -78,7 +78,7 @@ GM_min_pid (uint32_t a, uint32_t b)
78 78
79 79
80const struct GNUNET_HashCode * 80const struct GNUNET_HashCode *
81GM_h2hc (const struct GNUNET_MESH_Hash *id) 81GM_h2hc (const struct GNUNET_CADET_Hash *id)
82{ 82{
83 static struct GNUNET_HashCode hc; 83 static struct GNUNET_HashCode hc;
84 memcpy (&hc, id, sizeof (*id)); 84 memcpy (&hc, id, sizeof (*id));
@@ -88,7 +88,7 @@ GM_h2hc (const struct GNUNET_MESH_Hash *id)
88 88
89 89
90const char * 90const char *
91GM_h2s (const struct GNUNET_MESH_Hash *id) 91GM_h2s (const struct GNUNET_CADET_Hash *id)
92{ 92{
93 static char s[53]; 93 static char s[53];
94 94
@@ -111,217 +111,217 @@ GM_m2s (uint16_t m)
111 /** 111 /**
112 * Request the creation of a path 112 * Request the creation of a path
113 */ 113 */
114 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE: 114 case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE:
115 t = "CONNECTION_CREATE"; 115 t = "CONNECTION_CREATE";
116 break; 116 break;
117 117
118 /** 118 /**
119 * Request the modification of an existing path 119 * Request the modification of an existing path
120 */ 120 */
121 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK: 121 case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK:
122 t = "CONNECTION_ACK"; 122 t = "CONNECTION_ACK";
123 break; 123 break;
124 124
125 /** 125 /**
126 * Notify that a connection of a path is no longer valid 126 * Notify that a connection of a path is no longer valid
127 */ 127 */
128 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN: 128 case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN:
129 t = "CONNECTION_BROKEN"; 129 t = "CONNECTION_BROKEN";
130 break; 130 break;
131 131
132 /** 132 /**
133 * At some point, the route will spontaneously change 133 * At some point, the route will spontaneously change
134 */ 134 */
135 case GNUNET_MESSAGE_TYPE_MESH_PATH_CHANGED: 135 case GNUNET_MESSAGE_TYPE_CADET_PATH_CHANGED:
136 t = "PATH_CHANGED"; 136 t = "PATH_CHANGED";
137 break; 137 break;
138 138
139 /** 139 /**
140 * Transport payload data. 140 * Transport payload data.
141 */ 141 */
142 case GNUNET_MESSAGE_TYPE_MESH_DATA: 142 case GNUNET_MESSAGE_TYPE_CADET_DATA:
143 t = "DATA"; 143 t = "DATA";
144 break; 144 break;
145 145
146 /** 146 /**
147 * Confirm receipt of payload data. 147 * Confirm receipt of payload data.
148 */ 148 */
149 case GNUNET_MESSAGE_TYPE_MESH_DATA_ACK: 149 case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK:
150 t = "DATA_ACK"; 150 t = "DATA_ACK";
151 break; 151 break;
152 152
153 /** 153 /**
154 * Key exchange encapsulation. 154 * Key exchange encapsulation.
155 */ 155 */
156 case GNUNET_MESSAGE_TYPE_MESH_KX: 156 case GNUNET_MESSAGE_TYPE_CADET_KX:
157 t = "KX"; 157 t = "KX";
158 break; 158 break;
159 159
160 /** 160 /**
161 * New ephemeral key. 161 * New ephemeral key.
162 */ 162 */
163 case GNUNET_MESSAGE_TYPE_MESH_KX_EPHEMERAL: 163 case GNUNET_MESSAGE_TYPE_CADET_KX_EPHEMERAL:
164 t = "KX_EPHEMERAL"; 164 t = "KX_EPHEMERAL";
165 break; 165 break;
166 166
167 /** 167 /**
168 * Challenge to test peer's session key. 168 * Challenge to test peer's session key.
169 */ 169 */
170 case GNUNET_MESSAGE_TYPE_MESH_KX_PING: 170 case GNUNET_MESSAGE_TYPE_CADET_KX_PING:
171 t = "KX_PING"; 171 t = "KX_PING";
172 break; 172 break;
173 173
174 /** 174 /**
175 * Answer to session key challenge. 175 * Answer to session key challenge.
176 */ 176 */
177 case GNUNET_MESSAGE_TYPE_MESH_KX_PONG: 177 case GNUNET_MESSAGE_TYPE_CADET_KX_PONG:
178 t = "KX_PONG"; 178 t = "KX_PONG";
179 break; 179 break;
180 180
181 /** 181 /**
182 * Request the destuction of a path 182 * Request the destuction of a path
183 */ 183 */
184 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY: 184 case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY:
185 t = "CONNECTION_DESTROY"; 185 t = "CONNECTION_DESTROY";
186 break; 186 break;
187 187
188 /** 188 /**
189 * ACK for a data packet. 189 * ACK for a data packet.
190 */ 190 */
191 case GNUNET_MESSAGE_TYPE_MESH_ACK: 191 case GNUNET_MESSAGE_TYPE_CADET_ACK:
192 t = "ACK"; 192 t = "ACK";
193 break; 193 break;
194 194
195 /** 195 /**
196 * POLL for ACK. 196 * POLL for ACK.
197 */ 197 */
198 case GNUNET_MESSAGE_TYPE_MESH_POLL: 198 case GNUNET_MESSAGE_TYPE_CADET_POLL:
199 t = "POLL"; 199 t = "POLL";
200 break; 200 break;
201 201
202 /** 202 /**
203 * Announce origin is still alive. 203 * Announce origin is still alive.
204 */ 204 */
205 case GNUNET_MESSAGE_TYPE_MESH_KEEPALIVE: 205 case GNUNET_MESSAGE_TYPE_CADET_KEEPALIVE:
206 t = "KEEPALIVE"; 206 t = "KEEPALIVE";
207 break; 207 break;
208 208
209 /** 209 /**
210 * Connect to the mesh service, specifying subscriptions 210 * Connect to the cadet service, specifying subscriptions
211 */ 211 */
212 case GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT: 212 case GNUNET_MESSAGE_TYPE_CADET_LOCAL_CONNECT:
213 t = "LOCAL_CONNECT"; 213 t = "LOCAL_CONNECT";
214 break; 214 break;
215 215
216 /** 216 /**
217 * Ask the mesh service to create a new tunnel 217 * Ask the cadet service to create a new tunnel
218 */ 218 */
219 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE: 219 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE:
220 t = "CHANNEL_CREATE"; 220 t = "CHANNEL_CREATE";
221 break; 221 break;
222 222
223 /** 223 /**
224 * Ask the mesh service to destroy a tunnel 224 * Ask the cadet service to destroy a tunnel
225 */ 225 */
226 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY: 226 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY:
227 t = "CHANNEL_DESTROY"; 227 t = "CHANNEL_DESTROY";
228 break; 228 break;
229 229
230 /** 230 /**
231 * Confirm the creation of a channel. 231 * Confirm the creation of a channel.
232 */ 232 */
233 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK: 233 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK:
234 t = "CHANNEL_ACK"; 234 t = "CHANNEL_ACK";
235 break; 235 break;
236 236
237 /** 237 /**
238 * Confirm the creation of a channel. 238 * Confirm the creation of a channel.
239 */ 239 */
240 case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_NACK: 240 case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK:
241 t = "CHANNEL_NACK"; 241 t = "CHANNEL_NACK";
242 break; 242 break;
243 243
244 /** 244 /**
245 * Encrypted payload. 245 * Encrypted payload.
246 */ 246 */
247 case GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED: 247 case GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED:
248 t = "ENCRYPTED"; 248 t = "ENCRYPTED";
249 break; 249 break;
250 250
251 /** 251 /**
252 * Local payload traffic 252 * Local payload traffic
253 */ 253 */
254 case GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA: 254 case GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA:
255 t = "LOCAL_DATA"; 255 t = "LOCAL_DATA";
256 break; 256 break;
257 257
258 /** 258 /**
259 * Local ACK for data. 259 * Local ACK for data.
260 */ 260 */
261 case GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK: 261 case GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK:
262 t = "LOCAL_ACK"; 262 t = "LOCAL_ACK";
263 break; 263 break;
264 264
265 /** 265 /**
266 * Local monitoring of channels. 266 * Local monitoring of channels.
267 */ 267 */
268 case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_CHANNELS: 268 case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CHANNELS:
269 t = "LOCAL_INFO_CHANNELS"; 269 t = "LOCAL_INFO_CHANNELS";
270 break; 270 break;
271 271
272 /** 272 /**
273 * Local monitoring of a channel. 273 * Local monitoring of a channel.
274 */ 274 */
275 case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_CHANNEL: 275 case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CHANNEL:
276 t = "LOCAL_INFO_CHANNEL"; 276 t = "LOCAL_INFO_CHANNEL";
277 break; 277 break;
278 278
279 /** 279 /**
280 * Local monitoring of service. 280 * Local monitoring of service.
281 */ 281 */
282 case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS: 282 case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS:
283 t = "LOCAL_INFO_TUNNELS"; 283 t = "LOCAL_INFO_TUNNELS";
284 break; 284 break;
285 285
286 /** 286 /**
287 * Local monitoring of service. 287 * Local monitoring of service.
288 */ 288 */
289 case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNEL: 289 case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL:
290 t = "LOCAL_INFO_TUNNEL"; 290 t = "LOCAL_INFO_TUNNEL";
291 break; 291 break;
292 292
293 /** 293 /**
294 * Local information about all connections of service. 294 * Local information about all connections of service.
295 */ 295 */
296 case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_CONNECTIONS: 296 case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CONNECTIONS:
297 t = "LOCAL_INFO_CONNECTIONS"; 297 t = "LOCAL_INFO_CONNECTIONS";
298 break; 298 break;
299 299
300 /** 300 /**
301 * Local information of service about a specific connection. 301 * Local information of service about a specific connection.
302 */ 302 */
303 case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_CONNECTION: 303 case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CONNECTION:
304 t = "LOCAL_INFO_CONNECTION"; 304 t = "LOCAL_INFO_CONNECTION";
305 break; 305 break;
306 306
307 /** 307 /**
308 * Local information about all peers known to the service. 308 * Local information about all peers known to the service.
309 */ 309 */
310 case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_PEERS: 310 case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS:
311 t = "LOCAL_INFO_PEERS"; 311 t = "LOCAL_INFO_PEERS";
312 break; 312 break;
313 313
314 /** 314 /**
315 * Local information of service about a specific peer. 315 * Local information of service about a specific peer.
316 */ 316 */
317 case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_PEER: 317 case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER:
318 t = "LOCAL_INFO_PEER"; 318 t = "LOCAL_INFO_PEER";
319 break; 319 break;
320 320
321 /** 321 /**
322 * Traffic (net-cat style) used by the Command Line Interface. 322 * Traffic (net-cat style) used by the Command Line Interface.
323 */ 323 */
324 case GNUNET_MESSAGE_TYPE_MESH_CLI: 324 case GNUNET_MESSAGE_TYPE_CADET_CLI:
325 t = "CLI"; 325 t = "CLI";
326 break; 326 break;
327 327
diff --git a/src/mesh/mesh_path.c b/src/mesh/mesh_path.c
index 42f26ddf1..0a97e73ef 100644
--- a/src/mesh/mesh_path.c
+++ b/src/mesh/mesh_path.c
@@ -19,14 +19,14 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file mesh/mesh_path.c 22 * @file cadet/cadet_path.c
23 * @brief Path handling functions 23 * @brief Path handling functions
24 * @author Bartlomiej Polot 24 * @author Bartlomiej Polot
25 */ 25 */
26 26
27#include "mesh.h" 27#include "cadet.h"
28#include "mesh_path.h" 28#include "cadet_path.h"
29#include "gnunet-service-mesh_peer.h" 29#include "gnunet-service-cadet_peer.h"
30 30
31/** 31/**
32 * @brief Destroy a path after some time has past. 32 * @brief Destroy a path after some time has past.
@@ -39,8 +39,8 @@
39static void 39static void
40path_destroy_delayed (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 40path_destroy_delayed (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
41{ 41{
42 struct MeshPeerPath *path = cls; 42 struct CadetPeerPath *path = cls;
43 struct MeshPeer *peer; 43 struct CadetPeer *peer;
44 44
45 path->path_delete = GNUNET_SCHEDULER_NO_TASK; 45 path->path_delete = GNUNET_SCHEDULER_NO_TASK;
46 peer = GMP_get_short (path->peers[path->length - 1]); 46 peer = GMP_get_short (path->peers[path->length - 1]);
@@ -55,12 +55,12 @@ path_destroy_delayed (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
55 * 55 *
56 * @return A newly allocated path with a peer array of the specified length. 56 * @return A newly allocated path with a peer array of the specified length.
57 */ 57 */
58struct MeshPeerPath * 58struct CadetPeerPath *
59path_new (unsigned int length) 59path_new (unsigned int length)
60{ 60{
61 struct MeshPeerPath *p; 61 struct CadetPeerPath *p;
62 62
63 p = GNUNET_new (struct MeshPeerPath); 63 p = GNUNET_new (struct CadetPeerPath);
64 if (length > 0) 64 if (length > 0)
65 { 65 {
66 p->length = length; 66 p->length = length;
@@ -76,7 +76,7 @@ path_new (unsigned int length)
76 * @param path the path to invert 76 * @param path the path to invert
77 */ 77 */
78void 78void
79path_invert (struct MeshPeerPath *path) 79path_invert (struct CadetPeerPath *path)
80{ 80{
81 GNUNET_PEER_Id aux; 81 GNUNET_PEER_Id aux;
82 unsigned int i; 82 unsigned int i;
@@ -95,10 +95,10 @@ path_invert (struct MeshPeerPath *path)
95 * 95 *
96 * @param path The path to duplicate. 96 * @param path The path to duplicate.
97 */ 97 */
98struct MeshPeerPath * 98struct CadetPeerPath *
99path_duplicate (const struct MeshPeerPath *path) 99path_duplicate (const struct CadetPeerPath *path)
100{ 100{
101 struct MeshPeerPath *aux; 101 struct CadetPeerPath *aux;
102 unsigned int i; 102 unsigned int i;
103 103
104 aux = path_new (path->length); 104 aux = path_new (path->length);
@@ -118,7 +118,7 @@ path_duplicate (const struct MeshPeerPath *path)
118 * UINT_MAX in case the peer is not in the path. 118 * UINT_MAX in case the peer is not in the path.
119 */ 119 */
120unsigned int 120unsigned int
121path_get_length (struct MeshPeerPath *path) 121path_get_length (struct CadetPeerPath *path)
122{ 122{
123 if (NULL == path) 123 if (NULL == path)
124 return UINT_MAX; 124 return UINT_MAX;
@@ -136,7 +136,7 @@ path_get_length (struct MeshPeerPath *path)
136 * @param p Path to invalidate. 136 * @param p Path to invalidate.
137 */ 137 */
138void 138void
139path_invalidate (struct MeshPeerPath *p) 139path_invalidate (struct CadetPeerPath *p)
140{ 140{
141 if (GNUNET_SCHEDULER_NO_TASK != p->path_delete) 141 if (GNUNET_SCHEDULER_NO_TASK != p->path_delete)
142 return; 142 return;
@@ -155,7 +155,7 @@ path_invalidate (struct MeshPeerPath *p)
155 * #GNUNET_NO If the path is known to be invalid. 155 * #GNUNET_NO If the path is known to be invalid.
156 */ 156 */
157int 157int
158path_is_valid (const struct MeshPeerPath *path) 158path_is_valid (const struct CadetPeerPath *path)
159{ 159{
160 return (GNUNET_SCHEDULER_NO_TASK == path->path_delete); 160 return (GNUNET_SCHEDULER_NO_TASK == path->path_delete);
161} 161}
@@ -169,7 +169,7 @@ path_is_valid (const struct MeshPeerPath *path)
169 * @return GNUNET_OK on success 169 * @return GNUNET_OK on success
170 */ 170 */
171int 171int
172path_destroy (struct MeshPeerPath *p) 172path_destroy (struct CadetPeerPath *p)
173{ 173{
174 if (NULL == p) 174 if (NULL == p)
175 return GNUNET_OK; 175 return GNUNET_OK;
@@ -183,7 +183,7 @@ path_destroy (struct MeshPeerPath *p)
183} 183}
184 184
185char * 185char *
186path_2s (struct MeshPeerPath *p) 186path_2s (struct CadetPeerPath *p)
187{ 187{
188 char *s; 188 char *s;
189 char *old; 189 char *old;
@@ -201,7 +201,7 @@ path_2s (struct MeshPeerPath *p)
201} 201}
202 202
203void 203void
204path_debug (struct MeshPeerPath *p) 204path_debug (struct CadetPeerPath *p)
205{ 205{
206 unsigned int i; 206 unsigned int i;
207 207
diff --git a/src/mesh/mesh_path.h b/src/mesh/mesh_path.h
index bba11e9d4..36bcfa5ae 100644
--- a/src/mesh/mesh_path.h
+++ b/src/mesh/mesh_path.h
@@ -19,15 +19,15 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file mesh/mesh_path.h 22 * @file cadet/cadet_path.h
23 * @brief Path handling functions 23 * @brief Path handling functions
24 * @author Bartlomiej Polot 24 * @author Bartlomiej Polot
25 */ 25 */
26 26
27#include "gnunet-service-mesh_connection.h" 27#include "gnunet-service-cadet_connection.h"
28 28
29#ifndef MESH_PATH_H_ 29#ifndef CADET_PATH_H_
30#define MESH_PATH_H_ 30#define CADET_PATH_H_
31 31
32#ifdef __cplusplus 32#ifdef __cplusplus
33extern "C" 33extern "C"
@@ -44,14 +44,14 @@ extern "C"
44/** 44/**
45 * Information regarding a possible path to reach a single peer 45 * Information regarding a possible path to reach a single peer
46 */ 46 */
47struct MeshPeerPath 47struct CadetPeerPath
48{ 48{
49 49
50 /** 50 /**
51 * Linked list 51 * Linked list
52 */ 52 */
53 struct MeshPeerPath *next; 53 struct CadetPeerPath *next;
54 struct MeshPeerPath *prev; 54 struct CadetPeerPath *prev;
55 55
56 /** 56 /**
57 * List of all the peers that form the path from origin to target. 57 * List of all the peers that form the path from origin to target.
@@ -66,7 +66,7 @@ struct MeshPeerPath
66 /** 66 /**
67 * User defined data store. 67 * User defined data store.
68 */ 68 */
69 struct MeshConnection *c; 69 struct CadetConnection *c;
70 70
71 /** 71 /**
72 * Path's score, how reliable is the path. 72 * Path's score, how reliable is the path.
@@ -92,7 +92,7 @@ struct MeshPeerPath
92 * 92 *
93 * @return A newly allocated path with a peer array of the specified length. 93 * @return A newly allocated path with a peer array of the specified length.
94 */ 94 */
95struct MeshPeerPath * 95struct CadetPeerPath *
96path_new (unsigned int length); 96path_new (unsigned int length);
97 97
98 98
@@ -102,7 +102,7 @@ path_new (unsigned int length);
102 * @param path The path to invert. 102 * @param path The path to invert.
103 */ 103 */
104void 104void
105path_invert (struct MeshPeerPath *path); 105path_invert (struct CadetPeerPath *path);
106 106
107 107
108/** 108/**
@@ -110,8 +110,8 @@ path_invert (struct MeshPeerPath *path);
110 * 110 *
111 * @param path The path to duplicate. 111 * @param path The path to duplicate.
112 */ 112 */
113struct MeshPeerPath * 113struct CadetPeerPath *
114path_duplicate (const struct MeshPeerPath *path); 114path_duplicate (const struct CadetPeerPath *path);
115 115
116 116
117/** 117/**
@@ -123,7 +123,7 @@ path_duplicate (const struct MeshPeerPath *path);
123 * UINT_MAX in case the peer is not in the path. 123 * UINT_MAX in case the peer is not in the path.
124 */ 124 */
125unsigned int 125unsigned int
126path_get_length (struct MeshPeerPath *path); 126path_get_length (struct CadetPeerPath *path);
127 127
128/** 128/**
129 * Mark path as invalid: keep it aroud for a while to avoid trying it in a loop. 129 * Mark path as invalid: keep it aroud for a while to avoid trying it in a loop.
@@ -134,7 +134,7 @@ path_get_length (struct MeshPeerPath *path);
134 * @param p Path to invalidate. 134 * @param p Path to invalidate.
135 */ 135 */
136void 136void
137path_invalidate (struct MeshPeerPath *p); 137path_invalidate (struct CadetPeerPath *p);
138 138
139/** 139/**
140 * Test if a path is valid (or at least not known to be invalid). 140 * Test if a path is valid (or at least not known to be invalid).
@@ -145,7 +145,7 @@ path_invalidate (struct MeshPeerPath *p);
145 * #GNUNET_NO If the path is known to be invalid. 145 * #GNUNET_NO If the path is known to be invalid.
146 */ 146 */
147int 147int
148path_is_valid (const struct MeshPeerPath *path); 148path_is_valid (const struct CadetPeerPath *path);
149 149
150/** 150/**
151 * Destroy the path and free any allocated resources linked to it 151 * Destroy the path and free any allocated resources linked to it
@@ -155,7 +155,7 @@ path_is_valid (const struct MeshPeerPath *path);
155 * @return GNUNET_OK on success 155 * @return GNUNET_OK on success
156 */ 156 */
157int 157int
158path_destroy (struct MeshPeerPath *p); 158path_destroy (struct CadetPeerPath *p);
159 159
160/** 160/**
161 * Path -> allocated one line string. Caller must free. 161 * Path -> allocated one line string. Caller must free.
@@ -163,7 +163,7 @@ path_destroy (struct MeshPeerPath *p);
163 * @param p Path. 163 * @param p Path.
164 */ 164 */
165char * 165char *
166path_2s (struct MeshPeerPath *p); 166path_2s (struct CadetPeerPath *p);
167 167
168/** 168/**
169 * Print info about the path for debug. 169 * Print info about the path for debug.
@@ -171,7 +171,7 @@ path_2s (struct MeshPeerPath *p);
171 * @param p Path to debug. 171 * @param p Path to debug.
172 */ 172 */
173void 173void
174path_debug (struct MeshPeerPath *p); 174path_debug (struct CadetPeerPath *p);
175 175
176#if 0 /* keep Emacsens' auto-indent happy */ 176#if 0 /* keep Emacsens' auto-indent happy */
177{ 177{
@@ -181,5 +181,5 @@ path_debug (struct MeshPeerPath *p);
181#endif 181#endif
182 182
183 183
184/* ifndef MESH_PATH_H */ 184/* ifndef CADET_PATH_H */
185#endif 185#endif
diff --git a/src/mesh/mesh_protocol.h b/src/mesh/mesh_protocol.h
index 8decab96f..19cdfe4a0 100644
--- a/src/mesh/mesh_protocol.h
+++ b/src/mesh/mesh_protocol.h
@@ -20,19 +20,19 @@
20 20
21/** 21/**
22 * @author Bartlomiej Polot 22 * @author Bartlomiej Polot
23 * @file mesh/mesh_protocol.h 23 * @file cadet/cadet_protocol.h
24 */ 24 */
25 25
26#ifndef MESH_PROTOCOL_H_ 26#ifndef CADET_PROTOCOL_H_
27#define MESH_PROTOCOL_H_ 27#define CADET_PROTOCOL_H_
28 28
29#include "platform.h" 29#include "platform.h"
30#include "gnunet_util_lib.h" 30#include "gnunet_util_lib.h"
31#include "mesh.h" 31#include "cadet.h"
32 32
33#ifdef __cplusplus 33#ifdef __cplusplus
34 34
35struct GNUNET_MESH_TunnelMessage; 35struct GNUNET_CADET_TunnelMessage;
36extern "C" 36extern "C"
37{ 37{
38#if 0 38#if 0
@@ -42,20 +42,20 @@ extern "C"
42#endif 42#endif
43 43
44/******************************************************************************/ 44/******************************************************************************/
45/******************** MESH NETWORK MESSAGES **************************/ 45/******************** CADET NETWORK MESSAGES **************************/
46/******************************************************************************/ 46/******************************************************************************/
47 47
48GNUNET_NETWORK_STRUCT_BEGIN 48GNUNET_NETWORK_STRUCT_BEGIN
49 49
50/** 50/**
51 * Message for mesh connection creation. 51 * Message for cadet connection creation.
52 */ 52 */
53struct GNUNET_MESH_ConnectionCreate 53struct GNUNET_CADET_ConnectionCreate
54{ 54{
55 /** 55 /**
56 * Type: GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE 56 * Type: GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE
57 * 57 *
58 * Size: sizeof (struct GNUNET_MESH_ConnectionCreate) + 58 * Size: sizeof (struct GNUNET_CADET_ConnectionCreate) +
59 * path_length * sizeof (struct GNUNET_PeerIdentity) 59 * path_length * sizeof (struct GNUNET_PeerIdentity)
60 */ 60 */
61 struct GNUNET_MessageHeader header; 61 struct GNUNET_MessageHeader header;
@@ -63,7 +63,7 @@ struct GNUNET_MESH_ConnectionCreate
63 /** 63 /**
64 * ID of the connection 64 * ID of the connection
65 */ 65 */
66 struct GNUNET_MESH_Hash cid; 66 struct GNUNET_CADET_Hash cid;
67 67
68 /** 68 /**
69 * path_length structs defining the *whole* path from the origin [0] to the 69 * path_length structs defining the *whole* path from the origin [0] to the
@@ -75,17 +75,17 @@ struct GNUNET_MESH_ConnectionCreate
75/** 75/**
76 * Message for ack'ing a connection 76 * Message for ack'ing a connection
77 */ 77 */
78struct GNUNET_MESH_ConnectionACK 78struct GNUNET_CADET_ConnectionACK
79{ 79{
80 /** 80 /**
81 * Type: GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK 81 * Type: GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK
82 */ 82 */
83 struct GNUNET_MessageHeader header; 83 struct GNUNET_MessageHeader header;
84 84
85 /** 85 /**
86 * ID of the connection. 86 * ID of the connection.
87 */ 87 */
88 struct GNUNET_MESH_Hash cid; 88 struct GNUNET_CADET_Hash cid;
89 89
90}; 90};
91 91
@@ -93,17 +93,17 @@ struct GNUNET_MESH_ConnectionACK
93/** 93/**
94 * Message for encapsulation of a Key eXchange message in a connection. 94 * Message for encapsulation of a Key eXchange message in a connection.
95 */ 95 */
96struct GNUNET_MESH_KX 96struct GNUNET_CADET_KX
97{ 97{
98 /** 98 /**
99 * Type: GNUNET_MESSAGE_TYPE_MESH_KX. 99 * Type: GNUNET_MESSAGE_TYPE_CADET_KX.
100 */ 100 */
101 struct GNUNET_MessageHeader header; 101 struct GNUNET_MessageHeader header;
102 102
103 /** 103 /**
104 * ID of the connection. 104 * ID of the connection.
105 */ 105 */
106 struct GNUNET_MESH_Hash cid; 106 struct GNUNET_CADET_Hash cid;
107 107
108 /* Specific KX message follows. */ 108 /* Specific KX message follows. */
109}; 109};
@@ -115,11 +115,11 @@ struct GNUNET_MESH_KX
115 * 115 *
116 * As far as possible, same as CORE's EphemeralKeyMessage. 116 * As far as possible, same as CORE's EphemeralKeyMessage.
117 */ 117 */
118struct GNUNET_MESH_KX_Ephemeral 118struct GNUNET_CADET_KX_Ephemeral
119{ 119{
120 120
121 /** 121 /**
122 * Message type is GNUNET_MESSAGE_TYPE_MESH_KX_EPHEMERAL. 122 * Message type is GNUNET_MESSAGE_TYPE_CADET_KX_EPHEMERAL.
123 */ 123 */
124 struct GNUNET_MessageHeader header; 124 struct GNUNET_MessageHeader header;
125 125
@@ -167,10 +167,10 @@ struct GNUNET_MESH_KX_Ephemeral
167 * can decrypt. The other peer should respond with a PONG with the 167 * can decrypt. The other peer should respond with a PONG with the
168 * same content, except this time encrypted with the receiver's key. 168 * same content, except this time encrypted with the receiver's key.
169 */ 169 */
170struct GNUNET_MESH_KX_Ping 170struct GNUNET_CADET_KX_Ping
171{ 171{
172 /** 172 /**
173 * Message type is GNUNET_MESSAGE_TYPE_MESH_KX_PING. 173 * Message type is GNUNET_MESSAGE_TYPE_CADET_KX_PING.
174 */ 174 */
175 struct GNUNET_MessageHeader header; 175 struct GNUNET_MessageHeader header;
176 176
@@ -195,10 +195,10 @@ struct GNUNET_MESH_KX_Ping
195/** 195/**
196 * Response to a PING. Includes data from the original PING. 196 * Response to a PING. Includes data from the original PING.
197 */ 197 */
198struct GNUNET_MESH_KX_Pong 198struct GNUNET_CADET_KX_Pong
199{ 199{
200 /** 200 /**
201 * Message type is GNUNET_MESSAGE_TYPE_MESH_KX_PONG. 201 * Message type is GNUNET_MESSAGE_TYPE_CADET_KX_PONG.
202 */ 202 */
203 struct GNUNET_MessageHeader header; 203 struct GNUNET_MessageHeader header;
204 204
@@ -217,17 +217,17 @@ struct GNUNET_MESH_KX_Pong
217/** 217/**
218 * Tunnel(ed) message. 218 * Tunnel(ed) message.
219 */ 219 */
220struct GNUNET_MESH_Encrypted 220struct GNUNET_CADET_Encrypted
221{ 221{
222 /** 222 /**
223 * Type: GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED 223 * Type: GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED
224 */ 224 */
225 struct GNUNET_MessageHeader header; 225 struct GNUNET_MessageHeader header;
226 226
227 /** 227 /**
228 * ID of the connection. 228 * ID of the connection.
229 */ 229 */
230 struct GNUNET_MESH_Hash cid; 230 struct GNUNET_CADET_Hash cid;
231 231
232 /** 232 /**
233 * ID of the packet (hop by hop). 233 * ID of the packet (hop by hop).
@@ -248,7 +248,7 @@ struct GNUNET_MESH_Encrypted
248 * MAC of the encrypted message, used to verify message integrity. 248 * MAC of the encrypted message, used to verify message integrity.
249 * Everything after this value will be encrypted and authenticated. 249 * Everything after this value will be encrypted and authenticated.
250 */ 250 */
251 struct GNUNET_MESH_Hash hmac; 251 struct GNUNET_CADET_Hash hmac;
252 252
253 /** 253 /**
254 * Encrypted content follows. 254 * Encrypted content follows.
@@ -259,17 +259,17 @@ struct GNUNET_MESH_Encrypted
259/** 259/**
260 * Message to create a Channel. 260 * Message to create a Channel.
261 */ 261 */
262struct GNUNET_MESH_ChannelCreate 262struct GNUNET_CADET_ChannelCreate
263{ 263{
264 /** 264 /**
265 * Type: GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE 265 * Type: GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE
266 */ 266 */
267 struct GNUNET_MessageHeader header; 267 struct GNUNET_MessageHeader header;
268 268
269 /** 269 /**
270 * ID of the channel 270 * ID of the channel
271 */ 271 */
272 MESH_ChannelNumber chid GNUNET_PACKED; 272 CADET_ChannelNumber chid GNUNET_PACKED;
273 273
274 /** 274 /**
275 * Destination port. 275 * Destination port.
@@ -286,28 +286,28 @@ struct GNUNET_MESH_ChannelCreate
286/** 286/**
287 * Message to manage a Channel (ACK, NACK, Destroy). 287 * Message to manage a Channel (ACK, NACK, Destroy).
288 */ 288 */
289struct GNUNET_MESH_ChannelManage 289struct GNUNET_CADET_ChannelManage
290{ 290{
291 /** 291 /**
292 * Type: GNUNET_MESSAGE_TYPE_MESH_CHANNEL_{ACK|NACK|DESTROY} 292 * Type: GNUNET_MESSAGE_TYPE_CADET_CHANNEL_{ACK|NACK|DESTROY}
293 */ 293 */
294 struct GNUNET_MessageHeader header; 294 struct GNUNET_MessageHeader header;
295 295
296 /** 296 /**
297 * ID of the channel 297 * ID of the channel
298 */ 298 */
299 MESH_ChannelNumber chid GNUNET_PACKED; 299 CADET_ChannelNumber chid GNUNET_PACKED;
300}; 300};
301 301
302 302
303/** 303/**
304 * Message for mesh data traffic. 304 * Message for cadet data traffic.
305 */ 305 */
306struct GNUNET_MESH_Data 306struct GNUNET_CADET_Data
307{ 307{
308 /** 308 /**
309 * Type: GNUNET_MESSAGE_TYPE_MESH_UNICAST, 309 * Type: GNUNET_MESSAGE_TYPE_CADET_UNICAST,
310 * GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN 310 * GNUNET_MESSAGE_TYPE_CADET_TO_ORIGIN
311 */ 311 */
312 struct GNUNET_MessageHeader header; 312 struct GNUNET_MessageHeader header;
313 313
@@ -319,7 +319,7 @@ struct GNUNET_MESH_Data
319 /** 319 /**
320 * ID of the channel 320 * ID of the channel
321 */ 321 */
322 MESH_ChannelNumber chid GNUNET_PACKED; 322 CADET_ChannelNumber chid GNUNET_PACKED;
323 323
324 /** 324 /**
325 * Payload follows 325 * Payload follows
@@ -330,17 +330,17 @@ struct GNUNET_MESH_Data
330/** 330/**
331 * Message to acknowledge end-to-end data. 331 * Message to acknowledge end-to-end data.
332 */ 332 */
333struct GNUNET_MESH_DataACK 333struct GNUNET_CADET_DataACK
334{ 334{
335 /** 335 /**
336 * Type: GNUNET_MESSAGE_TYPE_MESH_DATA_ACK 336 * Type: GNUNET_MESSAGE_TYPE_CADET_DATA_ACK
337 */ 337 */
338 struct GNUNET_MessageHeader header; 338 struct GNUNET_MessageHeader header;
339 339
340 /** 340 /**
341 * ID of the channel 341 * ID of the channel
342 */ 342 */
343 MESH_ChannelNumber chid GNUNET_PACKED; 343 CADET_ChannelNumber chid GNUNET_PACKED;
344 344
345 /** 345 /**
346 * Bitfield of already-received newer messages 346 * Bitfield of already-received newer messages
@@ -357,12 +357,12 @@ struct GNUNET_MESH_DataACK
357 357
358 358
359/** 359/**
360 * Message to acknowledge mesh encrypted traffic. 360 * Message to acknowledge cadet encrypted traffic.
361 */ 361 */
362struct GNUNET_MESH_ACK 362struct GNUNET_CADET_ACK
363{ 363{
364 /** 364 /**
365 * Type: GNUNET_MESSAGE_TYPE_MESH_ACK 365 * Type: GNUNET_MESSAGE_TYPE_CADET_ACK
366 */ 366 */
367 struct GNUNET_MessageHeader header; 367 struct GNUNET_MessageHeader header;
368 368
@@ -374,17 +374,17 @@ struct GNUNET_MESH_ACK
374 /** 374 /**
375 * ID of the connection. 375 * ID of the connection.
376 */ 376 */
377 struct GNUNET_MESH_Hash cid; 377 struct GNUNET_CADET_Hash cid;
378}; 378};
379 379
380 380
381/** 381/**
382 * Message to query a peer about its Flow Control status regarding a tunnel. 382 * Message to query a peer about its Flow Control status regarding a tunnel.
383 */ 383 */
384struct GNUNET_MESH_Poll 384struct GNUNET_CADET_Poll
385{ 385{
386 /** 386 /**
387 * Type: GNUNET_MESSAGE_TYPE_MESH_POLL 387 * Type: GNUNET_MESSAGE_TYPE_CADET_POLL
388 */ 388 */
389 struct GNUNET_MessageHeader header; 389 struct GNUNET_MessageHeader header;
390 390
@@ -396,7 +396,7 @@ struct GNUNET_MESH_Poll
396 /** 396 /**
397 * ID of the connection. 397 * ID of the connection.
398 */ 398 */
399 struct GNUNET_MESH_Hash cid; 399 struct GNUNET_CADET_Hash cid;
400 400
401}; 401};
402 402
@@ -404,17 +404,17 @@ struct GNUNET_MESH_Poll
404/** 404/**
405 * Message for notifying a disconnection in a path 405 * Message for notifying a disconnection in a path
406 */ 406 */
407struct GNUNET_MESH_ConnectionBroken 407struct GNUNET_CADET_ConnectionBroken
408{ 408{
409 /** 409 /**
410 * Type: GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN 410 * Type: GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN
411 */ 411 */
412 struct GNUNET_MessageHeader header; 412 struct GNUNET_MessageHeader header;
413 413
414 /** 414 /**
415 * ID of the connection. 415 * ID of the connection.
416 */ 416 */
417 struct GNUNET_MESH_Hash cid; 417 struct GNUNET_CADET_Hash cid;
418 418
419 /** 419 /**
420 * ID of the endpoint 420 * ID of the endpoint
@@ -431,17 +431,17 @@ struct GNUNET_MESH_ConnectionBroken
431/** 431/**
432 * Message to destroy a connection. 432 * Message to destroy a connection.
433 */ 433 */
434struct GNUNET_MESH_ConnectionDestroy 434struct GNUNET_CADET_ConnectionDestroy
435{ 435{
436 /** 436 /**
437 * Type: GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY 437 * Type: GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY
438 */ 438 */
439 struct GNUNET_MessageHeader header; 439 struct GNUNET_MessageHeader header;
440 440
441 /** 441 /**
442 * ID of the connection. 442 * ID of the connection.
443 */ 443 */
444 struct GNUNET_MESH_Hash cid; 444 struct GNUNET_CADET_Hash cid;
445}; 445};
446 446
447 447
@@ -454,6 +454,6 @@ GNUNET_NETWORK_STRUCT_END
454} 454}
455#endif 455#endif
456 456
457/* ifndef MESH_PROTOCOL_H */ 457/* ifndef CADET_PROTOCOL_H */
458#endif 458#endif
459/* end of mesh_protocol.h */ 459/* end of cadet_protocol.h */
diff --git a/src/mesh/mesh_test_lib.c b/src/mesh/mesh_test_lib.c
index 3fa73df4d..663972cad 100644
--- a/src/mesh/mesh_test_lib.c
+++ b/src/mesh/mesh_test_lib.c
@@ -18,19 +18,19 @@
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20/** 20/**
21 * @file mesh/mesh_test_lib.c 21 * @file cadet/cadet_test_lib.c
22 * @author Bartlomiej Polot 22 * @author Bartlomiej Polot
23 * @brief library for writing MESH tests 23 * @brief library for writing CADET tests
24 */ 24 */
25#include "platform.h" 25#include "platform.h"
26#include "gnunet_util_lib.h" 26#include "gnunet_util_lib.h"
27#include "mesh_test_lib.h" 27#include "cadet_test_lib.h"
28#include "gnunet_mesh_service.h" 28#include "gnunet_cadet_service.h"
29 29
30/** 30/**
31 * Test context for a MESH Test. 31 * Test context for a CADET Test.
32 */ 32 */
33struct GNUNET_MESH_TEST_Context 33struct GNUNET_CADET_TEST_Context
34{ 34{
35 /** 35 /**
36 * Array of running peers. 36 * Array of running peers.
@@ -38,19 +38,19 @@ struct GNUNET_MESH_TEST_Context
38 struct GNUNET_TESTBED_Peer **peers; 38 struct GNUNET_TESTBED_Peer **peers;
39 39
40 /** 40 /**
41 * Array of handles to the MESH for each peer. 41 * Array of handles to the CADET for each peer.
42 */ 42 */
43 struct GNUNET_MESH_Handle **meshes; 43 struct GNUNET_CADET_Handle **cadetes;
44 44
45 /** 45 /**
46 * Operation associated with the connection to the MESH. 46 * Operation associated with the connection to the CADET.
47 */ 47 */
48 struct GNUNET_TESTBED_Operation **ops; 48 struct GNUNET_TESTBED_Operation **ops;
49 49
50 /** 50 /**
51 * Main function of the test to run once all MESHs are available. 51 * Main function of the test to run once all CADETs are available.
52 */ 52 */
53 GNUNET_MESH_TEST_AppMain app_main; 53 GNUNET_CADET_TEST_AppMain app_main;
54 54
55 /** 55 /**
56 * Closure for 'app_main'. 56 * Closure for 'app_main'.
@@ -65,17 +65,17 @@ struct GNUNET_MESH_TEST_Context
65 /** 65 /**
66 * Handler for incoming tunnels. 66 * Handler for incoming tunnels.
67 */ 67 */
68 GNUNET_MESH_InboundChannelNotificationHandler *new_channel; 68 GNUNET_CADET_InboundChannelNotificationHandler *new_channel;
69 69
70 /** 70 /**
71 * Cleaner for destroyed incoming tunnels. 71 * Cleaner for destroyed incoming tunnels.
72 */ 72 */
73 GNUNET_MESH_ChannelEndHandler *cleaner; 73 GNUNET_CADET_ChannelEndHandler *cleaner;
74 74
75 /** 75 /**
76 * Message handlers. 76 * Message handlers.
77 */ 77 */
78 struct GNUNET_MESH_MessageHandler* handlers; 78 struct GNUNET_CADET_MessageHandler* handlers;
79 79
80 /** 80 /**
81 * Application ports. 81 * Application ports.
@@ -86,9 +86,9 @@ struct GNUNET_MESH_TEST_Context
86 86
87 87
88/** 88/**
89 * Context for a mesh adapter callback. 89 * Context for a cadet adapter callback.
90 */ 90 */
91struct GNUNET_MESH_TEST_AdapterContext 91struct GNUNET_CADET_TEST_AdapterContext
92{ 92{
93 /** 93 /**
94 * Peer number for the particular peer. 94 * Peer number for the particular peer.
@@ -98,13 +98,13 @@ struct GNUNET_MESH_TEST_AdapterContext
98 /** 98 /**
99 * General context. 99 * General context.
100 */ 100 */
101 struct GNUNET_MESH_TEST_Context *ctx; 101 struct GNUNET_CADET_TEST_Context *ctx;
102}; 102};
103 103
104 104
105/** 105/**
106 * Adapter function called to establish a connection to 106 * Adapter function called to establish a connection to
107 * the MESH service. 107 * the CADET service.
108 * 108 *
109 * @param cls closure 109 * @param cls closure
110 * @param cfg configuration of the peer to connect to; will be available until 110 * @param cfg configuration of the peer to connect to; will be available until
@@ -113,14 +113,14 @@ struct GNUNET_MESH_TEST_AdapterContext
113 * @return service handle to return in 'op_result', NULL on error 113 * @return service handle to return in 'op_result', NULL on error
114 */ 114 */
115static void * 115static void *
116mesh_connect_adapter (void *cls, 116cadet_connect_adapter (void *cls,
117 const struct GNUNET_CONFIGURATION_Handle *cfg) 117 const struct GNUNET_CONFIGURATION_Handle *cfg)
118{ 118{
119 struct GNUNET_MESH_TEST_AdapterContext *actx = cls; 119 struct GNUNET_CADET_TEST_AdapterContext *actx = cls;
120 struct GNUNET_MESH_TEST_Context *ctx = actx->ctx; 120 struct GNUNET_CADET_TEST_Context *ctx = actx->ctx;
121 struct GNUNET_MESH_Handle *h; 121 struct GNUNET_CADET_Handle *h;
122 122
123 h = GNUNET_MESH_connect (cfg, 123 h = GNUNET_CADET_connect (cfg,
124 (void *) (long) actx->peer, 124 (void *) (long) actx->peer,
125 ctx->new_channel, 125 ctx->new_channel,
126 ctx->cleaner, 126 ctx->cleaner,
@@ -132,20 +132,20 @@ mesh_connect_adapter (void *cls,
132 132
133/** 133/**
134 * Adapter function called to destroy a connection to 134 * Adapter function called to destroy a connection to
135 * the MESH service. 135 * the CADET service.
136 * 136 *
137 * @param cls closure 137 * @param cls closure
138 * @param op_result service handle returned from the connect adapter 138 * @param op_result service handle returned from the connect adapter
139 */ 139 */
140static void 140static void
141mesh_disconnect_adapter (void *cls, 141cadet_disconnect_adapter (void *cls,
142 void *op_result) 142 void *op_result)
143{ 143{
144 struct GNUNET_MESH_Handle *mesh = op_result; 144 struct GNUNET_CADET_Handle *cadet = op_result;
145 struct GNUNET_MESH_TEST_AdapterContext *actx = cls; 145 struct GNUNET_CADET_TEST_AdapterContext *actx = cls;
146 146
147 GNUNET_free (actx); 147 GNUNET_free (actx);
148 GNUNET_MESH_disconnect (mesh); 148 GNUNET_CADET_disconnect (cadet);
149} 149}
150 150
151 151
@@ -155,22 +155,22 @@ mesh_disconnect_adapter (void *cls,
155 * @param cls The callback closure from functions generating an operation. 155 * @param cls The callback closure from functions generating an operation.
156 * @param op The operation that has been finished. 156 * @param op The operation that has been finished.
157 * @param ca_result The service handle returned from 157 * @param ca_result The service handle returned from
158 * GNUNET_TESTBED_ConnectAdapter() (mesh handle). 158 * GNUNET_TESTBED_ConnectAdapter() (cadet handle).
159 * @param emsg Error message in case the operation has failed. 159 * @param emsg Error message in case the operation has failed.
160 * NULL if operation has executed successfully. 160 * NULL if operation has executed successfully.
161 */ 161 */
162static void 162static void
163mesh_connect_cb (void *cls, 163cadet_connect_cb (void *cls,
164 struct GNUNET_TESTBED_Operation *op, 164 struct GNUNET_TESTBED_Operation *op,
165 void *ca_result, 165 void *ca_result,
166 const char *emsg) 166 const char *emsg)
167{ 167{
168 struct GNUNET_MESH_TEST_Context *ctx = cls; 168 struct GNUNET_CADET_TEST_Context *ctx = cls;
169 unsigned int i; 169 unsigned int i;
170 170
171 if (NULL != emsg) 171 if (NULL != emsg)
172 { 172 {
173 fprintf (stderr, "Failed to connect to MESH service: %s\n", 173 fprintf (stderr, "Failed to connect to CADET service: %s\n",
174 emsg); 174 emsg);
175 GNUNET_SCHEDULER_shutdown (); 175 GNUNET_SCHEDULER_shutdown ();
176 return; 176 return;
@@ -178,23 +178,23 @@ mesh_connect_cb (void *cls,
178 for (i = 0; i < ctx->num_peers; i++) 178 for (i = 0; i < ctx->num_peers; i++)
179 if (op == ctx->ops[i]) 179 if (op == ctx->ops[i])
180 { 180 {
181 ctx->meshes[i] = ca_result; 181 ctx->cadetes[i] = ca_result;
182 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "...mesh %u connected\n", i); 182 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "...cadet %u connected\n", i);
183 } 183 }
184 for (i = 0; i < ctx->num_peers; i++) 184 for (i = 0; i < ctx->num_peers; i++)
185 if (NULL == ctx->meshes[i]) 185 if (NULL == ctx->cadetes[i])
186 return; /* still some MESH connections missing */ 186 return; /* still some CADET connections missing */
187 /* all MESH connections ready! */ 187 /* all CADET connections ready! */
188 ctx->app_main (ctx->app_main_cls, 188 ctx->app_main (ctx->app_main_cls,
189 ctx, 189 ctx,
190 ctx->num_peers, 190 ctx->num_peers,
191 ctx->peers, 191 ctx->peers,
192 ctx->meshes); 192 ctx->cadetes);
193} 193}
194 194
195 195
196void 196void
197GNUNET_MESH_TEST_cleanup (struct GNUNET_MESH_TEST_Context *ctx) 197GNUNET_CADET_TEST_cleanup (struct GNUNET_CADET_TEST_Context *ctx)
198{ 198{
199 unsigned int i; 199 unsigned int i;
200 200
@@ -205,7 +205,7 @@ GNUNET_MESH_TEST_cleanup (struct GNUNET_MESH_TEST_Context *ctx)
205 ctx->ops[i] = NULL; 205 ctx->ops[i] = NULL;
206 } 206 }
207 GNUNET_free (ctx->ops); 207 GNUNET_free (ctx->ops);
208 GNUNET_free (ctx->meshes); 208 GNUNET_free (ctx->cadetes);
209 GNUNET_free (ctx); 209 GNUNET_free (ctx);
210 GNUNET_SCHEDULER_shutdown (); 210 GNUNET_SCHEDULER_shutdown ();
211} 211}
@@ -225,14 +225,14 @@ GNUNET_MESH_TEST_cleanup (struct GNUNET_MESH_TEST_Context *ctx)
225 * failed 225 * failed
226 */ 226 */
227static void 227static void
228mesh_test_run (void *cls, 228cadet_test_run (void *cls,
229 struct GNUNET_TESTBED_RunHandle *h, 229 struct GNUNET_TESTBED_RunHandle *h,
230 unsigned int num_peers, 230 unsigned int num_peers,
231 struct GNUNET_TESTBED_Peer **peers, 231 struct GNUNET_TESTBED_Peer **peers,
232 unsigned int links_succeeded, 232 unsigned int links_succeeded,
233 unsigned int links_failed) 233 unsigned int links_failed)
234{ 234{
235 struct GNUNET_MESH_TEST_Context *ctx = cls; 235 struct GNUNET_CADET_TEST_Context *ctx = cls;
236 unsigned int i; 236 unsigned int i;
237 237
238 if (num_peers != ctx->num_peers) 238 if (num_peers != ctx->num_peers)
@@ -244,18 +244,18 @@ mesh_test_run (void *cls,
244 ctx->peers = peers; 244 ctx->peers = peers;
245 for (i = 0; i < num_peers; i++) 245 for (i = 0; i < num_peers; i++)
246 { 246 {
247 struct GNUNET_MESH_TEST_AdapterContext *newctx; 247 struct GNUNET_CADET_TEST_AdapterContext *newctx;
248 newctx = GNUNET_new (struct GNUNET_MESH_TEST_AdapterContext); 248 newctx = GNUNET_new (struct GNUNET_CADET_TEST_AdapterContext);
249 newctx->peer = i; 249 newctx->peer = i;
250 newctx->ctx = ctx; 250 newctx->ctx = ctx;
251 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Connecting to mesh %u\n", i); 251 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Connecting to cadet %u\n", i);
252 ctx->ops[i] = GNUNET_TESTBED_service_connect (ctx, 252 ctx->ops[i] = GNUNET_TESTBED_service_connect (ctx,
253 peers[i], 253 peers[i],
254 "mesh", 254 "cadet",
255 &mesh_connect_cb, 255 &cadet_connect_cb,
256 ctx, 256 ctx,
257 &mesh_connect_adapter, 257 &cadet_connect_adapter,
258 &mesh_disconnect_adapter, 258 &cadet_disconnect_adapter,
259 newctx); 259 newctx);
260 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "op handle %p\n", ctx->ops[i]); 260 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "op handle %p\n", ctx->ops[i]);
261 } 261 }
@@ -263,22 +263,22 @@ mesh_test_run (void *cls,
263 263
264 264
265void 265void
266GNUNET_MESH_TEST_run (const char *testname, 266GNUNET_CADET_TEST_run (const char *testname,
267 const char *cfgname, 267 const char *cfgname,
268 unsigned int num_peers, 268 unsigned int num_peers,
269 GNUNET_MESH_TEST_AppMain tmain, 269 GNUNET_CADET_TEST_AppMain tmain,
270 void *tmain_cls, 270 void *tmain_cls,
271 GNUNET_MESH_InboundChannelNotificationHandler new_channel, 271 GNUNET_CADET_InboundChannelNotificationHandler new_channel,
272 GNUNET_MESH_ChannelEndHandler cleaner, 272 GNUNET_CADET_ChannelEndHandler cleaner,
273 struct GNUNET_MESH_MessageHandler* handlers, 273 struct GNUNET_CADET_MessageHandler* handlers,
274 const uint32_t *ports) 274 const uint32_t *ports)
275{ 275{
276 struct GNUNET_MESH_TEST_Context *ctx; 276 struct GNUNET_CADET_TEST_Context *ctx;
277 277
278 ctx = GNUNET_new (struct GNUNET_MESH_TEST_Context); 278 ctx = GNUNET_new (struct GNUNET_CADET_TEST_Context);
279 ctx->num_peers = num_peers; 279 ctx->num_peers = num_peers;
280 ctx->ops = GNUNET_malloc (num_peers * sizeof (struct GNUNET_TESTBED_Operation *)); 280 ctx->ops = GNUNET_malloc (num_peers * sizeof (struct GNUNET_TESTBED_Operation *));
281 ctx->meshes = GNUNET_malloc (num_peers * sizeof (struct GNUNET_MESH_Handle *)); 281 ctx->cadetes = GNUNET_malloc (num_peers * sizeof (struct GNUNET_CADET_Handle *));
282 ctx->app_main = tmain; 282 ctx->app_main = tmain;
283 ctx->app_main_cls = tmain_cls; 283 ctx->app_main_cls = tmain_cls;
284 ctx->new_channel = new_channel; 284 ctx->new_channel = new_channel;
@@ -289,7 +289,7 @@ GNUNET_MESH_TEST_run (const char *testname,
289 cfgname, 289 cfgname,
290 num_peers, 290 num_peers,
291 0LL, NULL, NULL, 291 0LL, NULL, NULL,
292 &mesh_test_run, ctx); 292 &cadet_test_run, ctx);
293} 293}
294 294
295/* end of mesh_test_lib.c */ 295/* end of cadet_test_lib.c */
diff --git a/src/mesh/mesh_test_lib.h b/src/mesh/mesh_test_lib.h
index 96c7c60a4..f2ed426b0 100644
--- a/src/mesh/mesh_test_lib.h
+++ b/src/mesh/mesh_test_lib.h
@@ -18,12 +18,12 @@
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20/** 20/**
21 * @file mesh/mesh_test_lib.h 21 * @file cadet/cadet_test_lib.h
22 * @author Bartlomiej Polot 22 * @author Bartlomiej Polot
23 * @brief library for writing MESH tests 23 * @brief library for writing CADET tests
24 */ 24 */
25#ifndef MESH_TEST_LIB_H 25#ifndef CADET_TEST_LIB_H
26#define MESH_TEST_LIB_H 26#define CADET_TEST_LIB_H
27 27
28#ifdef __cplusplus 28#ifdef __cplusplus
29extern "C" 29extern "C"
@@ -34,34 +34,34 @@ extern "C"
34#endif 34#endif
35 35
36#include "gnunet_testbed_service.h" 36#include "gnunet_testbed_service.h"
37#include "gnunet_mesh_service.h" 37#include "gnunet_cadet_service.h"
38 38
39/** 39/**
40 * Test context for a MESH Test. 40 * Test context for a CADET Test.
41 */ 41 */
42struct GNUNET_MESH_TEST_Context; 42struct GNUNET_CADET_TEST_Context;
43 43
44 44
45/** 45/**
46 * Main function of a MESH test. 46 * Main function of a CADET test.
47 * 47 *
48 * @param cls Closure. 48 * @param cls Closure.
49 * @param ctx Argument to give to GNUNET_MESH_TEST_cleanup on test end. 49 * @param ctx Argument to give to GNUNET_CADET_TEST_cleanup on test end.
50 * @param num_peers Number of peers that are running. 50 * @param num_peers Number of peers that are running.
51 * @param peers Array of peers. 51 * @param peers Array of peers.
52 * @param meshes Handle to each of the MESHs of the peers. 52 * @param cadetes Handle to each of the CADETs of the peers.
53 */ 53 */
54typedef void (*GNUNET_MESH_TEST_AppMain) (void *cls, 54typedef void (*GNUNET_CADET_TEST_AppMain) (void *cls,
55 struct GNUNET_MESH_TEST_Context *ctx, 55 struct GNUNET_CADET_TEST_Context *ctx,
56 unsigned int num_peers, 56 unsigned int num_peers,
57 struct GNUNET_TESTBED_Peer **peers, 57 struct GNUNET_TESTBED_Peer **peers,
58 struct GNUNET_MESH_Handle **meshes); 58 struct GNUNET_CADET_Handle **cadetes);
59 59
60 60
61/** 61/**
62 * Run a test using the given name, configuration file and number of 62 * Run a test using the given name, configuration file and number of
63 * peers. 63 * peers.
64 * All mesh callbacks will receive the peer number as the closure. 64 * All cadet callbacks will receive the peer number as the closure.
65 * 65 *
66 * @param testname Name of the test (for logging). 66 * @param testname Name of the test (for logging).
67 * @param cfgname Name of the configuration file. 67 * @param cfgname Name of the configuration file.
@@ -74,14 +74,14 @@ typedef void (*GNUNET_MESH_TEST_AppMain) (void *cls,
74 * @param ports Ports the peers offer. 74 * @param ports Ports the peers offer.
75 */ 75 */
76void 76void
77GNUNET_MESH_TEST_run (const char *testname, 77GNUNET_CADET_TEST_run (const char *testname,
78 const char *cfgname, 78 const char *cfgname,
79 unsigned int num_peers, 79 unsigned int num_peers,
80 GNUNET_MESH_TEST_AppMain tmain, 80 GNUNET_CADET_TEST_AppMain tmain,
81 void *tmain_cls, 81 void *tmain_cls,
82 GNUNET_MESH_InboundChannelNotificationHandler new_channel, 82 GNUNET_CADET_InboundChannelNotificationHandler new_channel,
83 GNUNET_MESH_ChannelEndHandler cleaner, 83 GNUNET_CADET_ChannelEndHandler cleaner,
84 struct GNUNET_MESH_MessageHandler* handlers, 84 struct GNUNET_CADET_MessageHandler* handlers,
85 const uint32_t* ports); 85 const uint32_t* ports);
86 86
87 87
@@ -91,7 +91,7 @@ GNUNET_MESH_TEST_run (const char *testname,
91 * @param ctx handle for the testbed 91 * @param ctx handle for the testbed
92 */ 92 */
93void 93void
94GNUNET_MESH_TEST_cleanup (struct GNUNET_MESH_TEST_Context *ctx); 94GNUNET_CADET_TEST_cleanup (struct GNUNET_CADET_TEST_Context *ctx);
95 95
96 96
97#if 0 /* keep Emacsens' auto-indent happy */ 97#if 0 /* keep Emacsens' auto-indent happy */
@@ -102,5 +102,5 @@ GNUNET_MESH_TEST_cleanup (struct GNUNET_MESH_TEST_Context *ctx);
102#endif 102#endif
103 103
104 104
105/* ifndef MESH_TEST_LIB_H */ 105/* ifndef CADET_TEST_LIB_H */
106#endif 106#endif
diff --git a/src/mesh/mesh_tunnel_tree.c b/src/mesh/mesh_tunnel_tree.c
index 48d052ef7..dd3f3dae1 100644
--- a/src/mesh/mesh_tunnel_tree.c
+++ b/src/mesh/mesh_tunnel_tree.c
@@ -19,21 +19,21 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file mesh/mesh_tunnel_tree.c 22 * @file cadet/cadet_tunnel_tree.c
23 * @brief Tunnel tree handling functions 23 * @brief Tunnel tree handling functions
24 * @author Bartlomiej Polot 24 * @author Bartlomiej Polot
25 */ 25 */
26 26
27#include "mesh.h" 27#include "cadet.h"
28#include "mesh_tunnel_tree.h" 28#include "cadet_tunnel_tree.h"
29 29
30#define MESH_TREE_DEBUG GNUNET_YES 30#define CADET_TREE_DEBUG GNUNET_YES
31 31
32 32
33/** 33/**
34 * Node of path tree for a tunnel 34 * Node of path tree for a tunnel
35 */ 35 */
36struct MeshTunnelTreeNode 36struct CadetTunnelTreeNode
37{ 37{
38 /** 38 /**
39 * Peer this node describes 39 * Peer this node describes
@@ -43,59 +43,59 @@ struct MeshTunnelTreeNode
43 /** 43 /**
44 * Parent node in the tree 44 * Parent node in the tree
45 */ 45 */
46 struct MeshTunnelTreeNode *parent; 46 struct CadetTunnelTreeNode *parent;
47 47
48 /** 48 /**
49 * DLL of siblings 49 * DLL of siblings
50 */ 50 */
51 struct MeshTunnelTreeNode *next; 51 struct CadetTunnelTreeNode *next;
52 52
53 /** 53 /**
54 * DLL of siblings 54 * DLL of siblings
55 */ 55 */
56 struct MeshTunnelTreeNode *prev; 56 struct CadetTunnelTreeNode *prev;
57 57
58 /** 58 /**
59 * DLL of children 59 * DLL of children
60 */ 60 */
61 struct MeshTunnelTreeNode *children_head; 61 struct CadetTunnelTreeNode *children_head;
62 62
63 /** 63 /**
64 * DLL of children 64 * DLL of children
65 */ 65 */
66 struct MeshTunnelTreeNode *children_tail; 66 struct CadetTunnelTreeNode *children_tail;
67 67
68 /** 68 /**
69 * Status of the peer in the tunnel 69 * Status of the peer in the tunnel
70 */ 70 */
71 enum MeshPeerState status; 71 enum CadetPeerState status;
72}; 72};
73 73
74 74
75/** 75/**
76 * Tree to reach all peers in the tunnel 76 * Tree to reach all peers in the tunnel
77 */ 77 */
78struct MeshTunnelTree 78struct CadetTunnelTree
79{ 79{
80 /** 80 /**
81 * Root node of peer tree 81 * Root node of peer tree
82 */ 82 */
83 struct MeshTunnelTreeNode *root; 83 struct CadetTunnelTreeNode *root;
84 84
85 /** 85 /**
86 * Node that represents our position in the tree (for non local tunnels) 86 * Node that represents our position in the tree (for non local tunnels)
87 */ 87 */
88 struct MeshTunnelTreeNode *me; 88 struct CadetTunnelTreeNode *me;
89 89
90 /** 90 /**
91 * DLL of disconneted nodes 91 * DLL of disconneted nodes
92 */ 92 */
93 struct MeshTunnelTreeNode *disconnected_head; 93 struct CadetTunnelTreeNode *disconnected_head;
94 94
95 /** 95 /**
96 * DLL of disconneted nodes 96 * DLL of disconneted nodes
97 */ 97 */
98 struct MeshTunnelTreeNode *disconnected_tail; 98 struct CadetTunnelTreeNode *disconnected_tail;
99 99
100 /** 100 /**
101 * Cache of all peers and the first hop to them. 101 * Cache of all peers and the first hop to them.
@@ -114,12 +114,12 @@ struct MeshTunnelTree
114 * 114 *
115 * @return A newly allocated path with a peer array of the specified length. 115 * @return A newly allocated path with a peer array of the specified length.
116 */ 116 */
117struct MeshPeerPath * 117struct CadetPeerPath *
118path_new (unsigned int length) 118path_new (unsigned int length)
119{ 119{
120 struct MeshPeerPath *p; 120 struct CadetPeerPath *p;
121 121
122 p = GNUNET_new (struct MeshPeerPath); 122 p = GNUNET_new (struct CadetPeerPath);
123 if (length > 0) 123 if (length > 0)
124 { 124 {
125 p->length = length; 125 p->length = length;
@@ -135,7 +135,7 @@ path_new (unsigned int length)
135 * @param path the path to invert 135 * @param path the path to invert
136 */ 136 */
137void 137void
138path_invert (struct MeshPeerPath *path) 138path_invert (struct CadetPeerPath *path)
139{ 139{
140 GNUNET_PEER_Id aux; 140 GNUNET_PEER_Id aux;
141 unsigned int i; 141 unsigned int i;
@@ -154,10 +154,10 @@ path_invert (struct MeshPeerPath *path)
154 * 154 *
155 * @param path The path to duplicate. 155 * @param path The path to duplicate.
156 */ 156 */
157struct MeshPeerPath * 157struct CadetPeerPath *
158path_duplicate (struct MeshPeerPath *path) 158path_duplicate (struct CadetPeerPath *path)
159{ 159{
160 struct MeshPeerPath *aux; 160 struct CadetPeerPath *aux;
161 unsigned int i; 161 unsigned int i;
162 162
163 aux = path_new (path->length); 163 aux = path_new (path->length);
@@ -177,8 +177,8 @@ path_duplicate (struct MeshPeerPath *path)
177 * If not known, NULL to find out and pass on children. 177 * If not known, NULL to find out and pass on children.
178 */ 178 */
179static void 179static void
180tree_node_update_first_hops (struct MeshTunnelTree *tree, 180tree_node_update_first_hops (struct CadetTunnelTree *tree,
181 struct MeshTunnelTreeNode *parent, 181 struct CadetTunnelTreeNode *parent,
182 struct GNUNET_PeerIdentity *hop); 182 struct GNUNET_PeerIdentity *hop);
183 183
184 184
@@ -191,7 +191,7 @@ tree_node_update_first_hops (struct MeshTunnelTree *tree,
191 * UINT_MAX in case the peer is not in the path. 191 * UINT_MAX in case the peer is not in the path.
192 */ 192 */
193unsigned int 193unsigned int
194path_get_length (struct MeshPeerPath *path) 194path_get_length (struct CadetPeerPath *path)
195{ 195{
196 if (NULL == path) 196 if (NULL == path)
197 return UINT_MAX; 197 return UINT_MAX;
@@ -207,7 +207,7 @@ path_get_length (struct MeshPeerPath *path)
207 * @return GNUNET_OK on success 207 * @return GNUNET_OK on success
208 */ 208 */
209int 209int
210path_destroy (struct MeshPeerPath *p) 210path_destroy (struct CadetPeerPath *p)
211{ 211{
212 if (NULL == p) 212 if (NULL == p)
213 return GNUNET_OK; 213 return GNUNET_OK;
@@ -228,12 +228,12 @@ path_destroy (struct MeshPeerPath *p)
228 * 228 *
229 * @return Newly allocated node 229 * @return Newly allocated node
230 */ 230 */
231static struct MeshTunnelTreeNode * 231static struct CadetTunnelTreeNode *
232tree_node_new (struct MeshTunnelTreeNode *parent, GNUNET_PEER_Id peer) 232tree_node_new (struct CadetTunnelTreeNode *parent, GNUNET_PEER_Id peer)
233{ 233{
234 struct MeshTunnelTreeNode *node; 234 struct CadetTunnelTreeNode *node;
235 235
236 node = GNUNET_new (struct MeshTunnelTreeNode); 236 node = GNUNET_new (struct CadetTunnelTreeNode);
237 node->peer = peer; 237 node->peer = peer;
238 GNUNET_PEER_change_rc (peer, 1); 238 GNUNET_PEER_change_rc (peer, 1);
239 node->parent = parent; 239 node->parent = parent;
@@ -253,11 +253,11 @@ tree_node_new (struct MeshTunnelTreeNode *parent, GNUNET_PEER_Id peer)
253 * 253 *
254 * @return Pointer to the node of the peer. NULL if not found. 254 * @return Pointer to the node of the peer. NULL if not found.
255 */ 255 */
256static struct MeshTunnelTreeNode * 256static struct CadetTunnelTreeNode *
257tree_node_find_peer (struct MeshTunnelTreeNode *parent, GNUNET_PEER_Id peer_id) 257tree_node_find_peer (struct CadetTunnelTreeNode *parent, GNUNET_PEER_Id peer_id)
258{ 258{
259 struct MeshTunnelTreeNode *n; 259 struct CadetTunnelTreeNode *n;
260 struct MeshTunnelTreeNode *r; 260 struct CadetTunnelTreeNode *r;
261 261
262 if (parent->peer == peer_id) 262 if (parent->peer == peer_id)
263 return parent; 263 return parent;
@@ -280,29 +280,29 @@ tree_node_find_peer (struct MeshTunnelTreeNode *parent, GNUNET_PEER_Id peer_id)
280 * If not known, NULL to find out and pass on children. 280 * If not known, NULL to find out and pass on children.
281 */ 281 */
282static void 282static void
283tree_node_update_first_hops (struct MeshTunnelTree *tree, 283tree_node_update_first_hops (struct CadetTunnelTree *tree,
284 struct MeshTunnelTreeNode *parent, 284 struct CadetTunnelTreeNode *parent,
285 struct GNUNET_PeerIdentity *hop) 285 struct GNUNET_PeerIdentity *hop)
286{ 286{
287 struct GNUNET_PeerIdentity pi; 287 struct GNUNET_PeerIdentity pi;
288 struct GNUNET_PeerIdentity *copy; 288 struct GNUNET_PeerIdentity *copy;
289 struct GNUNET_PeerIdentity id; 289 struct GNUNET_PeerIdentity id;
290 struct MeshTunnelTreeNode *n; 290 struct CadetTunnelTreeNode *n;
291 291
292#if MESH_TREE_DEBUG 292#if CADET_TREE_DEBUG
293 GNUNET_PEER_resolve (parent->peer, &id); 293 GNUNET_PEER_resolve (parent->peer, &id);
294 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: Finding first hop for %s.\n", 294 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: Finding first hop for %s.\n",
295 GNUNET_i2s (&id)); 295 GNUNET_i2s (&id));
296#endif 296#endif
297 if (NULL == hop) 297 if (NULL == hop)
298 { 298 {
299 struct MeshTunnelTreeNode *aux; 299 struct CadetTunnelTreeNode *aux;
300 struct MeshTunnelTreeNode *old; 300 struct CadetTunnelTreeNode *old;
301 301
302 aux = old = parent; 302 aux = old = parent;
303 while (aux != tree->me) 303 while (aux != tree->me)
304 { 304 {
305#if MESH_TREE_DEBUG 305#if CADET_TREE_DEBUG
306 GNUNET_PEER_resolve (aux->peer, &id); 306 GNUNET_PEER_resolve (aux->peer, &id);
307 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: ... checking %s.\n", 307 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: ... checking %s.\n",
308 GNUNET_i2s (&id)); 308 GNUNET_i2s (&id));
@@ -311,7 +311,7 @@ tree_node_update_first_hops (struct MeshTunnelTree *tree,
311 aux = aux->parent; 311 aux = aux->parent;
312 GNUNET_assert (NULL != aux); 312 GNUNET_assert (NULL != aux);
313 } 313 }
314#if MESH_TREE_DEBUG 314#if CADET_TREE_DEBUG
315 GNUNET_PEER_resolve (old->peer, &id); 315 GNUNET_PEER_resolve (old->peer, &id);
316 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: It's %s!\n", 316 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: It's %s!\n",
317 GNUNET_i2s (&id)); 317 GNUNET_i2s (&id));
@@ -337,21 +337,21 @@ tree_node_update_first_hops (struct MeshTunnelTree *tree,
337 337
338 338
339static void 339static void
340tree_node_debug (struct MeshTunnelTreeNode *n, uint16_t level) 340tree_node_debug (struct CadetTunnelTreeNode *n, uint16_t level)
341{ 341{
342 struct MeshTunnelTreeNode *c; 342 struct CadetTunnelTreeNode *c;
343 struct GNUNET_PeerIdentity id;; 343 struct GNUNET_PeerIdentity id;;
344 uint16_t i; 344 uint16_t i;
345 345
346 for (i = 0; i < level; i++) 346 for (i = 0; i < level; i++)
347 FPRINTF (stderr, "%s", " "); 347 FPRINTF (stderr, "%s", " ");
348 if (n->status == MESH_PEER_READY) 348 if (n->status == CADET_PEER_READY)
349 FPRINTF (stderr, "%s", "#"); 349 FPRINTF (stderr, "%s", "#");
350 if (n->status == MESH_PEER_SEARCHING) 350 if (n->status == CADET_PEER_SEARCHING)
351 FPRINTF (stderr, "%s", "+"); 351 FPRINTF (stderr, "%s", "+");
352 if (n->status == MESH_PEER_RELAY) 352 if (n->status == CADET_PEER_RELAY)
353 FPRINTF (stderr, "%s", "-"); 353 FPRINTF (stderr, "%s", "-");
354 if (n->status == MESH_PEER_RECONNECTING) 354 if (n->status == CADET_PEER_RECONNECTING)
355 FPRINTF (stderr, "%s", "*"); 355 FPRINTF (stderr, "%s", "*");
356 356
357 GNUNET_PEER_resolve (n->peer, &id); 357 GNUNET_PEER_resolve (n->peer, &id);
@@ -374,14 +374,14 @@ tree_node_debug (struct MeshTunnelTreeNode *n, uint16_t level)
374 * @param parent Parent node to be destroyed 374 * @param parent Parent node to be destroyed
375 */ 375 */
376static void 376static void
377tree_node_destroy (struct MeshTunnelTreeNode *parent) 377tree_node_destroy (struct CadetTunnelTreeNode *parent)
378{ 378{
379 struct MeshTunnelTreeNode *n; 379 struct CadetTunnelTreeNode *n;
380 struct MeshTunnelTreeNode *next; 380 struct CadetTunnelTreeNode *next;
381 381
382 if (NULL == parent) 382 if (NULL == parent)
383 return; 383 return;
384#if MESH_TREE_DEBUG 384#if CADET_TREE_DEBUG
385 struct GNUNET_PeerIdentity id; 385 struct GNUNET_PeerIdentity id;
386 386
387 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: Destroying node %u\n", 387 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: Destroying node %u\n",
@@ -412,15 +412,15 @@ tree_node_destroy (struct MeshTunnelTreeNode *parent)
412 * 412 *
413 * @return A newly allocated and initialized tunnel tree. 413 * @return A newly allocated and initialized tunnel tree.
414 */ 414 */
415struct MeshTunnelTree * 415struct CadetTunnelTree *
416tree_new (GNUNET_PEER_Id peer) 416tree_new (GNUNET_PEER_Id peer)
417{ 417{
418 struct MeshTunnelTree *tree; 418 struct CadetTunnelTree *tree;
419 419
420 tree = GNUNET_new (struct MeshTunnelTree); 420 tree = GNUNET_new (struct CadetTunnelTree);
421 tree->first_hops = GNUNET_CONTAINER_multihashmap_create (32, GNUNET_NO); 421 tree->first_hops = GNUNET_CONTAINER_multihashmap_create (32, GNUNET_NO);
422 tree->root = tree_node_new (NULL, peer); 422 tree->root = tree_node_new (NULL, peer);
423 tree->root->status = MESH_PEER_ROOT; 423 tree->root->status = CADET_PEER_ROOT;
424 424
425 if (1 == peer) 425 if (1 == peer)
426 { 426 {
@@ -439,10 +439,10 @@ tree_new (GNUNET_PEER_Id peer)
439 * @param status New status to set. 439 * @param status New status to set.
440 */ 440 */
441void 441void
442tree_set_status (struct MeshTunnelTree *tree, GNUNET_PEER_Id peer, 442tree_set_status (struct CadetTunnelTree *tree, GNUNET_PEER_Id peer,
443 enum MeshPeerState status) 443 enum CadetPeerState status)
444{ 444{
445 struct MeshTunnelTreeNode *n; 445 struct CadetTunnelTreeNode *n;
446 446
447 n = tree_find_peer (tree, peer); 447 n = tree_find_peer (tree, peer);
448 if (NULL == n) 448 if (NULL == n)
@@ -459,14 +459,14 @@ tree_set_status (struct MeshTunnelTree *tree, GNUNET_PEER_Id peer,
459 * 459 *
460 * @return Status of the peer. 460 * @return Status of the peer.
461 */ 461 */
462enum MeshPeerState 462enum CadetPeerState
463tree_get_status (struct MeshTunnelTree *tree, GNUNET_PEER_Id peer) 463tree_get_status (struct CadetTunnelTree *tree, GNUNET_PEER_Id peer)
464{ 464{
465 struct MeshTunnelTreeNode *n; 465 struct CadetTunnelTreeNode *n;
466 466
467 n = tree_find_peer (tree, peer); 467 n = tree_find_peer (tree, peer);
468 if (NULL == n) 468 if (NULL == n)
469 return MESH_PEER_INVALID; 469 return CADET_PEER_INVALID;
470 return n->status; 470 return n->status;
471} 471}
472 472
@@ -479,7 +479,7 @@ tree_get_status (struct MeshTunnelTree *tree, GNUNET_PEER_Id peer)
479 * @return Short peer id of local peer. 479 * @return Short peer id of local peer.
480 */ 480 */
481GNUNET_PEER_Id 481GNUNET_PEER_Id
482tree_get_predecessor (struct MeshTunnelTree *tree) 482tree_get_predecessor (struct CadetTunnelTree *tree)
483{ 483{
484 if (NULL != tree->me && NULL != tree->me->parent) 484 if (NULL != tree->me && NULL != tree->me->parent)
485 return tree->me->parent->peer; 485 return tree->me->parent->peer;
@@ -500,7 +500,7 @@ tree_get_predecessor (struct MeshTunnelTree *tree)
500 * FIXME use PEER_Id 500 * FIXME use PEER_Id
501 */ 501 */
502struct GNUNET_PeerIdentity * 502struct GNUNET_PeerIdentity *
503tree_get_first_hop (struct MeshTunnelTree *t, GNUNET_PEER_Id peer) 503tree_get_first_hop (struct CadetTunnelTree *t, GNUNET_PEER_Id peer)
504{ 504{
505 struct GNUNET_PeerIdentity id; 505 struct GNUNET_PeerIdentity id;
506 struct GNUNET_PeerIdentity *r; 506 struct GNUNET_PeerIdentity *r;
@@ -509,7 +509,7 @@ tree_get_first_hop (struct MeshTunnelTree *t, GNUNET_PEER_Id peer)
509 r = GNUNET_CONTAINER_multihashmap_get (t->first_hops, &id.hashPubKey); 509 r = GNUNET_CONTAINER_multihashmap_get (t->first_hops, &id.hashPubKey);
510 if (NULL == r) 510 if (NULL == r)
511 { 511 {
512 struct MeshTunnelTreeNode *n; 512 struct CadetTunnelTreeNode *n;
513 513
514 n = tree_find_peer (t, peer); 514 n = tree_find_peer (t, peer);
515 if (NULL != t->me && NULL != n) 515 if (NULL != t->me && NULL != n)
@@ -538,8 +538,8 @@ tree_get_first_hop (struct MeshTunnelTree *t, GNUNET_PEER_Id peer)
538 * 538 *
539 * @return Pointer to the node of the peer. NULL if not found. 539 * @return Pointer to the node of the peer. NULL if not found.
540 */ 540 */
541struct MeshTunnelTreeNode * 541struct CadetTunnelTreeNode *
542tree_find_peer (struct MeshTunnelTree *tree, GNUNET_PEER_Id peer_id) 542tree_find_peer (struct CadetTunnelTree *tree, GNUNET_PEER_Id peer_id)
543{ 543{
544 return tree_node_find_peer (tree->root, peer_id); 544 return tree_node_find_peer (tree->root, peer_id);
545} 545}
@@ -554,23 +554,23 @@ tree_find_peer (struct MeshTunnelTree *tree, GNUNET_PEER_Id peer_id)
554 * @param cbcls Closure for cb. 554 * @param cbcls Closure for cb.
555 */ 555 */
556static void 556static void
557tree_mark_peers_disconnected (struct MeshTunnelTree *tree, 557tree_mark_peers_disconnected (struct CadetTunnelTree *tree,
558 struct MeshTunnelTreeNode *parent, 558 struct CadetTunnelTreeNode *parent,
559 MeshTreeCallback cb, void *cbcls) 559 CadetTreeCallback cb, void *cbcls)
560{ 560{
561 struct GNUNET_PeerIdentity *pi; 561 struct GNUNET_PeerIdentity *pi;
562 struct GNUNET_PeerIdentity id; 562 struct GNUNET_PeerIdentity id;
563 struct MeshTunnelTreeNode *n; 563 struct CadetTunnelTreeNode *n;
564 564
565 for (n = parent->children_head; NULL != n; n = n->next) 565 for (n = parent->children_head; NULL != n; n = n->next)
566 { 566 {
567 tree_mark_peers_disconnected (tree, n, cb, cbcls); 567 tree_mark_peers_disconnected (tree, n, cb, cbcls);
568 } 568 }
569 if (MESH_PEER_READY == parent->status) 569 if (CADET_PEER_READY == parent->status)
570 { 570 {
571 if (NULL != cb) 571 if (NULL != cb)
572 cb (cbcls, parent->peer); 572 cb (cbcls, parent->peer);
573 parent->status = MESH_PEER_RECONNECTING; 573 parent->status = CADET_PEER_RECONNECTING;
574 } 574 }
575 575
576 /* Remove and free info about first hop */ 576 /* Remove and free info about first hop */
@@ -590,10 +590,10 @@ tree_mark_peers_disconnected (struct MeshTunnelTree *tree,
590 * @param cb_cls Closure for @c cb. 590 * @param cb_cls Closure for @c cb.
591 */ 591 */
592void 592void
593tree_iterate_children (struct MeshTunnelTree *tree, MeshTreeCallback cb, 593tree_iterate_children (struct CadetTunnelTree *tree, CadetTreeCallback cb,
594 void *cb_cls) 594 void *cb_cls)
595{ 595{
596 struct MeshTunnelTreeNode *n; 596 struct CadetTunnelTreeNode *n;
597 597
598 if (NULL == tree->me) 598 if (NULL == tree->me)
599 return; 599 return;
@@ -607,22 +607,22 @@ tree_iterate_children (struct MeshTunnelTree *tree, MeshTreeCallback cb,
607/** 607/**
608 * Struct to contain a list of pending nodes when iterating a tree. 608 * Struct to contain a list of pending nodes when iterating a tree.
609 */ 609 */
610struct MeshTreePendingNode { 610struct CadetTreePendingNode {
611 611
612 /** 612 /**
613 * DLL next. 613 * DLL next.
614 */ 614 */
615 struct MeshTreePendingNode *next; 615 struct CadetTreePendingNode *next;
616 616
617 /** 617 /**
618 * DLL prev. 618 * DLL prev.
619 */ 619 */
620 struct MeshTreePendingNode *prev; 620 struct CadetTreePendingNode *prev;
621 621
622 /** 622 /**
623 * Pending node. 623 * Pending node.
624 */ 624 */
625 struct MeshTunnelTreeNode *node; 625 struct CadetTunnelTreeNode *node;
626}; 626};
627 627
628 628
@@ -636,18 +636,18 @@ struct MeshTreePendingNode {
636 * TODO: recursive implementation? (s/heap/stack/g) 636 * TODO: recursive implementation? (s/heap/stack/g)
637 */ 637 */
638void 638void
639tree_iterate_all (struct MeshTunnelTree *tree, 639tree_iterate_all (struct CadetTunnelTree *tree,
640 MeshWholeTreeCallback cb, 640 CadetWholeTreeCallback cb,
641 void *cb_cls) 641 void *cb_cls)
642{ 642{
643 struct MeshTunnelTreeNode *parent; 643 struct CadetTunnelTreeNode *parent;
644 struct MeshTunnelTreeNode *n; 644 struct CadetTunnelTreeNode *n;
645 struct MeshTreePendingNode *head; 645 struct CadetTreePendingNode *head;
646 struct MeshTreePendingNode *tail; 646 struct CadetTreePendingNode *tail;
647 struct MeshTreePendingNode *pending; 647 struct CadetTreePendingNode *pending;
648 648
649 cb (cb_cls, tree->root->peer, 0); 649 cb (cb_cls, tree->root->peer, 0);
650 pending = GNUNET_new (struct MeshTreePendingNode); 650 pending = GNUNET_new (struct CadetTreePendingNode);
651 pending->node = tree->root; 651 pending->node = tree->root;
652 head = tail = NULL; 652 head = tail = NULL;
653 GNUNET_CONTAINER_DLL_insert (head, tail, pending); 653 GNUNET_CONTAINER_DLL_insert (head, tail, pending);
@@ -661,7 +661,7 @@ tree_iterate_all (struct MeshTunnelTree *tree,
661 for (n = parent->children_head; NULL != n; n = n->next) 661 for (n = parent->children_head; NULL != n; n = n->next)
662 { 662 {
663 cb (cb_cls, n->peer, parent->peer); 663 cb (cb_cls, n->peer, parent->peer);
664 pending = GNUNET_new (struct MeshTreePendingNode); 664 pending = GNUNET_new (struct CadetTreePendingNode);
665 pending->node = n; 665 pending->node = n;
666 /* Insert_tail: breadth first, Insert: depth first */ 666 /* Insert_tail: breadth first, Insert: depth first */
667 GNUNET_CONTAINER_DLL_insert (head, tail, pending); 667 GNUNET_CONTAINER_DLL_insert (head, tail, pending);
@@ -688,7 +688,7 @@ count_children_cb (void *cls, GNUNET_PEER_Id peer)
688 * @param tree Tree to use. Must have "me" set. 688 * @param tree Tree to use. Must have "me" set.
689 */ 689 */
690unsigned int 690unsigned int
691tree_count_children (struct MeshTunnelTree *tree) 691tree_count_children (struct CadetTunnelTree *tree)
692{ 692{
693 unsigned int i; 693 unsigned int i;
694 694
@@ -707,7 +707,7 @@ tree_count_children (struct MeshTunnelTree *tree)
707 * If not known, NULL to find out and pass on children. 707 * If not known, NULL to find out and pass on children.
708 */ 708 */
709void 709void
710tree_update_first_hops (struct MeshTunnelTree *tree, GNUNET_PEER_Id parent_id, 710tree_update_first_hops (struct CadetTunnelTree *tree, GNUNET_PEER_Id parent_id,
711 struct GNUNET_PeerIdentity *hop) 711 struct GNUNET_PeerIdentity *hop)
712{ 712{
713 tree_node_update_first_hops (tree, tree_find_peer (tree, parent_id), hop); 713 tree_node_update_first_hops (tree, tree_find_peer (tree, parent_id), hop);
@@ -727,15 +727,15 @@ tree_update_first_hops (struct MeshTunnelTree *tree, GNUNET_PEER_Id parent_id,
727 * @return pointer to the pathless node. 727 * @return pointer to the pathless node.
728 * NULL when not found 728 * NULL when not found
729 */ 729 */
730struct MeshTunnelTreeNode * 730struct CadetTunnelTreeNode *
731tree_del_path (struct MeshTunnelTree *t, GNUNET_PEER_Id peer_id, 731tree_del_path (struct CadetTunnelTree *t, GNUNET_PEER_Id peer_id,
732 MeshTreeCallback cb, void *cbcls) 732 CadetTreeCallback cb, void *cbcls)
733{ 733{
734 struct MeshTunnelTreeNode *parent; 734 struct CadetTunnelTreeNode *parent;
735 struct MeshTunnelTreeNode *node; 735 struct CadetTunnelTreeNode *node;
736 struct MeshTunnelTreeNode *n; 736 struct CadetTunnelTreeNode *n;
737 737
738#if MESH_TREE_DEBUG 738#if CADET_TREE_DEBUG
739 struct GNUNET_PeerIdentity id; 739 struct GNUNET_PeerIdentity id;
740 740
741 GNUNET_PEER_resolve (peer_id, &id); 741 GNUNET_PEER_resolve (peer_id, &id);
@@ -764,10 +764,10 @@ tree_del_path (struct MeshTunnelTree *t, GNUNET_PEER_Id peer_id,
764 GNUNET_CONTAINER_DLL_remove (parent->children_head, parent->children_tail, n); 764 GNUNET_CONTAINER_DLL_remove (parent->children_head, parent->children_tail, n);
765 n->parent = NULL; 765 n->parent = NULL;
766 766
767 while (MESH_PEER_RELAY == parent->status && 767 while (CADET_PEER_RELAY == parent->status &&
768 NULL == parent->children_head) 768 NULL == parent->children_head)
769 { 769 {
770#if MESH_TREE_DEBUG 770#if CADET_TREE_DEBUG
771 GNUNET_PEER_resolve (parent->peer, &id); 771 GNUNET_PEER_resolve (parent->peer, &id);
772 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: Deleting node %s.\n", 772 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: Deleting node %s.\n",
773 GNUNET_i2s (&id)); 773 GNUNET_i2s (&id));
@@ -778,7 +778,7 @@ tree_del_path (struct MeshTunnelTree *t, GNUNET_PEER_Id peer_id,
778 tree_node_destroy (parent); 778 tree_node_destroy (parent);
779 parent = n; 779 parent = n;
780 } 780 }
781#if MESH_TREE_DEBUG 781#if CADET_TREE_DEBUG
782 GNUNET_PEER_resolve (parent->peer, &id); 782 GNUNET_PEER_resolve (parent->peer, &id);
783 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: Not deleted peer %s.\n", 783 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: Not deleted peer %s.\n",
784 GNUNET_i2s (&id)); 784 GNUNET_i2s (&id));
@@ -800,11 +800,11 @@ tree_del_path (struct MeshTunnelTree *t, GNUNET_PEER_Id peer_id,
800 * @return A newly allocated individual path to reach the destination peer. 800 * @return A newly allocated individual path to reach the destination peer.
801 * Path must be destroyed afterwards. 801 * Path must be destroyed afterwards.
802 */ 802 */
803struct MeshPeerPath * 803struct CadetPeerPath *
804tree_get_path_to_peer (struct MeshTunnelTree *t, GNUNET_PEER_Id peer) 804tree_get_path_to_peer (struct CadetTunnelTree *t, GNUNET_PEER_Id peer)
805{ 805{
806 struct MeshTunnelTreeNode *n; 806 struct CadetTunnelTreeNode *n;
807 struct MeshPeerPath *p; 807 struct CadetPeerPath *p;
808 808
809 n = tree_find_peer (t, peer); 809 n = tree_find_peer (t, peer);
810 if (NULL == n) 810 if (NULL == n)
@@ -859,18 +859,18 @@ tree_get_path_to_peer (struct MeshTunnelTree *t, GNUNET_PEER_Id peer)
859 * - do not disconnect peers until new path is created & connected 859 * - do not disconnect peers until new path is created & connected
860 */ 860 */
861int 861int
862tree_add_path (struct MeshTunnelTree *t, const struct MeshPeerPath *p, 862tree_add_path (struct CadetTunnelTree *t, const struct CadetPeerPath *p,
863 MeshTreeCallback cb, void *cbcls) 863 CadetTreeCallback cb, void *cbcls)
864{ 864{
865 struct MeshTunnelTreeNode *parent; 865 struct CadetTunnelTreeNode *parent;
866 struct MeshTunnelTreeNode *oldnode; 866 struct CadetTunnelTreeNode *oldnode;
867 struct MeshTunnelTreeNode *n; 867 struct CadetTunnelTreeNode *n;
868 struct MeshTunnelTreeNode *c; 868 struct CadetTunnelTreeNode *c;
869 struct GNUNET_PeerIdentity id; 869 struct GNUNET_PeerIdentity id;
870 int me; 870 int me;
871 unsigned int i; 871 unsigned int i;
872 872
873#if MESH_TREE_DEBUG 873#if CADET_TREE_DEBUG
874 GNUNET_PEER_resolve (p->peers[p->length - 1], &id); 874 GNUNET_PEER_resolve (p->peers[p->length - 1], &id);
875 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 875 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
876 "tree: Adding path [%u] towards peer %s.\n", p->length, 876 "tree: Adding path [%u] towards peer %s.\n", p->length,
@@ -896,7 +896,7 @@ tree_add_path (struct MeshTunnelTree *t, const struct MeshPeerPath *p,
896 me = t->root->peer == 1 ? 0 : -1; 896 me = t->root->peer == 1 ? 0 : -1;
897 for (i = 1; i < p->length; i++) 897 for (i = 1; i < p->length; i++)
898 { 898 {
899#if MESH_TREE_DEBUG 899#if CADET_TREE_DEBUG
900 GNUNET_PEER_resolve (p->peers[i], &id); 900 GNUNET_PEER_resolve (p->peers[i], &id);
901 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: Looking for peer %s.\n", 901 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: Looking for peer %s.\n",
902 GNUNET_i2s (&id)); 902 GNUNET_i2s (&id));
@@ -908,7 +908,7 @@ tree_add_path (struct MeshTunnelTree *t, const struct MeshPeerPath *p,
908 { 908 {
909 if (c->peer == p->peers[i]) 909 if (c->peer == p->peers[i])
910 { 910 {
911#if MESH_TREE_DEBUG 911#if CADET_TREE_DEBUG
912 GNUNET_PEER_resolve (parent->peer, &id); 912 GNUNET_PEER_resolve (parent->peer, &id);
913 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 913 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
914 "tree: Found in children of %s.\n", GNUNET_i2s (&id)); 914 "tree: Found in children of %s.\n", GNUNET_i2s (&id));
@@ -922,13 +922,13 @@ tree_add_path (struct MeshTunnelTree *t, const struct MeshPeerPath *p,
922 if (parent == n) 922 if (parent == n)
923 break; 923 break;
924 } 924 }
925#if MESH_TREE_DEBUG 925#if CADET_TREE_DEBUG
926 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: All childen visited.\n"); 926 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: All childen visited.\n");
927#endif 927#endif
928 /* Add the rest of the path as a branch from parent. */ 928 /* Add the rest of the path as a branch from parent. */
929 while (i < p->length) 929 while (i < p->length)
930 { 930 {
931#if MESH_TREE_DEBUG 931#if CADET_TREE_DEBUG
932 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: Adding peer %u to %u.\n", 932 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: Adding peer %u to %u.\n",
933 p->peers[i], parent->peer); 933 p->peers[i], parent->peer);
934 GNUNET_PEER_resolve (p->peers[i], &id); 934 GNUNET_PEER_resolve (p->peers[i], &id);
@@ -941,7 +941,7 @@ tree_add_path (struct MeshTunnelTree *t, const struct MeshPeerPath *p,
941 941
942 if (i == p->length - 1 && NULL != oldnode) 942 if (i == p->length - 1 && NULL != oldnode)
943 { 943 {
944#if MESH_TREE_DEBUG 944#if CADET_TREE_DEBUG
945 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 945 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
946 "tree: Putting old node into place.\n"); 946 "tree: Putting old node into place.\n");
947#endif 947#endif
@@ -953,11 +953,11 @@ tree_add_path (struct MeshTunnelTree *t, const struct MeshPeerPath *p,
953 } 953 }
954 else 954 else
955 { 955 {
956#if MESH_TREE_DEBUG 956#if CADET_TREE_DEBUG
957 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: Creating new node.\n"); 957 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: Creating new node.\n");
958#endif 958#endif
959 n = tree_node_new (parent, p->peers[i]); 959 n = tree_node_new (parent, p->peers[i]);
960 n->status = MESH_PEER_RELAY; 960 n->status = CADET_PEER_RELAY;
961 } 961 }
962 if (n->peer == 1) 962 if (n->peer == 1)
963 { 963 {
@@ -967,26 +967,26 @@ tree_add_path (struct MeshTunnelTree *t, const struct MeshPeerPath *p,
967 i++; 967 i++;
968 parent = n; 968 parent = n;
969 } 969 }
970 n->status = MESH_PEER_SEARCHING; 970 n->status = CADET_PEER_SEARCHING;
971 971
972 GNUNET_break (-1 != me); 972 GNUNET_break (-1 != me);
973 973
974 /* Add info about first hop into hashmap. */ 974 /* Add info about first hop into hashmap. */
975 if (-1 != me && me < p->length - 1) 975 if (-1 != me && me < p->length - 1)
976 { 976 {
977#if MESH_TREE_DEBUG 977#if CADET_TREE_DEBUG
978 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 978 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
979 "MESH: finding first hop (own pos %d/%u)\n", me, 979 "CADET: finding first hop (own pos %d/%u)\n", me,
980 p->length - 1); 980 p->length - 1);
981#endif 981#endif
982 GNUNET_PEER_resolve (p->peers[me + 1], &id); 982 GNUNET_PEER_resolve (p->peers[me + 1], &id);
983 tree_update_first_hops (t, p->peers[me + 1], &id); 983 tree_update_first_hops (t, p->peers[me + 1], &id);
984 } 984 }
985#if MESH_TREE_DEBUG 985#if CADET_TREE_DEBUG
986 else 986 else
987 { 987 {
988 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 988 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
989 "MESH: was last in path, not updating first hops (%d/%u)\n", 989 "CADET: was last in path, not updating first hops (%d/%u)\n",
990 me, p->length - 1); 990 me, p->length - 1);
991 } 991 }
992 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: New node added.\n"); 992 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: New node added.\n");
@@ -1010,12 +1010,12 @@ tree_add_path (struct MeshTunnelTree *t, const struct MeshPeerPath *p,
1010 * @return Short ID of the first disconnected peer in the tree. 1010 * @return Short ID of the first disconnected peer in the tree.
1011 */ 1011 */
1012GNUNET_PEER_Id 1012GNUNET_PEER_Id
1013tree_notify_connection_broken (struct MeshTunnelTree *t, GNUNET_PEER_Id p1, 1013tree_notify_connection_broken (struct CadetTunnelTree *t, GNUNET_PEER_Id p1,
1014 GNUNET_PEER_Id p2, MeshTreeCallback cb, 1014 GNUNET_PEER_Id p2, CadetTreeCallback cb,
1015 void *cbcls) 1015 void *cbcls)
1016{ 1016{
1017 struct MeshTunnelTreeNode *n; 1017 struct CadetTunnelTreeNode *n;
1018 struct MeshTunnelTreeNode *c; 1018 struct CadetTunnelTreeNode *c;
1019 1019
1020 n = tree_find_peer (t, p1); 1020 n = tree_find_peer (t, p1);
1021 if (NULL == n) 1021 if (NULL == n)
@@ -1057,10 +1057,10 @@ tree_notify_connection_broken (struct MeshTunnelTree *t, GNUNET_PEER_Id p1,
1057 * @return GNUNET_OK or GNUNET_SYSERR 1057 * @return GNUNET_OK or GNUNET_SYSERR
1058 */ 1058 */
1059int 1059int
1060tree_del_peer (struct MeshTunnelTree *t, GNUNET_PEER_Id peer, 1060tree_del_peer (struct CadetTunnelTree *t, GNUNET_PEER_Id peer,
1061 MeshTreeCallback cb, void *cbcls) 1061 CadetTreeCallback cb, void *cbcls)
1062{ 1062{
1063 struct MeshTunnelTreeNode *n; 1063 struct CadetTunnelTreeNode *n;
1064 1064
1065 n = tree_del_path (t, peer, cb, cbcls); 1065 n = tree_del_path (t, peer, cb, cbcls);
1066 if (NULL == n) 1066 if (NULL == n)
@@ -1094,10 +1094,10 @@ tree_del_peer (struct MeshTunnelTree *t, GNUNET_PEER_Id peer,
1094 * TODO: take in account state of the nodes 1094 * TODO: take in account state of the nodes
1095 */ 1095 */
1096unsigned int 1096unsigned int
1097tree_get_path_cost (struct MeshTunnelTree *t, struct MeshPeerPath *path) 1097tree_get_path_cost (struct CadetTunnelTree *t, struct CadetPeerPath *path)
1098{ 1098{
1099 struct MeshTunnelTreeNode *n; 1099 struct CadetTunnelTreeNode *n;
1100 struct MeshTunnelTreeNode *p; 1100 struct CadetTunnelTreeNode *p;
1101 unsigned int i; 1101 unsigned int i;
1102 unsigned int l; 1102 unsigned int l;
1103 1103
@@ -1131,7 +1131,7 @@ tree_get_path_cost (struct MeshTunnelTree *t, struct MeshPeerPath *path)
1131 * @param t The tree 1131 * @param t The tree
1132 */ 1132 */
1133void 1133void
1134tree_debug (struct MeshTunnelTree *t) 1134tree_debug (struct CadetTunnelTree *t)
1135{ 1135{
1136 tree_node_debug (t->root, 0); 1136 tree_node_debug (t->root, 0);
1137 FPRINTF (stderr, "root: %p\n", t->root); 1137 FPRINTF (stderr, "root: %p\n", t->root);
@@ -1162,9 +1162,9 @@ iterate_free (void *cls, const struct GNUNET_HashCode * key, void *value)
1162 * @param t Tree to be destroyed 1162 * @param t Tree to be destroyed
1163 */ 1163 */
1164void 1164void
1165tree_destroy (struct MeshTunnelTree *t) 1165tree_destroy (struct CadetTunnelTree *t)
1166{ 1166{
1167#if MESH_TREE_DEBUG 1167#if CADET_TREE_DEBUG
1168 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: Destroying tree\n"); 1168 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tree: Destroying tree\n");
1169#endif 1169#endif
1170 tree_node_destroy (t->root); 1170 tree_node_destroy (t->root);
diff --git a/src/mesh/mesh_tunnel_tree.h b/src/mesh/mesh_tunnel_tree.h
index e5d65921d..779d330e7 100644
--- a/src/mesh/mesh_tunnel_tree.h
+++ b/src/mesh/mesh_tunnel_tree.h
@@ -19,12 +19,12 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file mesh/mesh_tunnel_tree.h 22 * @file cadet/cadet_tunnel_tree.h
23 * @brief Tunnel tree handling functions 23 * @brief Tunnel tree handling functions
24 * @author Bartlomiej Polot 24 * @author Bartlomiej Polot
25 */ 25 */
26 26
27#include "mesh.h" 27#include "cadet.h"
28 28
29/******************************************************************************/ 29/******************************************************************************/
30/************************ DATA STRUCTURES ****************************/ 30/************************ DATA STRUCTURES ****************************/
@@ -33,14 +33,14 @@
33/** 33/**
34 * Information regarding a possible path to reach a single peer 34 * Information regarding a possible path to reach a single peer
35 */ 35 */
36struct MeshPeerPath 36struct CadetPeerPath
37{ 37{
38 38
39 /** 39 /**
40 * Linked list 40 * Linked list
41 */ 41 */
42 struct MeshPeerPath *next; 42 struct CadetPeerPath *next;
43 struct MeshPeerPath *prev; 43 struct CadetPeerPath *prev;
44 44
45 /** 45 /**
46 * List of all the peers that form the path from origin to target. 46 * List of all the peers that form the path from origin to target.
@@ -58,13 +58,13 @@ struct MeshPeerPath
58/** 58/**
59 * Node of path tree for a tunnel 59 * Node of path tree for a tunnel
60 */ 60 */
61struct MeshTunnelTreeNode; 61struct CadetTunnelTreeNode;
62 62
63 63
64/** 64/**
65 * Tree to reach all peers in the tunnel 65 * Tree to reach all peers in the tunnel
66 */ 66 */
67struct MeshTunnelTree; 67struct CadetTunnelTree;
68 68
69 69
70/******************************************************************************/ 70/******************************************************************************/
@@ -78,7 +78,7 @@ struct MeshTunnelTree;
78 * 78 *
79 * @return A newly allocated path with a peer array of the specified length. 79 * @return A newly allocated path with a peer array of the specified length.
80 */ 80 */
81struct MeshPeerPath * 81struct CadetPeerPath *
82path_new (unsigned int length); 82path_new (unsigned int length);
83 83
84 84
@@ -88,7 +88,7 @@ path_new (unsigned int length);
88 * @param path The path to invert. 88 * @param path The path to invert.
89 */ 89 */
90void 90void
91path_invert (struct MeshPeerPath *path); 91path_invert (struct CadetPeerPath *path);
92 92
93 93
94/** 94/**
@@ -96,8 +96,8 @@ path_invert (struct MeshPeerPath *path);
96 * 96 *
97 * @param path The path to duplicate. 97 * @param path The path to duplicate.
98 */ 98 */
99struct MeshPeerPath * 99struct CadetPeerPath *
100path_duplicate (struct MeshPeerPath *path); 100path_duplicate (struct CadetPeerPath *path);
101 101
102 102
103/** 103/**
@@ -109,7 +109,7 @@ path_duplicate (struct MeshPeerPath *path);
109 * UINT_MAX in case the peer is not in the path. 109 * UINT_MAX in case the peer is not in the path.
110 */ 110 */
111unsigned int 111unsigned int
112path_get_length (struct MeshPeerPath *path); 112path_get_length (struct CadetPeerPath *path);
113 113
114 114
115/** 115/**
@@ -120,7 +120,7 @@ path_get_length (struct MeshPeerPath *path);
120 * @return GNUNET_OK on success 120 * @return GNUNET_OK on success
121 */ 121 */
122int 122int
123path_destroy (struct MeshPeerPath *p); 123path_destroy (struct CadetPeerPath *p);
124 124
125 125
126/******************************************************************************/ 126/******************************************************************************/
@@ -131,7 +131,7 @@ path_destroy (struct MeshPeerPath *p);
131 * @param cls Closure. 131 * @param cls Closure.
132 * @param peer_id Short ID of the peer. 132 * @param peer_id Short ID of the peer.
133 */ 133 */
134typedef void (*MeshTreeCallback) (void *cls, GNUNET_PEER_Id peer_id); 134typedef void (*CadetTreeCallback) (void *cls, GNUNET_PEER_Id peer_id);
135 135
136 136
137/** 137/**
@@ -141,7 +141,7 @@ typedef void (*MeshTreeCallback) (void *cls, GNUNET_PEER_Id peer_id);
141 * @param peer_id Short ID of the peer. 141 * @param peer_id Short ID of the peer.
142 * @param peer_id Short ID of the parent of the peer. 142 * @param peer_id Short ID of the parent of the peer.
143 */ 143 */
144typedef void (*MeshWholeTreeCallback) (void *cls, 144typedef void (*CadetWholeTreeCallback) (void *cls,
145 GNUNET_PEER_Id peer_id, 145 GNUNET_PEER_Id peer_id,
146 GNUNET_PEER_Id parent_id); 146 GNUNET_PEER_Id parent_id);
147 147
@@ -152,7 +152,7 @@ typedef void (*MeshWholeTreeCallback) (void *cls,
152 * 152 *
153 * @return A newly allocated and initialized tunnel tree 153 * @return A newly allocated and initialized tunnel tree
154 */ 154 */
155struct MeshTunnelTree * 155struct CadetTunnelTree *
156tree_new (GNUNET_PEER_Id peer); 156tree_new (GNUNET_PEER_Id peer);
157 157
158 158
@@ -164,8 +164,8 @@ tree_new (GNUNET_PEER_Id peer);
164 * @param status New status to set. 164 * @param status New status to set.
165 */ 165 */
166void 166void
167tree_set_status (struct MeshTunnelTree *tree, GNUNET_PEER_Id peer, 167tree_set_status (struct CadetTunnelTree *tree, GNUNET_PEER_Id peer,
168 enum MeshPeerState status); 168 enum CadetPeerState status);
169 169
170 170
171/** 171/**
@@ -176,8 +176,8 @@ tree_set_status (struct MeshTunnelTree *tree, GNUNET_PEER_Id peer,
176 * 176 *
177 * @return Short peer id of local peer. 177 * @return Short peer id of local peer.
178 */ 178 */
179enum MeshPeerState 179enum CadetPeerState
180tree_get_status (struct MeshTunnelTree *tree, GNUNET_PEER_Id peer); 180tree_get_status (struct CadetTunnelTree *tree, GNUNET_PEER_Id peer);
181 181
182 182
183/** 183/**
@@ -188,7 +188,7 @@ tree_get_status (struct MeshTunnelTree *tree, GNUNET_PEER_Id peer);
188 * @return Short peer id of local peer. 188 * @return Short peer id of local peer.
189 */ 189 */
190GNUNET_PEER_Id 190GNUNET_PEER_Id
191tree_get_predecessor (struct MeshTunnelTree *tree); 191tree_get_predecessor (struct CadetTunnelTree *tree);
192 192
193 193
194/** 194/**
@@ -201,7 +201,7 @@ tree_get_predecessor (struct MeshTunnelTree *tree);
201 * NULL on error 201 * NULL on error
202 */ 202 */
203struct GNUNET_PeerIdentity * 203struct GNUNET_PeerIdentity *
204tree_get_first_hop (struct MeshTunnelTree *t, GNUNET_PEER_Id peer); 204tree_get_first_hop (struct CadetTunnelTree *t, GNUNET_PEER_Id peer);
205 205
206 206
207/** 207/**
@@ -212,8 +212,8 @@ tree_get_first_hop (struct MeshTunnelTree *t, GNUNET_PEER_Id peer);
212 * 212 *
213 * @return Pointer to the node of the peer. NULL if not found. 213 * @return Pointer to the node of the peer. NULL if not found.
214 */ 214 */
215struct MeshTunnelTreeNode * 215struct CadetTunnelTreeNode *
216tree_find_peer (struct MeshTunnelTree *tree, GNUNET_PEER_Id peer_id); 216tree_find_peer (struct CadetTunnelTree *tree, GNUNET_PEER_Id peer_id);
217 217
218 218
219/** 219/**
@@ -224,8 +224,8 @@ tree_find_peer (struct MeshTunnelTree *tree, GNUNET_PEER_Id peer_id);
224 * @param cb_cls Closure for @c cb. 224 * @param cb_cls Closure for @c cb.
225 */ 225 */
226void 226void
227tree_iterate_children (struct MeshTunnelTree *tree, 227tree_iterate_children (struct CadetTunnelTree *tree,
228 MeshTreeCallback cb, 228 CadetTreeCallback cb,
229 void *cb_cls); 229 void *cb_cls);
230 230
231 231
@@ -239,8 +239,8 @@ tree_iterate_children (struct MeshTunnelTree *tree,
239 * TODO: recursive implementation? (s/heap/stack/g) 239 * TODO: recursive implementation? (s/heap/stack/g)
240 */ 240 */
241void 241void
242tree_iterate_all (struct MeshTunnelTree *tree, 242tree_iterate_all (struct CadetTunnelTree *tree,
243 MeshWholeTreeCallback cb, 243 CadetWholeTreeCallback cb,
244 void *cb_cls); 244 void *cb_cls);
245 245
246/** 246/**
@@ -249,7 +249,7 @@ tree_iterate_all (struct MeshTunnelTree *tree,
249 * @param tree Tree to use. Must have "me" set. 249 * @param tree Tree to use. Must have "me" set.
250 */ 250 */
251unsigned int 251unsigned int
252tree_count_children (struct MeshTunnelTree *tree); 252tree_count_children (struct CadetTunnelTree *tree);
253 253
254 254
255/** 255/**
@@ -261,7 +261,7 @@ tree_count_children (struct MeshTunnelTree *tree);
261 * If not known, NULL to find out and pass on children. 261 * If not known, NULL to find out and pass on children.
262 */ 262 */
263void 263void
264tree_update_first_hops (struct MeshTunnelTree *tree, GNUNET_PEER_Id parent_id, 264tree_update_first_hops (struct CadetTunnelTree *tree, GNUNET_PEER_Id parent_id,
265 struct GNUNET_PeerIdentity *hop); 265 struct GNUNET_PeerIdentity *hop);
266 266
267/** 267/**
@@ -278,9 +278,9 @@ tree_update_first_hops (struct MeshTunnelTree *tree, GNUNET_PEER_Id parent_id,
278 * @return pointer to the pathless node. 278 * @return pointer to the pathless node.
279 * NULL when not found 279 * NULL when not found
280 */ 280 */
281struct MeshTunnelTreeNode * 281struct CadetTunnelTreeNode *
282tree_del_path (struct MeshTunnelTree *t, GNUNET_PEER_Id peer_id, 282tree_del_path (struct CadetTunnelTree *t, GNUNET_PEER_Id peer_id,
283 MeshTreeCallback cb, void *cbcls); 283 CadetTreeCallback cb, void *cbcls);
284 284
285 285
286/** 286/**
@@ -293,8 +293,8 @@ tree_del_path (struct MeshTunnelTree *t, GNUNET_PEER_Id peer_id,
293 * @return A newly allocated individual path to reach the destination peer. 293 * @return A newly allocated individual path to reach the destination peer.
294 * Path must be destroyed afterwards. 294 * Path must be destroyed afterwards.
295 */ 295 */
296struct MeshPeerPath * 296struct CadetPeerPath *
297tree_get_path_to_peer (struct MeshTunnelTree *t, GNUNET_PEER_Id peer); 297tree_get_path_to_peer (struct CadetTunnelTree *t, GNUNET_PEER_Id peer);
298 298
299 299
300/** 300/**
@@ -309,8 +309,8 @@ tree_get_path_to_peer (struct MeshTunnelTree *t, GNUNET_PEER_Id peer);
309 * GNUNET_SYSERR in case of error. 309 * GNUNET_SYSERR in case of error.
310 */ 310 */
311int 311int
312tree_add_path (struct MeshTunnelTree *t, const struct MeshPeerPath *p, 312tree_add_path (struct CadetTunnelTree *t, const struct CadetPeerPath *p,
313 MeshTreeCallback cb, void *cbcls); 313 CadetTreeCallback cb, void *cbcls);
314 314
315 315
316/** 316/**
@@ -326,8 +326,8 @@ tree_add_path (struct MeshTunnelTree *t, const struct MeshPeerPath *p,
326 * @return Short ID of the first disconnected peer in the tree. 326 * @return Short ID of the first disconnected peer in the tree.
327 */ 327 */
328GNUNET_PEER_Id 328GNUNET_PEER_Id
329tree_notify_connection_broken (struct MeshTunnelTree *t, GNUNET_PEER_Id p1, 329tree_notify_connection_broken (struct CadetTunnelTree *t, GNUNET_PEER_Id p1,
330 GNUNET_PEER_Id p2, MeshTreeCallback cb, 330 GNUNET_PEER_Id p2, CadetTreeCallback cb,
331 void *cbcls); 331 void *cbcls);
332 332
333 333
@@ -347,8 +347,8 @@ tree_notify_connection_broken (struct MeshTunnelTree *t, GNUNET_PEER_Id p1,
347 * @return GNUNET_YES if the tunnel still has nodes 347 * @return GNUNET_YES if the tunnel still has nodes
348 */ 348 */
349int 349int
350tree_del_peer (struct MeshTunnelTree *t, GNUNET_PEER_Id peer, 350tree_del_peer (struct CadetTunnelTree *t, GNUNET_PEER_Id peer,
351 MeshTreeCallback cb, void *cbcls); 351 CadetTreeCallback cb, void *cbcls);
352 352
353 353
354/** 354/**
@@ -361,7 +361,7 @@ tree_del_peer (struct MeshTunnelTree *t, GNUNET_PEER_Id peer,
361 * in the path 361 * in the path
362 */ 362 */
363unsigned int 363unsigned int
364tree_get_path_cost (struct MeshTunnelTree *t, struct MeshPeerPath *path); 364tree_get_path_cost (struct CadetTunnelTree *t, struct CadetPeerPath *path);
365 365
366 366
367/** 367/**
@@ -370,7 +370,7 @@ tree_get_path_cost (struct MeshTunnelTree *t, struct MeshPeerPath *path);
370 * @param t The tree 370 * @param t The tree
371 */ 371 */
372void 372void
373tree_debug (struct MeshTunnelTree *t); 373tree_debug (struct CadetTunnelTree *t);
374 374
375 375
376/** 376/**
@@ -379,4 +379,4 @@ tree_debug (struct MeshTunnelTree *t);
379 * @param t Tree to be destroyed 379 * @param t Tree to be destroyed
380 */ 380 */
381void 381void
382tree_destroy (struct MeshTunnelTree *t); 382tree_destroy (struct CadetTunnelTree *t);
diff --git a/src/mesh/test_mesh.c b/src/mesh/test_mesh.c
index f63e63aa4..ac2661a86 100644
--- a/src/mesh/test_mesh.c
+++ b/src/mesh/test_mesh.c
@@ -18,14 +18,14 @@
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20/** 20/**
21 * @file mesh/test_mesh.c 21 * @file cadet/test_cadet.c
22 * 22 *
23 * @brief Test for the mesh service: retransmission of traffic. 23 * @brief Test for the cadet service: retransmission of traffic.
24 */ 24 */
25#include <stdio.h> 25#include <stdio.h>
26#include "platform.h" 26#include "platform.h"
27#include "mesh_test_lib.h" 27#include "cadet_test_lib.h"
28#include "gnunet_mesh_service.h" 28#include "gnunet_cadet_service.h"
29#include "gnunet_statistics_service.h" 29#include "gnunet_statistics_service.h"
30#include <gauger.h> 30#include <gauger.h>
31 31
@@ -129,7 +129,7 @@ static unsigned long long peers_running;
129/** 129/**
130 * Test context (to shut down). 130 * Test context (to shut down).
131 */ 131 */
132struct GNUNET_MESH_TEST_Context *test_ctx; 132struct GNUNET_CADET_TEST_Context *test_ctx;
133 133
134/** 134/**
135 * Task called to disconnect peers. 135 * Task called to disconnect peers.
@@ -147,24 +147,24 @@ static GNUNET_SCHEDULER_TaskIdentifier test_task;
147static GNUNET_SCHEDULER_TaskIdentifier shutdown_handle; 147static GNUNET_SCHEDULER_TaskIdentifier shutdown_handle;
148 148
149/** 149/**
150 * Mesh handle for the root peer 150 * Cadet handle for the root peer
151 */ 151 */
152static struct GNUNET_MESH_Handle *h1; 152static struct GNUNET_CADET_Handle *h1;
153 153
154/** 154/**
155 * Mesh handle for the first leaf peer 155 * Cadet handle for the first leaf peer
156 */ 156 */
157static struct GNUNET_MESH_Handle *h2; 157static struct GNUNET_CADET_Handle *h2;
158 158
159/** 159/**
160 * Channel handle for the root peer 160 * Channel handle for the root peer
161 */ 161 */
162static struct GNUNET_MESH_Channel *ch; 162static struct GNUNET_CADET_Channel *ch;
163 163
164/** 164/**
165 * Channel handle for the dest peer 165 * Channel handle for the dest peer
166 */ 166 */
167static struct GNUNET_MESH_Channel *incoming_ch; 167static struct GNUNET_CADET_Channel *incoming_ch;
168 168
169/** 169/**
170 * Time we started the data transmission (after channel has been established 170 * Time we started the data transmission (after channel has been established
@@ -212,7 +212,7 @@ show_end_data (void)
212 4 * TOTAL_PACKETS * 1.0 / (total_time.rel_value_us / 1000)); // 4bytes * ms 212 4 * TOTAL_PACKETS * 1.0 / (total_time.rel_value_us / 1000)); // 4bytes * ms
213 FPRINTF (stderr, "Test throughput: %f packets/s\n\n", 213 FPRINTF (stderr, "Test throughput: %f packets/s\n\n",
214 TOTAL_PACKETS * 1000.0 / (total_time.rel_value_us / 1000)); // packets * ms 214 TOTAL_PACKETS * 1000.0 / (total_time.rel_value_us / 1000)); // packets * ms
215 GAUGER ("MESH", test_name, 215 GAUGER ("CADET", test_name,
216 TOTAL_PACKETS * 1000.0 / (total_time.rel_value_us / 1000), 216 TOTAL_PACKETS * 1000.0 / (total_time.rel_value_us / 1000),
217 "packets/s"); 217 "packets/s");
218} 218}
@@ -233,19 +233,19 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
233 233
234 234
235/** 235/**
236 * Disconnect from mesh services af all peers, call shutdown. 236 * Disconnect from cadet services af all peers, call shutdown.
237 * 237 *
238 * @param cls Closure (unused). 238 * @param cls Closure (unused).
239 * @param tc Task Context. 239 * @param tc Task Context.
240 */ 240 */
241static void 241static void
242disconnect_mesh_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 242disconnect_cadet_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
243{ 243{
244 long line = (long) cls; 244 long line = (long) cls;
245 unsigned int i; 245 unsigned int i;
246 246
247 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 247 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
248 "disconnecting mesh service of peers, called from line %ld\n", 248 "disconnecting cadet service of peers, called from line %ld\n",
249 line); 249 line);
250 disconnect_task = GNUNET_SCHEDULER_NO_TASK; 250 disconnect_task = GNUNET_SCHEDULER_NO_TASK;
251 for (i = 0; i < 2; i++) 251 for (i = 0; i < 2; i++)
@@ -254,15 +254,15 @@ disconnect_mesh_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
254 } 254 }
255 if (NULL != ch) 255 if (NULL != ch)
256 { 256 {
257 GNUNET_MESH_channel_destroy (ch); 257 GNUNET_CADET_channel_destroy (ch);
258 ch = NULL; 258 ch = NULL;
259 } 259 }
260 if (NULL != incoming_ch) 260 if (NULL != incoming_ch)
261 { 261 {
262 GNUNET_MESH_channel_destroy (incoming_ch); 262 GNUNET_CADET_channel_destroy (incoming_ch);
263 incoming_ch = NULL; 263 incoming_ch = NULL;
264 } 264 }
265 GNUNET_MESH_TEST_cleanup (test_ctx); 265 GNUNET_CADET_TEST_cleanup (test_ctx);
266 if (GNUNET_SCHEDULER_NO_TASK != shutdown_handle) 266 if (GNUNET_SCHEDULER_NO_TASK != shutdown_handle)
267 { 267 {
268 GNUNET_SCHEDULER_cancel (shutdown_handle); 268 GNUNET_SCHEDULER_cancel (shutdown_handle);
@@ -282,7 +282,7 @@ abort_test (long line)
282 if (disconnect_task != GNUNET_SCHEDULER_NO_TASK) 282 if (disconnect_task != GNUNET_SCHEDULER_NO_TASK)
283 { 283 {
284 GNUNET_SCHEDULER_cancel (disconnect_task); 284 GNUNET_SCHEDULER_cancel (disconnect_task);
285 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_mesh_peers, 285 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers,
286 (void *) line); 286 (void *) line);
287 } 287 }
288} 288}
@@ -309,8 +309,8 @@ tmt_rdy (void *cls, size_t size, void *buf);
309static void 309static void
310data_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 310data_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
311{ 311{
312 struct GNUNET_MESH_TransmitHandle *th; 312 struct GNUNET_CADET_TransmitHandle *th;
313 struct GNUNET_MESH_Channel *channel; 313 struct GNUNET_CADET_Channel *channel;
314 314
315 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0) 315 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
316 return; 316 return;
@@ -324,7 +324,7 @@ data_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
324 { 324 {
325 channel = ch; 325 channel = ch;
326 } 326 }
327 th = GNUNET_MESH_notify_transmit_ready (channel, GNUNET_NO, 327 th = GNUNET_CADET_notify_transmit_ready (channel, GNUNET_NO,
328 GNUNET_TIME_UNIT_FOREVER_REL, 328 GNUNET_TIME_UNIT_FOREVER_REL,
329 size_payload, &tmt_rdy, (void *) 1L); 329 size_payload, &tmt_rdy, (void *) 1L);
330 if (NULL == th) 330 if (NULL == th)
@@ -405,7 +405,7 @@ tmt_rdy (void *cls, size_t size, void *buf)
405/** 405/**
406 * Function is called whenever a message is received. 406 * Function is called whenever a message is received.
407 * 407 *
408 * @param cls closure (set from GNUNET_MESH_connect) 408 * @param cls closure (set from GNUNET_CADET_connect)
409 * @param channel connection to the other end 409 * @param channel connection to the other end
410 * @param channel_ctx place to store local state associated with the channel 410 * @param channel_ctx place to store local state associated with the channel
411 * @param message the actual message 411 * @param message the actual message
@@ -413,7 +413,7 @@ tmt_rdy (void *cls, size_t size, void *buf)
413 * GNUNET_SYSERR to close it (signal serious error) 413 * GNUNET_SYSERR to close it (signal serious error)
414 */ 414 */
415int 415int
416data_callback (void *cls, struct GNUNET_MESH_Channel *channel, 416data_callback (void *cls, struct GNUNET_CADET_Channel *channel,
417 void **channel_ctx, 417 void **channel_ctx,
418 const struct GNUNET_MessageHeader *message) 418 const struct GNUNET_MessageHeader *message)
419{ 419{
@@ -423,7 +423,7 @@ data_callback (void *cls, struct GNUNET_MESH_Channel *channel,
423 423
424 ok++; 424 ok++;
425 425
426 GNUNET_MESH_receive_done (channel); 426 GNUNET_CADET_receive_done (channel);
427 427
428 if ((ok % 20) == 0) 428 if ((ok % 20) == 0)
429 { 429 {
@@ -431,7 +431,7 @@ data_callback (void *cls, struct GNUNET_MESH_Channel *channel,
431 { 431 {
432 GNUNET_SCHEDULER_cancel (disconnect_task); 432 GNUNET_SCHEDULER_cancel (disconnect_task);
433 disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME, 433 disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
434 &disconnect_mesh_peers, 434 &disconnect_cadet_peers,
435 (void *) __LINE__); 435 (void *) __LINE__);
436 } 436 }
437 } 437 }
@@ -480,7 +480,7 @@ data_callback (void *cls, struct GNUNET_MESH_Channel *channel,
480 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " received data %u\n", data_received); 480 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " received data %u\n", data_received);
481 if (SPEED != test || (ok_goal - 2) == ok) 481 if (SPEED != test || (ok_goal - 2) == ok)
482 { 482 {
483 GNUNET_MESH_notify_transmit_ready (channel, GNUNET_NO, 483 GNUNET_CADET_notify_transmit_ready (channel, GNUNET_NO,
484 GNUNET_TIME_UNIT_FOREVER_REL, 484 GNUNET_TIME_UNIT_FOREVER_REL,
485 size_payload, &tmt_rdy, (void *) 1L); 485 size_payload, &tmt_rdy, (void *) 1L);
486 return GNUNET_OK; 486 return GNUNET_OK;
@@ -497,7 +497,7 @@ data_callback (void *cls, struct GNUNET_MESH_Channel *channel,
497 { 497 {
498 data_ack++; 498 data_ack++;
499 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " received ack %u\n", data_ack); 499 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " received ack %u\n", data_ack);
500 GNUNET_MESH_notify_transmit_ready (channel, GNUNET_NO, 500 GNUNET_CADET_notify_transmit_ready (channel, GNUNET_NO,
501 GNUNET_TIME_UNIT_FOREVER_REL, 501 GNUNET_TIME_UNIT_FOREVER_REL,
502 size_payload, &tmt_rdy, (void *) 1L); 502 size_payload, &tmt_rdy, (void *) 1L);
503 if (data_ack < TOTAL_PACKETS && SPEED != test) 503 if (data_ack < TOTAL_PACKETS && SPEED != test)
@@ -508,12 +508,12 @@ data_callback (void *cls, struct GNUNET_MESH_Channel *channel,
508 } 508 }
509 if (test == P2P_SIGNAL) 509 if (test == P2P_SIGNAL)
510 { 510 {
511 GNUNET_MESH_channel_destroy (incoming_ch); 511 GNUNET_CADET_channel_destroy (incoming_ch);
512 incoming_ch = NULL; 512 incoming_ch = NULL;
513 } 513 }
514 else 514 else
515 { 515 {
516 GNUNET_MESH_channel_destroy (ch); 516 GNUNET_CADET_channel_destroy (ch);
517 ch = NULL; 517 ch = NULL;
518 } 518 }
519 } 519 }
@@ -522,7 +522,7 @@ data_callback (void *cls, struct GNUNET_MESH_Channel *channel,
522 { 522 {
523 GNUNET_SCHEDULER_cancel (disconnect_task); 523 GNUNET_SCHEDULER_cancel (disconnect_task);
524 disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME, 524 disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
525 &disconnect_mesh_peers, 525 &disconnect_cadet_peers,
526 (void *) __LINE__); 526 (void *) __LINE__);
527 } 527 }
528 528
@@ -551,7 +551,7 @@ stats_cont (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg)
551 551
552 if (GNUNET_SCHEDULER_NO_TASK != disconnect_task) 552 if (GNUNET_SCHEDULER_NO_TASK != disconnect_task)
553 GNUNET_SCHEDULER_cancel (disconnect_task); 553 GNUNET_SCHEDULER_cancel (disconnect_task);
554 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_mesh_peers, 554 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers,
555 (void *) __LINE__); 555 (void *) __LINE__);
556 556
557} 557}
@@ -604,9 +604,9 @@ check_keepalives (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
604 604
605 disconnect_task = GNUNET_SCHEDULER_NO_TASK; 605 disconnect_task = GNUNET_SCHEDULER_NO_TASK;
606 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "check keepalives\n"); 606 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "check keepalives\n");
607 GNUNET_MESH_channel_destroy (ch); 607 GNUNET_CADET_channel_destroy (ch);
608 stats_op = GNUNET_TESTBED_get_statistics (5, testbed_peers, 608 stats_op = GNUNET_TESTBED_get_statistics (5, testbed_peers,
609 "mesh", NULL, 609 "cadet", NULL,
610 stats_iterator, stats_cont, NULL); 610 stats_iterator, stats_cont, NULL);
611} 611}
612 612
@@ -614,7 +614,7 @@ check_keepalives (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
614/** 614/**
615 * Handlers, for diverse services 615 * Handlers, for diverse services
616 */ 616 */
617static struct GNUNET_MESH_MessageHandler handlers[] = { 617static struct GNUNET_CADET_MessageHandler handlers[] = {
618 {&data_callback, 1, sizeof (struct GNUNET_MessageHeader)}, 618 {&data_callback, 1, sizeof (struct GNUNET_MessageHeader)},
619 {NULL, 0, 0} 619 {NULL, 0, 0}
620}; 620};
@@ -633,9 +633,9 @@ static struct GNUNET_MESH_MessageHandler handlers[] = {
633 * (can be NULL -- that's not an error). 633 * (can be NULL -- that's not an error).
634 */ 634 */
635static void * 635static void *
636incoming_channel (void *cls, struct GNUNET_MESH_Channel *channel, 636incoming_channel (void *cls, struct GNUNET_CADET_Channel *channel,
637 const struct GNUNET_PeerIdentity *initiator, 637 const struct GNUNET_PeerIdentity *initiator,
638 uint32_t port, enum GNUNET_MESH_ChannelOption options) 638 uint32_t port, enum GNUNET_CADET_ChannelOption options)
639{ 639{
640 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 640 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
641 "Incoming channel from %s to peer %d\n", 641 "Incoming channel from %s to peer %d\n",
@@ -662,7 +662,7 @@ incoming_channel (void *cls, struct GNUNET_MESH_Channel *channel,
662 } 662 }
663 else 663 else
664 disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME, 664 disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
665 &disconnect_mesh_peers, 665 &disconnect_cadet_peers,
666 (void *) __LINE__); 666 (void *) __LINE__);
667 } 667 }
668 668
@@ -673,13 +673,13 @@ incoming_channel (void *cls, struct GNUNET_MESH_Channel *channel,
673 * Function called whenever an inbound channel is destroyed. Should clean up 673 * Function called whenever an inbound channel is destroyed. Should clean up
674 * any associated state. 674 * any associated state.
675 * 675 *
676 * @param cls closure (set from GNUNET_MESH_connect) 676 * @param cls closure (set from GNUNET_CADET_connect)
677 * @param channel connection to the other end (henceforth invalid) 677 * @param channel connection to the other end (henceforth invalid)
678 * @param channel_ctx place where local state associated 678 * @param channel_ctx place where local state associated
679 * with the channel is stored 679 * with the channel is stored
680 */ 680 */
681static void 681static void
682channel_cleaner (void *cls, const struct GNUNET_MESH_Channel *channel, 682channel_cleaner (void *cls, const struct GNUNET_CADET_Channel *channel,
683 void *channel_ctx) 683 void *channel_ctx)
684{ 684{
685 long i = (long) cls; 685 long i = (long) cls;
@@ -709,7 +709,7 @@ channel_cleaner (void *cls, const struct GNUNET_MESH_Channel *channel,
709 if (GNUNET_SCHEDULER_NO_TASK != disconnect_task) 709 if (GNUNET_SCHEDULER_NO_TASK != disconnect_task)
710 { 710 {
711 GNUNET_SCHEDULER_cancel (disconnect_task); 711 GNUNET_SCHEDULER_cancel (disconnect_task);
712 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_mesh_peers, 712 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers,
713 (void *) __LINE__); 713 (void *) __LINE__);
714 } 714 }
715 715
@@ -718,7 +718,7 @@ channel_cleaner (void *cls, const struct GNUNET_MESH_Channel *channel,
718 718
719 719
720/** 720/**
721 * START THE TESTCASE ITSELF, AS WE ARE CONNECTED TO THE MESH SERVICES. 721 * START THE TESTCASE ITSELF, AS WE ARE CONNECTED TO THE CADET SERVICES.
722 * 722 *
723 * Testcase continues when the root receives confirmation of connected peers, 723 * Testcase continues when the root receives confirmation of connected peers,
724 * on callback funtion ch. 724 * on callback funtion ch.
@@ -729,7 +729,7 @@ channel_cleaner (void *cls, const struct GNUNET_MESH_Channel *channel,
729static void 729static void
730do_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 730do_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
731{ 731{
732 enum GNUNET_MESH_ChannelOption flags; 732 enum GNUNET_CADET_ChannelOption flags;
733 733
734 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0) 734 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
735 return; 735 return;
@@ -741,16 +741,16 @@ do_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
741 GNUNET_SCHEDULER_cancel (disconnect_task); 741 GNUNET_SCHEDULER_cancel (disconnect_task);
742 } 742 }
743 743
744 flags = GNUNET_MESH_OPTION_DEFAULT; 744 flags = GNUNET_CADET_OPTION_DEFAULT;
745 if (SPEED_REL == test) 745 if (SPEED_REL == test)
746 { 746 {
747 test = SPEED; 747 test = SPEED;
748 flags |= GNUNET_MESH_OPTION_RELIABLE; 748 flags |= GNUNET_CADET_OPTION_RELIABLE;
749 } 749 }
750 ch = GNUNET_MESH_channel_create (h1, NULL, p_id[1], 1, flags); 750 ch = GNUNET_CADET_channel_create (h1, NULL, p_id[1], 1, flags);
751 751
752 disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME, 752 disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
753 &disconnect_mesh_peers, 753 &disconnect_cadet_peers,
754 (void *) __LINE__); 754 (void *) __LINE__);
755 if (KEEPALIVE == test) 755 if (KEEPALIVE == test)
756 return; /* Don't send any data. */ 756 return; /* Don't send any data. */
@@ -760,7 +760,7 @@ do_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
760 data_ack = 0; 760 data_ack = 0;
761 data_received = 0; 761 data_received = 0;
762 data_sent = 0; 762 data_sent = 0;
763 GNUNET_MESH_notify_transmit_ready (ch, GNUNET_NO, 763 GNUNET_CADET_notify_transmit_ready (ch, GNUNET_NO,
764 GNUNET_TIME_UNIT_FOREVER_REL, 764 GNUNET_TIME_UNIT_FOREVER_REL,
765 size_payload, &tmt_rdy, (void *) 1L); 765 size_payload, &tmt_rdy, (void *) 1L);
766} 766}
@@ -804,27 +804,27 @@ pi_cb (void *cls,
804 * test main: start test when all peers are connected 804 * test main: start test when all peers are connected
805 * 805 *
806 * @param cls Closure. 806 * @param cls Closure.
807 * @param ctx Argument to give to GNUNET_MESH_TEST_cleanup on test end. 807 * @param ctx Argument to give to GNUNET_CADET_TEST_cleanup on test end.
808 * @param num_peers Number of peers that are running. 808 * @param num_peers Number of peers that are running.
809 * @param peers Array of peers. 809 * @param peers Array of peers.
810 * @param meshes Handle to each of the MESHs of the peers. 810 * @param cadetes Handle to each of the CADETs of the peers.
811 */ 811 */
812static void 812static void
813tmain (void *cls, 813tmain (void *cls,
814 struct GNUNET_MESH_TEST_Context *ctx, 814 struct GNUNET_CADET_TEST_Context *ctx,
815 unsigned int num_peers, 815 unsigned int num_peers,
816 struct GNUNET_TESTBED_Peer **peers, 816 struct GNUNET_TESTBED_Peer **peers,
817 struct GNUNET_MESH_Handle **meshes) 817 struct GNUNET_CADET_Handle **cadetes)
818{ 818{
819 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test main\n"); 819 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test main\n");
820 ok = 0; 820 ok = 0;
821 test_ctx = ctx; 821 test_ctx = ctx;
822 peers_running = num_peers; 822 peers_running = num_peers;
823 testbed_peers = peers; 823 testbed_peers = peers;
824 h1 = meshes[0]; 824 h1 = cadetes[0];
825 h2 = meshes[num_peers - 1]; 825 h2 = cadetes[num_peers - 1];
826 disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME, 826 disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
827 &disconnect_mesh_peers, 827 &disconnect_cadet_peers,
828 (void *) __LINE__); 828 (void *) __LINE__);
829 shutdown_handle = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 829 shutdown_handle = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
830 &shutdown_task, NULL); 830 &shutdown_task, NULL);
@@ -849,24 +849,24 @@ main (int argc, char *argv[])
849 const char *config_file; 849 const char *config_file;
850 850
851 GNUNET_log_setup ("test", "DEBUG", NULL); 851 GNUNET_log_setup ("test", "DEBUG", NULL);
852 config_file = "test_mesh.conf"; 852 config_file = "test_cadet.conf";
853 853
854 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Start\n"); 854 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Start\n");
855 if (strstr (argv[0], "_mesh_forward") != NULL) 855 if (strstr (argv[0], "_cadet_forward") != NULL)
856 { 856 {
857 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "FORWARD\n"); 857 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "FORWARD\n");
858 test = FORWARD; 858 test = FORWARD;
859 test_name = "unicast"; 859 test_name = "unicast";
860 ok_goal = 4; 860 ok_goal = 4;
861 } 861 }
862 else if (strstr (argv[0], "_mesh_signal") != NULL) 862 else if (strstr (argv[0], "_cadet_signal") != NULL)
863 { 863 {
864 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "SIGNAL\n"); 864 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "SIGNAL\n");
865 test = P2P_SIGNAL; 865 test = P2P_SIGNAL;
866 test_name = "signal"; 866 test_name = "signal";
867 ok_goal = 4; 867 ok_goal = 4;
868 } 868 }
869 else if (strstr (argv[0], "_mesh_speed_ack") != NULL) 869 else if (strstr (argv[0], "_cadet_speed_ack") != NULL)
870 { 870 {
871 /* Test is supposed to generate the following callbacks: 871 /* Test is supposed to generate the following callbacks:
872 * 1 incoming channel (@dest) 872 * 1 incoming channel (@dest)
@@ -879,7 +879,7 @@ main (int argc, char *argv[])
879 test = SPEED_ACK; 879 test = SPEED_ACK;
880 test_name = "speed ack"; 880 test_name = "speed ack";
881 } 881 }
882 else if (strstr (argv[0], "_mesh_speed") != NULL) 882 else if (strstr (argv[0], "_cadet_speed") != NULL)
883 { 883 {
884 /* Test is supposed to generate the following callbacks: 884 /* Test is supposed to generate the following callbacks:
885 * 1 incoming channel (@dest) 885 * 1 incoming channel (@dest)
@@ -894,7 +894,7 @@ main (int argc, char *argv[])
894 { 894 {
895 test = SPEED_REL; 895 test = SPEED_REL;
896 test_name = "speed reliable"; 896 test_name = "speed reliable";
897 config_file = "test_mesh_drop.conf"; 897 config_file = "test_cadet_drop.conf";
898 } 898 }
899 else 899 else
900 { 900 {
@@ -929,7 +929,7 @@ main (int argc, char *argv[])
929 p_ids = 0; 929 p_ids = 0;
930 ports[0] = 1; 930 ports[0] = 1;
931 ports[1] = 0; 931 ports[1] = 0;
932 GNUNET_MESH_TEST_run ("test_mesh_small", 932 GNUNET_CADET_TEST_run ("test_cadet_small",
933 config_file, 933 config_file,
934 5, 934 5,
935 &tmain, 935 &tmain,
@@ -949,5 +949,5 @@ main (int argc, char *argv[])
949 return 0; 949 return 0;
950} 950}
951 951
952/* end of test_mesh.c */ 952/* end of test_cadet.c */
953 953
diff --git a/src/mesh/test_mesh_local.c b/src/mesh/test_mesh_local.c
index 7ea3f1595..0796aaf12 100644
--- a/src/mesh/test_mesh_local.c
+++ b/src/mesh/test_mesh_local.c
@@ -19,8 +19,8 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file mesh/test_mesh_local.c 22 * @file cadet/test_cadet_local.c
23 * @brief test mesh local: test of mesh channels with just one peer 23 * @brief test cadet local: test of cadet channels with just one peer
24 * @author Bartlomiej Polot 24 * @author Bartlomiej Polot
25 */ 25 */
26 26
@@ -28,15 +28,15 @@
28#include "gnunet_util_lib.h" 28#include "gnunet_util_lib.h"
29#include "gnunet_dht_service.h" 29#include "gnunet_dht_service.h"
30#include "gnunet_testing_lib.h" 30#include "gnunet_testing_lib.h"
31#include "gnunet_mesh_service.h" 31#include "gnunet_cadet_service.h"
32 32
33struct GNUNET_TESTING_Peer *me; 33struct GNUNET_TESTING_Peer *me;
34 34
35static struct GNUNET_MESH_Handle *mesh_peer_1; 35static struct GNUNET_CADET_Handle *cadet_peer_1;
36 36
37static struct GNUNET_MESH_Handle *mesh_peer_2; 37static struct GNUNET_CADET_Handle *cadet_peer_2;
38 38
39static struct GNUNET_MESH_Channel *ch; 39static struct GNUNET_CADET_Channel *ch;
40 40
41static int result = GNUNET_OK; 41static int result = GNUNET_OK;
42 42
@@ -46,7 +46,7 @@ static GNUNET_SCHEDULER_TaskIdentifier abort_task;
46 46
47static GNUNET_SCHEDULER_TaskIdentifier shutdown_task; 47static GNUNET_SCHEDULER_TaskIdentifier shutdown_task;
48 48
49static struct GNUNET_MESH_TransmitHandle *mth; 49static struct GNUNET_CADET_TransmitHandle *mth;
50 50
51 51
52/** 52/**
@@ -72,17 +72,17 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
72 } 72 }
73 if (NULL != ch) 73 if (NULL != ch)
74 { 74 {
75 GNUNET_MESH_channel_destroy (ch); 75 GNUNET_CADET_channel_destroy (ch);
76 } 76 }
77 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnect client 1\n"); 77 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnect client 1\n");
78 if (NULL != mesh_peer_1) 78 if (NULL != cadet_peer_1)
79 { 79 {
80 GNUNET_MESH_disconnect (mesh_peer_1); 80 GNUNET_CADET_disconnect (cadet_peer_1);
81 } 81 }
82 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnect client 2\n"); 82 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnect client 2\n");
83 if (NULL != mesh_peer_2) 83 if (NULL != cadet_peer_2)
84 { 84 {
85 GNUNET_MESH_disconnect (mesh_peer_2); 85 GNUNET_CADET_disconnect (cadet_peer_2);
86 } 86 }
87} 87}
88 88
@@ -108,7 +108,7 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
108/** 108/**
109 * Function is called whenever a message is received. 109 * Function is called whenever a message is received.
110 * 110 *
111 * @param cls closure (set from GNUNET_MESH_connect) 111 * @param cls closure (set from GNUNET_CADET_connect)
112 * @param channel connection to the other end 112 * @param channel connection to the other end
113 * @param channel_ctx place to store local state associated with the channel 113 * @param channel_ctx place to store local state associated with the channel
114 * @param message the actual message 114 * @param message the actual message
@@ -117,7 +117,7 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
117 * GNUNET_SYSERR to close it (signal serious error) 117 * GNUNET_SYSERR to close it (signal serious error)
118 */ 118 */
119static int 119static int
120data_callback (void *cls, struct GNUNET_MESH_Channel *channel, 120data_callback (void *cls, struct GNUNET_CADET_Channel *channel,
121 void **channel_ctx, 121 void **channel_ctx,
122 const struct GNUNET_MessageHeader *message) 122 const struct GNUNET_MessageHeader *message)
123{ 123{
@@ -128,7 +128,7 @@ data_callback (void *cls, struct GNUNET_MESH_Channel *channel,
128 shutdown_task = 128 shutdown_task =
129 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &do_shutdown, 129 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &do_shutdown,
130 NULL); 130 NULL);
131 GNUNET_MESH_receive_done (channel); 131 GNUNET_CADET_receive_done (channel);
132 return GNUNET_OK; 132 return GNUNET_OK;
133} 133}
134 134
@@ -146,9 +146,9 @@ data_callback (void *cls, struct GNUNET_MESH_Channel *channel,
146 * (can be NULL -- that's not an error) 146 * (can be NULL -- that's not an error)
147 */ 147 */
148static void * 148static void *
149inbound_channel (void *cls, struct GNUNET_MESH_Channel *channel, 149inbound_channel (void *cls, struct GNUNET_CADET_Channel *channel,
150 const struct GNUNET_PeerIdentity *initiator, 150 const struct GNUNET_PeerIdentity *initiator,
151 uint32_t port, enum GNUNET_MESH_ChannelOption options) 151 uint32_t port, enum GNUNET_CADET_ChannelOption options)
152{ 152{
153 long id = (long) cls; 153 long id = (long) cls;
154 154
@@ -169,13 +169,13 @@ inbound_channel (void *cls, struct GNUNET_MESH_Channel *channel,
169 * Function called whenever an channel is destroyed. Should clean up 169 * Function called whenever an channel is destroyed. Should clean up
170 * any associated state. 170 * any associated state.
171 * 171 *
172 * @param cls closure (set from GNUNET_MESH_connect) 172 * @param cls closure (set from GNUNET_CADET_connect)
173 * @param channel connection to the other end (henceforth invalid) 173 * @param channel connection to the other end (henceforth invalid)
174 * @param channel_ctx place where local state associated 174 * @param channel_ctx place where local state associated
175 * with the channel is stored 175 * with the channel is stored
176 */ 176 */
177static void 177static void
178channel_end (void *cls, const struct GNUNET_MESH_Channel *channel, 178channel_end (void *cls, const struct GNUNET_CADET_Channel *channel,
179 void *channel_ctx) 179 void *channel_ctx)
180{ 180{
181 long id = (long) cls; 181 long id = (long) cls;
@@ -185,7 +185,7 @@ channel_end (void *cls, const struct GNUNET_MESH_Channel *channel,
185 id); 185 id);
186 if (NULL != mth) 186 if (NULL != mth)
187 { 187 {
188 GNUNET_MESH_notify_transmit_ready_cancel (mth); 188 GNUNET_CADET_notify_transmit_ready_cancel (mth);
189 mth = NULL; 189 mth = NULL;
190 } 190 }
191 if (GNUNET_NO == got_data) 191 if (GNUNET_NO == got_data)
@@ -201,7 +201,7 @@ channel_end (void *cls, const struct GNUNET_MESH_Channel *channel,
201/** 201/**
202 * Handler array for traffic received on peer1 202 * Handler array for traffic received on peer1
203 */ 203 */
204static struct GNUNET_MESH_MessageHandler handlers1[] = { 204static struct GNUNET_CADET_MessageHandler handlers1[] = {
205 {&data_callback, 1, 0}, 205 {&data_callback, 1, 0},
206 {NULL, 0, 0} 206 {NULL, 0, 0}
207}; 207};
@@ -210,7 +210,7 @@ static struct GNUNET_MESH_MessageHandler handlers1[] = {
210/** 210/**
211 * Handler array for traffic received on peer2 (none expected) 211 * Handler array for traffic received on peer2 (none expected)
212 */ 212 */
213static struct GNUNET_MESH_MessageHandler handlers2[] = { 213static struct GNUNET_CADET_MessageHandler handlers2[] = {
214 {&data_callback, 1, 0}, 214 {&data_callback, 1, 0},
215 {NULL, 0, 0} 215 {NULL, 0, 0}
216}; 216};
@@ -259,9 +259,9 @@ do_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
259 259
260 GNUNET_TESTING_peer_get_identity (me, &id); 260 GNUNET_TESTING_peer_get_identity (me, &id);
261 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "CONNECT BY PORT\n"); 261 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "CONNECT BY PORT\n");
262 ch = GNUNET_MESH_channel_create (mesh_peer_1, NULL, &id, 1, 262 ch = GNUNET_CADET_channel_create (cadet_peer_1, NULL, &id, 1,
263 GNUNET_MESH_OPTION_DEFAULT); 263 GNUNET_CADET_OPTION_DEFAULT);
264 mth = GNUNET_MESH_notify_transmit_ready (ch, GNUNET_NO, 264 mth = GNUNET_CADET_notify_transmit_ready (ch, GNUNET_NO,
265 GNUNET_TIME_UNIT_FOREVER_REL, 265 GNUNET_TIME_UNIT_FOREVER_REL,
266 sizeof (struct GNUNET_MessageHeader), 266 sizeof (struct GNUNET_MessageHeader),
267 &do_send, NULL); 267 &do_send, NULL);
@@ -287,28 +287,28 @@ run (void *cls,
287 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply 287 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
288 (GNUNET_TIME_UNIT_SECONDS, 15), &do_abort, 288 (GNUNET_TIME_UNIT_SECONDS, 15), &do_abort,
289 NULL); 289 NULL);
290 mesh_peer_1 = GNUNET_MESH_connect (cfg, /* configuration */ 290 cadet_peer_1 = GNUNET_CADET_connect (cfg, /* configuration */
291 (void *) 1L, /* cls */ 291 (void *) 1L, /* cls */
292 NULL, /* inbound new hndlr */ 292 NULL, /* inbound new hndlr */
293 &channel_end, /* channel end hndlr */ 293 &channel_end, /* channel end hndlr */
294 handlers1, /* traffic handlers */ 294 handlers1, /* traffic handlers */
295 NULL); /* ports offered */ 295 NULL); /* ports offered */
296 296
297 mesh_peer_2 = GNUNET_MESH_connect (cfg, /* configuration */ 297 cadet_peer_2 = GNUNET_CADET_connect (cfg, /* configuration */
298 (void *) 2L, /* cls */ 298 (void *) 2L, /* cls */
299 &inbound_channel, /* inbound new hndlr */ 299 &inbound_channel, /* inbound new hndlr */
300 &channel_end, /* channel end hndlr */ 300 &channel_end, /* channel end hndlr */
301 handlers2, /* traffic handlers */ 301 handlers2, /* traffic handlers */
302 ports); /* ports offered */ 302 ports); /* ports offered */
303 if (NULL == mesh_peer_1 || NULL == mesh_peer_2) 303 if (NULL == cadet_peer_1 || NULL == cadet_peer_2)
304 { 304 {
305 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Couldn't connect to mesh :(\n"); 305 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Couldn't connect to cadet :(\n");
306 result = GNUNET_SYSERR; 306 result = GNUNET_SYSERR;
307 return; 307 return;
308 } 308 }
309 else 309 else
310 { 310 {
311 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "YAY! CONNECTED TO MESH :D\n"); 311 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "YAY! CONNECTED TO CADET :D\n");
312 } 312 }
313 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply ( 313 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (
314 GNUNET_TIME_UNIT_SECONDS, 314 GNUNET_TIME_UNIT_SECONDS,
@@ -323,8 +323,8 @@ run (void *cls,
323int 323int
324main (int argc, char *argv[]) 324main (int argc, char *argv[])
325{ 325{
326 if (0 != GNUNET_TESTING_peer_run ("test-mesh-local", 326 if (0 != GNUNET_TESTING_peer_run ("test-cadet-local",
327 "test_mesh.conf", 327 "test_cadet.conf",
328 &run, NULL)) 328 &run, NULL))
329 { 329 {
330 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "run failed\n"); 330 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "run failed\n");
@@ -334,4 +334,4 @@ main (int argc, char *argv[])
334 return (result == GNUNET_OK) ? 0 : 1; 334 return (result == GNUNET_OK) ? 0 : 1;
335} 335}
336 336
337/* end of test_mesh_local_1.c */ 337/* end of test_cadet_local_1.c */
diff --git a/src/mesh/test_mesh_single.c b/src/mesh/test_mesh_single.c
index 6fc22362c..3780c745c 100644
--- a/src/mesh/test_mesh_single.c
+++ b/src/mesh/test_mesh_single.c
@@ -19,8 +19,8 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file mesh/test_mesh_single.c 22 * @file cadet/test_cadet_single.c
23 * @brief test mesh single: test of mesh channels with just one client 23 * @brief test cadet single: test of cadet channels with just one client
24 * @author Bartlomiej Polot 24 * @author Bartlomiej Polot
25 */ 25 */
26 26
@@ -28,18 +28,18 @@
28#include "gnunet_util_lib.h" 28#include "gnunet_util_lib.h"
29#include "gnunet_dht_service.h" 29#include "gnunet_dht_service.h"
30#include "gnunet_testing_lib.h" 30#include "gnunet_testing_lib.h"
31#include "gnunet_mesh_service.h" 31#include "gnunet_cadet_service.h"
32 32
33#define REPETITIONS 5 33#define REPETITIONS 5
34#define DATA_SIZE 35000 34#define DATA_SIZE 35000
35 35
36struct GNUNET_TESTING_Peer *me; 36struct GNUNET_TESTING_Peer *me;
37 37
38static struct GNUNET_MESH_Handle *mesh; 38static struct GNUNET_CADET_Handle *cadet;
39 39
40static struct GNUNET_MESH_Channel *ch1; 40static struct GNUNET_CADET_Channel *ch1;
41 41
42static struct GNUNET_MESH_Channel *ch2; 42static struct GNUNET_CADET_Channel *ch2;
43 43
44static int result; 44static int result;
45 45
@@ -68,14 +68,14 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
68 } 68 }
69 if (NULL != ch1) 69 if (NULL != ch1)
70 { 70 {
71 GNUNET_MESH_channel_destroy (ch1); 71 GNUNET_CADET_channel_destroy (ch1);
72 } 72 }
73 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnect client 1\n"); 73 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnect client 1\n");
74 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnect client 2\n"); 74 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnect client 2\n");
75 if (NULL != mesh) 75 if (NULL != cadet)
76 { 76 {
77 GNUNET_MESH_disconnect (mesh); 77 GNUNET_CADET_disconnect (cadet);
78 mesh = NULL; 78 cadet = NULL;
79 } 79 }
80 else 80 else
81 { 81 {
@@ -115,7 +115,7 @@ finish (void)
115/** 115/**
116 * Function is called whenever a message is received. 116 * Function is called whenever a message is received.
117 * 117 *
118 * @param cls closure (set from GNUNET_MESH_connect) 118 * @param cls closure (set from GNUNET_CADET_connect)
119 * @param channel connection to the other end 119 * @param channel connection to the other end
120 * @param channel_ctx place to store local state associated with the channel 120 * @param channel_ctx place to store local state associated with the channel
121 * @param message the actual message 121 * @param message the actual message
@@ -124,7 +124,7 @@ finish (void)
124 * GNUNET_SYSERR to close it (signal serious error) 124 * GNUNET_SYSERR to close it (signal serious error)
125 */ 125 */
126static int 126static int
127data_callback (void *cls, struct GNUNET_MESH_Channel *channel, 127data_callback (void *cls, struct GNUNET_CADET_Channel *channel,
128 void **channel_ctx, 128 void **channel_ctx,
129 const struct GNUNET_MessageHeader *message) 129 const struct GNUNET_MessageHeader *message)
130{ 130{
@@ -134,21 +134,21 @@ data_callback (void *cls, struct GNUNET_MESH_Channel *channel,
134 repetition = repetition + 1; 134 repetition = repetition + 1;
135 if (repetition < REPETITIONS) 135 if (repetition < REPETITIONS)
136 { 136 {
137 struct GNUNET_MESH_Channel *my_channel; 137 struct GNUNET_CADET_Channel *my_channel;
138 if (repetition % 2 == 0) 138 if (repetition % 2 == 0)
139 my_channel = ch1; 139 my_channel = ch1;
140 else 140 else
141 my_channel = ch2; 141 my_channel = ch2;
142 GNUNET_MESH_notify_transmit_ready (my_channel, GNUNET_NO, 142 GNUNET_CADET_notify_transmit_ready (my_channel, GNUNET_NO,
143 GNUNET_TIME_UNIT_FOREVER_REL, 143 GNUNET_TIME_UNIT_FOREVER_REL,
144 sizeof (struct GNUNET_MessageHeader) 144 sizeof (struct GNUNET_MessageHeader)
145 + DATA_SIZE, 145 + DATA_SIZE,
146 &do_send, NULL); 146 &do_send, NULL);
147 GNUNET_MESH_receive_done (channel); 147 GNUNET_CADET_receive_done (channel);
148 return GNUNET_OK; 148 return GNUNET_OK;
149 } 149 }
150 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All data OK. Destroying channel.\n"); 150 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All data OK. Destroying channel.\n");
151 GNUNET_MESH_channel_destroy (ch1); 151 GNUNET_CADET_channel_destroy (ch1);
152 ch1 = NULL; 152 ch1 = NULL;
153 return GNUNET_OK; 153 return GNUNET_OK;
154} 154}
@@ -167,9 +167,9 @@ data_callback (void *cls, struct GNUNET_MESH_Channel *channel,
167 * (can be NULL -- that's not an error) 167 * (can be NULL -- that's not an error)
168 */ 168 */
169static void * 169static void *
170inbound_channel (void *cls, struct GNUNET_MESH_Channel *channel, 170inbound_channel (void *cls, struct GNUNET_CADET_Channel *channel,
171 const struct GNUNET_PeerIdentity *initiator, 171 const struct GNUNET_PeerIdentity *initiator,
172 uint32_t port, enum GNUNET_MESH_ChannelOption options) 172 uint32_t port, enum GNUNET_CADET_ChannelOption options)
173{ 173{
174 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 174 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
175 "received incoming channel on port %u\n", 175 "received incoming channel on port %u\n",
@@ -183,13 +183,13 @@ inbound_channel (void *cls, struct GNUNET_MESH_Channel *channel,
183 * Function called whenever an inbound channel is destroyed. Should clean up 183 * Function called whenever an inbound channel is destroyed. Should clean up
184 * any associated state. 184 * any associated state.
185 * 185 *
186 * @param cls closure (set from GNUNET_MESH_connect) 186 * @param cls closure (set from GNUNET_CADET_connect)
187 * @param channel connection to the other end (henceforth invalid) 187 * @param channel connection to the other end (henceforth invalid)
188 * @param channel_ctx place where local state associated 188 * @param channel_ctx place where local state associated
189 * with the channel is stored 189 * with the channel is stored
190 */ 190 */
191static void 191static void
192channel_end (void *cls, const struct GNUNET_MESH_Channel *channel, 192channel_end (void *cls, const struct GNUNET_CADET_Channel *channel,
193 void *channel_ctx) 193 void *channel_ctx)
194{ 194{
195 long id = (long) cls; 195 long id = (long) cls;
@@ -210,7 +210,7 @@ channel_end (void *cls, const struct GNUNET_MESH_Channel *channel,
210/** 210/**
211 * Handler array for traffic received on peer1 211 * Handler array for traffic received on peer1
212 */ 212 */
213static struct GNUNET_MESH_MessageHandler handlers1[] = { 213static struct GNUNET_CADET_MessageHandler handlers1[] = {
214 {&data_callback, 1, 0}, 214 {&data_callback, 1, 0},
215 {NULL, 0, 0} 215 {NULL, 0, 0}
216}; 216};
@@ -260,9 +260,9 @@ do_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
260 260
261 GNUNET_TESTING_peer_get_identity (me, &id); 261 GNUNET_TESTING_peer_get_identity (me, &id);
262 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "CONNECT BY PORT\n"); 262 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "CONNECT BY PORT\n");
263 ch1 = GNUNET_MESH_channel_create (mesh, NULL, &id, 1, 263 ch1 = GNUNET_CADET_channel_create (cadet, NULL, &id, 1,
264 GNUNET_MESH_OPTION_DEFAULT); 264 GNUNET_CADET_OPTION_DEFAULT);
265 GNUNET_MESH_notify_transmit_ready (ch1, GNUNET_NO, 265 GNUNET_CADET_notify_transmit_ready (ch1, GNUNET_NO,
266 GNUNET_TIME_UNIT_FOREVER_REL, 266 GNUNET_TIME_UNIT_FOREVER_REL,
267 size, &do_send, NULL); 267 size, &do_send, NULL);
268} 268}
@@ -287,22 +287,22 @@ run (void *cls,
287 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply 287 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
288 (GNUNET_TIME_UNIT_SECONDS, 15), &do_abort, 288 (GNUNET_TIME_UNIT_SECONDS, 15), &do_abort,
289 NULL); 289 NULL);
290 mesh = GNUNET_MESH_connect (cfg, /* configuration */ 290 cadet = GNUNET_CADET_connect (cfg, /* configuration */
291 (void *) 1L, /* cls */ 291 (void *) 1L, /* cls */
292 &inbound_channel, /* inbound new hndlr */ 292 &inbound_channel, /* inbound new hndlr */
293 &channel_end, /* inbound end hndlr */ 293 &channel_end, /* inbound end hndlr */
294 handlers1, /* traffic handlers */ 294 handlers1, /* traffic handlers */
295 ports); /* ports offered */ 295 ports); /* ports offered */
296 296
297 if (NULL == mesh) 297 if (NULL == cadet)
298 { 298 {
299 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Couldn't connect to mesh :(\n"); 299 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Couldn't connect to cadet :(\n");
300 result = GNUNET_SYSERR; 300 result = GNUNET_SYSERR;
301 return; 301 return;
302 } 302 }
303 else 303 else
304 { 304 {
305 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "YAY! CONNECTED TO MESH :D\n"); 305 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "YAY! CONNECTED TO CADET :D\n");
306 } 306 }
307 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &do_connect, NULL); 307 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &do_connect, NULL);
308} 308}
@@ -315,8 +315,8 @@ int
315main (int argc, char *argv[]) 315main (int argc, char *argv[])
316{ 316{
317 result = GNUNET_NO; 317 result = GNUNET_NO;
318 if (0 != GNUNET_TESTING_peer_run ("test-mesh-local", 318 if (0 != GNUNET_TESTING_peer_run ("test-cadet-local",
319 "test_mesh.conf", 319 "test_cadet.conf",
320 &run, NULL)) 320 &run, NULL))
321 { 321 {
322 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "run failed\n"); 322 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "run failed\n");
@@ -326,4 +326,4 @@ main (int argc, char *argv[])
326 return (result == GNUNET_OK) ? 0 : 1; 326 return (result == GNUNET_OK) ? 0 : 1;
327} 327}
328 328
329/* end of test_mesh_single.c */ 329/* end of test_cadet_single.c */
diff --git a/src/pt/gnunet-daemon-pt.c b/src/pt/gnunet-daemon-pt.c
index 166f9df1d..832d51d63 100644
--- a/src/pt/gnunet-daemon-pt.c
+++ b/src/pt/gnunet-daemon-pt.c
@@ -27,7 +27,7 @@
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_dns_service.h" 28#include "gnunet_dns_service.h"
29#include "gnunet_dnsparser_lib.h" 29#include "gnunet_dnsparser_lib.h"
30#include "gnunet_mesh_service.h" 30#include "gnunet_cadet_service.h"
31#include "gnunet_tun_lib.h" 31#include "gnunet_tun_lib.h"
32#include "gnunet_dht_service.h" 32#include "gnunet_dht_service.h"
33#include "gnunet_vpn_service.h" 33#include "gnunet_vpn_service.h"
@@ -37,7 +37,7 @@
37 37
38 38
39/** 39/**
40 * After how long do we time out if we could not get an IP from VPN or MESH? 40 * After how long do we time out if we could not get an IP from VPN or CADET?
41 */ 41 */
42#define TIMEOUT GNUNET_TIME_UNIT_MINUTES 42#define TIMEOUT GNUNET_TIME_UNIT_MINUTES
43 43
@@ -126,24 +126,24 @@ struct ReplyContext
126 * as a DNS exit. We try to keep a few channels open and a few 126 * as a DNS exit. We try to keep a few channels open and a few
127 * peers in reserve. 127 * peers in reserve.
128 */ 128 */
129struct MeshExit 129struct CadetExit
130{ 130{
131 131
132 /** 132 /**
133 * Kept in a DLL. 133 * Kept in a DLL.
134 */ 134 */
135 struct MeshExit *next; 135 struct CadetExit *next;
136 136
137 /** 137 /**
138 * Kept in a DLL. 138 * Kept in a DLL.
139 */ 139 */
140 struct MeshExit *prev; 140 struct CadetExit *prev;
141 141
142 /** 142 /**
143 * Channel we use for DNS requests over MESH, NULL if we did 143 * Channel we use for DNS requests over CADET, NULL if we did
144 * not initialze a channel to this peer yet. 144 * not initialze a channel to this peer yet.
145 */ 145 */
146 struct GNUNET_MESH_Channel *mesh_channel; 146 struct GNUNET_CADET_Channel *cadet_channel;
147 147
148 /** 148 /**
149 * At what time did the peer's advertisement expire? 149 * At what time did the peer's advertisement expire?
@@ -161,19 +161,19 @@ struct MeshExit
161 struct RequestContext *receive_queue_tail; 161 struct RequestContext *receive_queue_tail;
162 162
163 /** 163 /**
164 * Head of DLL of requests to be transmitted to a mesh_channel. 164 * Head of DLL of requests to be transmitted to a cadet_channel.
165 */ 165 */
166 struct RequestContext *transmit_queue_head; 166 struct RequestContext *transmit_queue_head;
167 167
168 /** 168 /**
169 * Tail of DLL of requests to be transmitted to a mesh_channel. 169 * Tail of DLL of requests to be transmitted to a cadet_channel.
170 */ 170 */
171 struct RequestContext *transmit_queue_tail; 171 struct RequestContext *transmit_queue_tail;
172 172
173 /** 173 /**
174 * Active transmission request for this channel (or NULL). 174 * Active transmission request for this channel (or NULL).
175 */ 175 */
176 struct GNUNET_MESH_TransmitHandle *mesh_th; 176 struct GNUNET_CADET_TransmitHandle *cadet_th;
177 177
178 /** 178 /**
179 * Identity of the peer that is providing the exit for us. 179 * Identity of the peer that is providing the exit for us.
@@ -195,7 +195,7 @@ struct MeshExit
195 195
196 196
197/** 197/**
198 * State we keep for a request that is going out via MESH. 198 * State we keep for a request that is going out via CADET.
199 */ 199 */
200struct RequestContext 200struct RequestContext
201{ 201{
@@ -212,7 +212,7 @@ struct RequestContext
212 /** 212 /**
213 * Exit that was chosen for this request. 213 * Exit that was chosen for this request.
214 */ 214 */
215 struct MeshExit *exit; 215 struct CadetExit *exit;
216 216
217 /** 217 /**
218 * Handle for interaction with DNS service. 218 * Handle for interaction with DNS service.
@@ -220,10 +220,10 @@ struct RequestContext
220 struct GNUNET_DNS_RequestHandle *rh; 220 struct GNUNET_DNS_RequestHandle *rh;
221 221
222 /** 222 /**
223 * Message we're sending out via MESH, allocated at the 223 * Message we're sending out via CADET, allocated at the
224 * end of this struct. 224 * end of this struct.
225 */ 225 */
226 const struct GNUNET_MessageHeader *mesh_message; 226 const struct GNUNET_MessageHeader *cadet_message;
227 227
228 /** 228 /**
229 * Task used to abort this operation with timeout. 229 * Task used to abort this operation with timeout.
@@ -250,16 +250,16 @@ struct RequestContext
250 250
251 251
252/** 252/**
253 * Head of DLL of mesh exits. Mesh exits with an open channel are 253 * Head of DLL of cadet exits. Cadet exits with an open channel are
254 * always at the beginning (so we do not have to traverse the entire 254 * always at the beginning (so we do not have to traverse the entire
255 * list to find them). 255 * list to find them).
256 */ 256 */
257static struct MeshExit *exit_head; 257static struct CadetExit *exit_head;
258 258
259/** 259/**
260 * Tail of DLL of mesh exits. 260 * Tail of DLL of cadet exits.
261 */ 261 */
262static struct MeshExit *exit_tail; 262static struct CadetExit *exit_tail;
263 263
264/** 264/**
265 * The handle to the configuration used throughout the process 265 * The handle to the configuration used throughout the process
@@ -272,9 +272,9 @@ static const struct GNUNET_CONFIGURATION_Handle *cfg;
272static struct GNUNET_VPN_Handle *vpn_handle; 272static struct GNUNET_VPN_Handle *vpn_handle;
273 273
274/** 274/**
275 * The handle to the MESH service 275 * The handle to the CADET service
276 */ 276 */
277static struct GNUNET_MESH_Handle *mesh_handle; 277static struct GNUNET_CADET_Handle *cadet_handle;
278 278
279/** 279/**
280 * Statistics. 280 * Statistics.
@@ -317,43 +317,43 @@ static int ipv6_pt;
317static int dns_channel; 317static int dns_channel;
318 318
319/** 319/**
320 * Number of DNS exit peers we currently have in the mesh channel. 320 * Number of DNS exit peers we currently have in the cadet channel.
321 * Used to see if using the mesh channel makes any sense right now, 321 * Used to see if using the cadet channel makes any sense right now,
322 * as well as to decide if we should open new channels. 322 * as well as to decide if we should open new channels.
323 */ 323 */
324static unsigned int dns_exit_available; 324static unsigned int dns_exit_available;
325 325
326 326
327/** 327/**
328 * We are short on mesh exits, try to open another one. 328 * We are short on cadet exits, try to open another one.
329 */ 329 */
330static void 330static void
331try_open_exit () 331try_open_exit ()
332{ 332{
333 struct MeshExit *pos; 333 struct CadetExit *pos;
334 uint32_t candidate_count; 334 uint32_t candidate_count;
335 uint32_t candidate_selected; 335 uint32_t candidate_selected;
336 336
337 candidate_count = 0; 337 candidate_count = 0;
338 for (pos = exit_head; NULL != pos; pos = pos->next) 338 for (pos = exit_head; NULL != pos; pos = pos->next)
339 if (NULL == pos->mesh_channel) 339 if (NULL == pos->cadet_channel)
340 candidate_count++; 340 candidate_count++;
341 candidate_selected = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 341 candidate_selected = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
342 candidate_count); 342 candidate_count);
343 candidate_count = 0; 343 candidate_count = 0;
344 for (pos = exit_head; NULL != pos; pos = pos->next) 344 for (pos = exit_head; NULL != pos; pos = pos->next)
345 if (NULL == pos->mesh_channel) 345 if (NULL == pos->cadet_channel)
346 { 346 {
347 candidate_count++; 347 candidate_count++;
348 if (candidate_selected < candidate_count) 348 if (candidate_selected < candidate_count)
349 { 349 {
350 /* move to the head of the DLL */ 350 /* move to the head of the DLL */
351 pos->mesh_channel = GNUNET_MESH_channel_create (mesh_handle, 351 pos->cadet_channel = GNUNET_CADET_channel_create (cadet_handle,
352 pos, 352 pos,
353 &pos->peer, 353 &pos->peer,
354 GNUNET_APPLICATION_TYPE_INTERNET_RESOLVER, 354 GNUNET_APPLICATION_TYPE_INTERNET_RESOLVER,
355 GNUNET_MESH_OPTION_DEFAULT); 355 GNUNET_CADET_OPTION_DEFAULT);
356 if (NULL == pos->mesh_channel) 356 if (NULL == pos->cadet_channel)
357 { 357 {
358 GNUNET_break (0); 358 GNUNET_break (0);
359 continue; 359 continue;
@@ -382,7 +382,7 @@ try_open_exit ()
382 * @return weight of the channel 382 * @return weight of the channel
383 */ 383 */
384static uint32_t 384static uint32_t
385get_channel_weight (struct MeshExit *exit) 385get_channel_weight (struct CadetExit *exit)
386{ 386{
387 uint32_t dropped; 387 uint32_t dropped;
388 uint32_t drop_percent; 388 uint32_t drop_percent;
@@ -406,7 +406,7 @@ get_channel_weight (struct MeshExit *exit)
406 406
407 407
408/** 408/**
409 * Choose a mesh exit for a DNS request. We try to use a channel 409 * Choose a cadet exit for a DNS request. We try to use a channel
410 * that is reliable and currently available. All existing 410 * that is reliable and currently available. All existing
411 * channels are given a base weight of 1, plus a score relating 411 * channels are given a base weight of 1, plus a score relating
412 * to the total number of queries answered in relation to the 412 * to the total number of queries answered in relation to the
@@ -416,10 +416,10 @@ get_channel_weight (struct MeshExit *exit)
416 * @return NULL if no exit is known, otherwise the 416 * @return NULL if no exit is known, otherwise the
417 * exit that we should use to queue a message with 417 * exit that we should use to queue a message with
418 */ 418 */
419static struct MeshExit * 419static struct CadetExit *
420choose_exit () 420choose_exit ()
421{ 421{
422 struct MeshExit *pos; 422 struct CadetExit *pos;
423 uint64_t total_transmitted; 423 uint64_t total_transmitted;
424 uint64_t selected_offset; 424 uint64_t selected_offset;
425 uint32_t channel_weight; 425 uint32_t channel_weight;
@@ -427,12 +427,12 @@ choose_exit ()
427 total_transmitted = 0; 427 total_transmitted = 0;
428 for (pos = exit_head; NULL != pos; pos = pos->next) 428 for (pos = exit_head; NULL != pos; pos = pos->next)
429 { 429 {
430 if (NULL == pos->mesh_channel) 430 if (NULL == pos->cadet_channel)
431 break; 431 break;
432 channel_weight = get_channel_weight (pos); 432 channel_weight = get_channel_weight (pos);
433 total_transmitted += channel_weight; 433 total_transmitted += channel_weight;
434 /* double weight for idle channels */ 434 /* double weight for idle channels */
435 if (NULL == pos->mesh_th) 435 if (NULL == pos->cadet_th)
436 total_transmitted += channel_weight; 436 total_transmitted += channel_weight;
437 } 437 }
438 if (0 == total_transmitted) 438 if (0 == total_transmitted)
@@ -445,12 +445,12 @@ choose_exit ()
445 total_transmitted = 0; 445 total_transmitted = 0;
446 for (pos = exit_head; NULL != pos; pos = pos->next) 446 for (pos = exit_head; NULL != pos; pos = pos->next)
447 { 447 {
448 if (NULL == pos->mesh_channel) 448 if (NULL == pos->cadet_channel)
449 break; 449 break;
450 channel_weight = get_channel_weight (pos); 450 channel_weight = get_channel_weight (pos);
451 total_transmitted += channel_weight; 451 total_transmitted += channel_weight;
452 /* double weight for idle channels */ 452 /* double weight for idle channels */
453 if (NULL == pos->mesh_th) 453 if (NULL == pos->cadet_th)
454 total_transmitted += channel_weight; 454 total_transmitted += channel_weight;
455 if (total_transmitted > selected_offset) 455 if (total_transmitted > selected_offset)
456 return pos; 456 return pos;
@@ -696,7 +696,7 @@ work_test (const struct GNUNET_DNSPARSER_Record *ra,
696 * This function is called AFTER we got an IP address for a 696 * This function is called AFTER we got an IP address for a
697 * DNS request. Now, the PT daemon has the chance to substitute 697 * DNS request. Now, the PT daemon has the chance to substitute
698 * the IP address with one from the VPN range to channel requests 698 * the IP address with one from the VPN range to channel requests
699 * destined for this IP address via VPN and MESH. 699 * destined for this IP address via VPN and CADET.
700 * 700 *
701 * @param cls closure 701 * @param cls closure
702 * @param rh request handle to user for reply 702 * @param rh request handle to user for reply
@@ -744,39 +744,39 @@ dns_post_request_handler (void *cls,
744 744
745 745
746/** 746/**
747 * Transmit a DNS request via MESH and move the request 747 * Transmit a DNS request via CADET and move the request
748 * handle to the receive queue. 748 * handle to the receive queue.
749 * 749 *
750 * @param cls the `struct MeshExit` 750 * @param cls the `struct CadetExit`
751 * @param size number of bytes available in buf 751 * @param size number of bytes available in buf
752 * @param buf where to copy the message 752 * @param buf where to copy the message
753 * @return number of bytes written to buf 753 * @return number of bytes written to buf
754 */ 754 */
755static size_t 755static size_t
756transmit_dns_request_to_mesh (void *cls, 756transmit_dns_request_to_cadet (void *cls,
757 size_t size, 757 size_t size,
758 void *buf) 758 void *buf)
759{ 759{
760 struct MeshExit *exit = cls; 760 struct CadetExit *exit = cls;
761 struct RequestContext *rc; 761 struct RequestContext *rc;
762 size_t mlen; 762 size_t mlen;
763 763
764 exit->mesh_th = NULL; 764 exit->cadet_th = NULL;
765 if (NULL == (rc = exit->transmit_queue_head)) 765 if (NULL == (rc = exit->transmit_queue_head))
766 return 0; 766 return 0;
767 mlen = rc->mlen; 767 mlen = rc->mlen;
768 if (mlen > size) 768 if (mlen > size)
769 { 769 {
770 exit->mesh_th = GNUNET_MESH_notify_transmit_ready (exit->mesh_channel, 770 exit->cadet_th = GNUNET_CADET_notify_transmit_ready (exit->cadet_channel,
771 GNUNET_NO, 771 GNUNET_NO,
772 TIMEOUT, 772 TIMEOUT,
773 mlen, 773 mlen,
774 &transmit_dns_request_to_mesh, 774 &transmit_dns_request_to_cadet,
775 exit); 775 exit);
776 return 0; 776 return 0;
777 } 777 }
778 GNUNET_assert (GNUNET_NO == rc->was_transmitted); 778 GNUNET_assert (GNUNET_NO == rc->was_transmitted);
779 memcpy (buf, rc->mesh_message, mlen); 779 memcpy (buf, rc->cadet_message, mlen);
780 GNUNET_CONTAINER_DLL_remove (exit->transmit_queue_head, 780 GNUNET_CONTAINER_DLL_remove (exit->transmit_queue_head,
781 exit->transmit_queue_tail, 781 exit->transmit_queue_tail,
782 rc); 782 rc);
@@ -786,18 +786,18 @@ transmit_dns_request_to_mesh (void *cls,
786 rc); 786 rc);
787 rc = exit->transmit_queue_head; 787 rc = exit->transmit_queue_head;
788 if (NULL != rc) 788 if (NULL != rc)
789 exit->mesh_th = GNUNET_MESH_notify_transmit_ready (exit->mesh_channel, 789 exit->cadet_th = GNUNET_CADET_notify_transmit_ready (exit->cadet_channel,
790 GNUNET_NO, 790 GNUNET_NO,
791 TIMEOUT, 791 TIMEOUT,
792 rc->mlen, 792 rc->mlen,
793 &transmit_dns_request_to_mesh, 793 &transmit_dns_request_to_cadet,
794 exit); 794 exit);
795 return mlen; 795 return mlen;
796} 796}
797 797
798 798
799/** 799/**
800 * Task run if the time to answer a DNS request via MESH is over. 800 * Task run if the time to answer a DNS request via CADET is over.
801 * 801 *
802 * @param cls the `struct RequestContext` to abort 802 * @param cls the `struct RequestContext` to abort
803 * @param tc scheduler context 803 * @param tc scheduler context
@@ -807,7 +807,7 @@ timeout_request (void *cls,
807 const struct GNUNET_SCHEDULER_TaskContext *tc) 807 const struct GNUNET_SCHEDULER_TaskContext *tc)
808{ 808{
809 struct RequestContext *rc = cls; 809 struct RequestContext *rc = cls;
810 struct MeshExit *exit = rc->exit; 810 struct CadetExit *exit = rc->exit;
811 811
812 if (rc->was_transmitted) 812 if (rc->was_transmitted)
813 { 813 {
@@ -833,9 +833,9 @@ timeout_request (void *cls,
833 { 833 {
834 /* this straw broke the camel's back: this channel now has 834 /* this straw broke the camel's back: this channel now has
835 such a low score that it will not be used; close it! */ 835 such a low score that it will not be used; close it! */
836 GNUNET_assert (NULL == exit->mesh_th); 836 GNUNET_assert (NULL == exit->cadet_th);
837 GNUNET_MESH_channel_destroy (exit->mesh_channel); 837 GNUNET_CADET_channel_destroy (exit->cadet_channel);
838 exit->mesh_channel = NULL; 838 exit->cadet_channel = NULL;
839 GNUNET_CONTAINER_DLL_remove (exit_head, 839 GNUNET_CONTAINER_DLL_remove (exit_head,
840 exit_tail, 840 exit_tail,
841 exit); 841 exit);
@@ -859,7 +859,7 @@ timeout_request (void *cls,
859/** 859/**
860 * This function is called *before* the DNS request has been 860 * This function is called *before* the DNS request has been
861 * given to a "local" DNS resolver. Channeling for DNS requests 861 * given to a "local" DNS resolver. Channeling for DNS requests
862 * was enabled, so we now need to send the request via some MESH 862 * was enabled, so we now need to send the request via some CADET
863 * channel to a DNS EXIT for resolution. 863 * channel to a DNS EXIT for resolution.
864 * 864 *
865 * @param cls closure 865 * @param cls closure
@@ -877,7 +877,7 @@ dns_pre_request_handler (void *cls,
877 size_t mlen; 877 size_t mlen;
878 struct GNUNET_MessageHeader hdr; 878 struct GNUNET_MessageHeader hdr;
879 struct GNUNET_TUN_DnsHeader dns; 879 struct GNUNET_TUN_DnsHeader dns;
880 struct MeshExit *exit; 880 struct CadetExit *exit;
881 881
882 GNUNET_STATISTICS_update (stats, 882 GNUNET_STATISTICS_update (stats,
883 gettext_noop ("# DNS requests intercepted"), 883 gettext_noop ("# DNS requests intercepted"),
@@ -885,7 +885,7 @@ dns_pre_request_handler (void *cls,
885 if (0 == dns_exit_available) 885 if (0 == dns_exit_available)
886 { 886 {
887 GNUNET_STATISTICS_update (stats, 887 GNUNET_STATISTICS_update (stats,
888 gettext_noop ("# DNS requests dropped (DNS mesh channel down)"), 888 gettext_noop ("# DNS requests dropped (DNS cadet channel down)"),
889 1, GNUNET_NO); 889 1, GNUNET_NO);
890 GNUNET_DNS_request_drop (rh); 890 GNUNET_DNS_request_drop (rh);
891 return; 891 return;
@@ -902,11 +902,11 @@ dns_pre_request_handler (void *cls,
902 mlen = sizeof (struct GNUNET_MessageHeader) + request_length; 902 mlen = sizeof (struct GNUNET_MessageHeader) + request_length;
903 exit = choose_exit (); 903 exit = choose_exit ();
904 GNUNET_assert (NULL != exit); 904 GNUNET_assert (NULL != exit);
905 GNUNET_assert (NULL != exit->mesh_channel); 905 GNUNET_assert (NULL != exit->cadet_channel);
906 rc = GNUNET_malloc (sizeof (struct RequestContext) + mlen); 906 rc = GNUNET_malloc (sizeof (struct RequestContext) + mlen);
907 rc->exit = exit; 907 rc->exit = exit;
908 rc->rh = rh; 908 rc->rh = rh;
909 rc->mesh_message = (const struct GNUNET_MessageHeader*) &rc[1]; 909 rc->cadet_message = (const struct GNUNET_MessageHeader*) &rc[1];
910 rc->timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 910 rc->timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
911 &timeout_request, 911 &timeout_request,
912 rc); 912 rc);
@@ -921,33 +921,33 @@ dns_pre_request_handler (void *cls,
921 GNUNET_CONTAINER_DLL_insert_tail (exit->transmit_queue_head, 921 GNUNET_CONTAINER_DLL_insert_tail (exit->transmit_queue_head,
922 exit->transmit_queue_tail, 922 exit->transmit_queue_tail,
923 rc); 923 rc);
924 if (NULL == exit->mesh_th) 924 if (NULL == exit->cadet_th)
925 exit->mesh_th = GNUNET_MESH_notify_transmit_ready (exit->mesh_channel, 925 exit->cadet_th = GNUNET_CADET_notify_transmit_ready (exit->cadet_channel,
926 GNUNET_NO, 926 GNUNET_NO,
927 TIMEOUT, 927 TIMEOUT,
928 mlen, 928 mlen,
929 &transmit_dns_request_to_mesh, 929 &transmit_dns_request_to_cadet,
930 exit); 930 exit);
931} 931}
932 932
933 933
934/** 934/**
935 * Process a request via mesh to perform a DNS query. 935 * Process a request via cadet to perform a DNS query.
936 * 936 *
937 * @param cls NULL 937 * @param cls NULL
938 * @param channel connection to the other end 938 * @param channel connection to the other end
939 * @param channel_ctx pointer to our `struct MeshExit` 939 * @param channel_ctx pointer to our `struct CadetExit`
940 * @param message the actual message 940 * @param message the actual message
941 * @return #GNUNET_OK to keep the connection open, 941 * @return #GNUNET_OK to keep the connection open,
942 * #GNUNET_SYSERR to close it (signal serious error) 942 * #GNUNET_SYSERR to close it (signal serious error)
943 */ 943 */
944static int 944static int
945receive_dns_response (void *cls, 945receive_dns_response (void *cls,
946 struct GNUNET_MESH_Channel *channel, 946 struct GNUNET_CADET_Channel *channel,
947 void **channel_ctx, 947 void **channel_ctx,
948 const struct GNUNET_MessageHeader *message) 948 const struct GNUNET_MessageHeader *message)
949{ 949{
950 struct MeshExit *exit = *channel_ctx; 950 struct CadetExit *exit = *channel_ctx;
951 struct GNUNET_TUN_DnsHeader dns; 951 struct GNUNET_TUN_DnsHeader dns;
952 size_t mlen; 952 size_t mlen;
953 struct RequestContext *rc; 953 struct RequestContext *rc;
@@ -989,12 +989,12 @@ receive_dns_response (void *cls,
989 989
990 990
991/** 991/**
992 * Abort all pending DNS requests with the given mesh exit. 992 * Abort all pending DNS requests with the given cadet exit.
993 * 993 *
994 * @param exit mesh exit to abort requests for 994 * @param exit cadet exit to abort requests for
995 */ 995 */
996static void 996static void
997abort_all_requests (struct MeshExit *exit) 997abort_all_requests (struct CadetExit *exit)
998{ 998{
999 struct RequestContext *rc; 999 struct RequestContext *rc;
1000 1000
@@ -1029,7 +1029,7 @@ static void
1029cleanup (void *cls, 1029cleanup (void *cls,
1030 const struct GNUNET_SCHEDULER_TaskContext *tskctx) 1030 const struct GNUNET_SCHEDULER_TaskContext *tskctx)
1031{ 1031{
1032 struct MeshExit *exit; 1032 struct CadetExit *exit;
1033 1033
1034 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1034 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1035 "Protocol translation daemon is shutting down now\n"); 1035 "Protocol translation daemon is shutting down now\n");
@@ -1043,23 +1043,23 @@ cleanup (void *cls,
1043 GNUNET_CONTAINER_DLL_remove (exit_head, 1043 GNUNET_CONTAINER_DLL_remove (exit_head,
1044 exit_tail, 1044 exit_tail,
1045 exit); 1045 exit);
1046 if (NULL != exit->mesh_th) 1046 if (NULL != exit->cadet_th)
1047 { 1047 {
1048 GNUNET_MESH_notify_transmit_ready_cancel (exit->mesh_th); 1048 GNUNET_CADET_notify_transmit_ready_cancel (exit->cadet_th);
1049 exit->mesh_th = NULL; 1049 exit->cadet_th = NULL;
1050 } 1050 }
1051 if (NULL != exit->mesh_channel) 1051 if (NULL != exit->cadet_channel)
1052 { 1052 {
1053 GNUNET_MESH_channel_destroy (exit->mesh_channel); 1053 GNUNET_CADET_channel_destroy (exit->cadet_channel);
1054 exit->mesh_channel = NULL; 1054 exit->cadet_channel = NULL;
1055 } 1055 }
1056 abort_all_requests (exit); 1056 abort_all_requests (exit);
1057 GNUNET_free (exit); 1057 GNUNET_free (exit);
1058 } 1058 }
1059 if (NULL != mesh_handle) 1059 if (NULL != cadet_handle)
1060 { 1060 {
1061 GNUNET_MESH_disconnect (mesh_handle); 1061 GNUNET_CADET_disconnect (cadet_handle);
1062 mesh_handle = NULL; 1062 cadet_handle = NULL;
1063 } 1063 }
1064 if (NULL != dns_post_handle) 1064 if (NULL != dns_post_handle)
1065 { 1065 {
@@ -1093,32 +1093,32 @@ cleanup (void *cls,
1093 * Function called whenever a channel is destroyed. Should clean up 1093 * Function called whenever a channel is destroyed. Should clean up
1094 * the associated state and attempt to build a new one. 1094 * the associated state and attempt to build a new one.
1095 * 1095 *
1096 * It must NOT call #GNUNET_MESH_channel_destroy on the channel. 1096 * It must NOT call #GNUNET_CADET_channel_destroy on the channel.
1097 * 1097 *
1098 * @param cls closure (the `struct MeshExit` set from #GNUNET_MESH_connect) 1098 * @param cls closure (the `struct CadetExit` set from #GNUNET_CADET_connect)
1099 * @param channel connection to the other end (henceforth invalid) 1099 * @param channel connection to the other end (henceforth invalid)
1100 * @param channel_ctx place where local state associated 1100 * @param channel_ctx place where local state associated
1101 * with the channel is stored 1101 * with the channel is stored
1102 */ 1102 */
1103static void 1103static void
1104mesh_channel_end_cb (void *cls, 1104cadet_channel_end_cb (void *cls,
1105 const struct GNUNET_MESH_Channel *channel, 1105 const struct GNUNET_CADET_Channel *channel,
1106 void *channel_ctx) 1106 void *channel_ctx)
1107{ 1107{
1108 struct MeshExit *exit = channel_ctx; 1108 struct CadetExit *exit = channel_ctx;
1109 struct MeshExit *alt; 1109 struct CadetExit *alt;
1110 struct RequestContext *rc; 1110 struct RequestContext *rc;
1111 1111
1112 if (NULL != exit->mesh_th) 1112 if (NULL != exit->cadet_th)
1113 { 1113 {
1114 GNUNET_MESH_notify_transmit_ready_cancel (exit->mesh_th); 1114 GNUNET_CADET_notify_transmit_ready_cancel (exit->cadet_th);
1115 exit->mesh_th = NULL; 1115 exit->cadet_th = NULL;
1116 } 1116 }
1117 exit->mesh_channel = NULL; 1117 exit->cadet_channel = NULL;
1118 dns_exit_available--; 1118 dns_exit_available--;
1119 /* open alternative channels */ 1119 /* open alternative channels */
1120 try_open_exit (); 1120 try_open_exit ();
1121 if (NULL == exit->mesh_channel) 1121 if (NULL == exit->cadet_channel)
1122 { 1122 {
1123 /* our channel is now closed, move our requests to an alternative 1123 /* our channel is now closed, move our requests to an alternative
1124 channel */ 1124 channel */
@@ -1150,20 +1150,20 @@ mesh_channel_end_cb (void *cls,
1150 /* the same peer was chosen, just make sure the queue processing is restarted */ 1150 /* the same peer was chosen, just make sure the queue processing is restarted */
1151 alt = exit; 1151 alt = exit;
1152 } 1152 }
1153 if ( (NULL == alt->mesh_th) && 1153 if ( (NULL == alt->cadet_th) &&
1154 (NULL != (rc = alt->transmit_queue_head)) ) 1154 (NULL != (rc = alt->transmit_queue_head)) )
1155 alt->mesh_th = GNUNET_MESH_notify_transmit_ready (alt->mesh_channel, 1155 alt->cadet_th = GNUNET_CADET_notify_transmit_ready (alt->cadet_channel,
1156 GNUNET_NO, 1156 GNUNET_NO,
1157 TIMEOUT, 1157 TIMEOUT,
1158 rc->mlen, 1158 rc->mlen,
1159 &transmit_dns_request_to_mesh, 1159 &transmit_dns_request_to_cadet,
1160 alt); 1160 alt);
1161} 1161}
1162 1162
1163 1163
1164/** 1164/**
1165 * Function called whenever we find an advertisement for a 1165 * Function called whenever we find an advertisement for a
1166 * DNS exit in the DHT. If we don't have a mesh channel, 1166 * DNS exit in the DHT. If we don't have a cadet channel,
1167 * we should build one; otherwise, we should save the 1167 * we should build one; otherwise, we should save the
1168 * advertisement for later use. 1168 * advertisement for later use.
1169 * 1169 *
@@ -1192,7 +1192,7 @@ handle_dht_result (void *cls,
1192 size_t size, const void *data) 1192 size_t size, const void *data)
1193{ 1193{
1194 const struct GNUNET_DNS_Advertisement *ad; 1194 const struct GNUNET_DNS_Advertisement *ad;
1195 struct MeshExit *exit; 1195 struct CadetExit *exit;
1196 1196
1197 if (sizeof (struct GNUNET_DNS_Advertisement) != size) 1197 if (sizeof (struct GNUNET_DNS_Advertisement) != size)
1198 { 1198 {
@@ -1207,7 +1207,7 @@ handle_dht_result (void *cls,
1207 break; 1207 break;
1208 if (NULL == exit) 1208 if (NULL == exit)
1209 { 1209 {
1210 exit = GNUNET_new (struct MeshExit); 1210 exit = GNUNET_new (struct CadetExit);
1211 exit->peer = ad->peer; 1211 exit->peer = ad->peer;
1212 /* channel is closed, so insert at the end */ 1212 /* channel is closed, so insert at the end */
1213 GNUNET_CONTAINER_DLL_insert_tail (exit_head, 1213 GNUNET_CONTAINER_DLL_insert_tail (exit_head,
@@ -1275,7 +1275,7 @@ run (void *cls, char *const *args GNUNET_UNUSED,
1275 } 1275 }
1276 if (dns_channel) 1276 if (dns_channel)
1277 { 1277 {
1278 static struct GNUNET_MESH_MessageHandler mesh_handlers[] = { 1278 static struct GNUNET_CADET_MessageHandler cadet_handlers[] = {
1279 {&receive_dns_response, GNUNET_MESSAGE_TYPE_VPN_DNS_FROM_INTERNET, 0}, 1279 {&receive_dns_response, GNUNET_MESSAGE_TYPE_VPN_DNS_FROM_INTERNET, 0},
1280 {NULL, 0, 0} 1280 {NULL, 0, 0}
1281 }; 1281 };
@@ -1292,14 +1292,14 @@ run (void *cls, char *const *args GNUNET_UNUSED,
1292 GNUNET_SCHEDULER_shutdown (); 1292 GNUNET_SCHEDULER_shutdown ();
1293 return; 1293 return;
1294 } 1294 }
1295 mesh_handle = GNUNET_MESH_connect (cfg, NULL, NULL, 1295 cadet_handle = GNUNET_CADET_connect (cfg, NULL, NULL,
1296 &mesh_channel_end_cb, 1296 &cadet_channel_end_cb,
1297 mesh_handlers, NULL); 1297 cadet_handlers, NULL);
1298 if (NULL == mesh_handle) 1298 if (NULL == cadet_handle)
1299 { 1299 {
1300 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1300 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1301 _("Failed to connect to %s service. Exiting.\n"), 1301 _("Failed to connect to %s service. Exiting.\n"),
1302 "MESH"); 1302 "CADET");
1303 GNUNET_SCHEDULER_shutdown (); 1303 GNUNET_SCHEDULER_shutdown ();
1304 return; 1304 return;
1305 } 1305 }
diff --git a/src/regex/gnunet-daemon-regexprofiler.c b/src/regex/gnunet-daemon-regexprofiler.c
index 3efd769f1..3d6624cb8 100644
--- a/src/regex/gnunet-daemon-regexprofiler.c
+++ b/src/regex/gnunet-daemon-regexprofiler.c
@@ -20,9 +20,9 @@
20 20
21/** 21/**
22 * @file regex/gnunet-daemon-regexprofiler.c 22 * @file regex/gnunet-daemon-regexprofiler.c
23 * @brief daemon that uses mesh to announce a regular expression. Used in 23 * @brief daemon that uses cadet to announce a regular expression. Used in
24 * conjunction with gnunet-regex-profiler to announce regexes on serveral peers 24 * conjunction with gnunet-regex-profiler to announce regexes on serveral peers
25 * without the need to explicitly connect to the mesh service running on the 25 * without the need to explicitly connect to the cadet service running on the
26 * peer from within the profiler. 26 * peer from within the profiler.
27 * @author Maximilian Szengel 27 * @author Maximilian Szengel
28 * @author Bartlomiej Polot 28 * @author Bartlomiej Polot
@@ -192,7 +192,7 @@ reannounce_regex (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
192 * Announce the given regular expression using regex and the path compression 192 * Announce the given regular expression using regex and the path compression
193 * length read from config. 193 * length read from config.
194 * 194 *
195 * @param regex regular expression to announce on this peer's mesh. 195 * @param regex regular expression to announce on this peer's cadet.
196 */ 196 */
197static void 197static void
198announce_regex (const char * regex) 198announce_regex (const char * regex)
@@ -377,7 +377,7 @@ main (int argc, char *const *argv)
377 return (GNUNET_OK == 377 return (GNUNET_OK ==
378 GNUNET_PROGRAM_run (argc, argv, "regexprofiler", 378 GNUNET_PROGRAM_run (argc, argv, "regexprofiler",
379 gettext_noop 379 gettext_noop
380 ("Daemon to announce regular expressions for the peer using mesh."), 380 ("Daemon to announce regular expressions for the peer using cadet."),
381 options, &run, NULL)) ? global_ret : 1; 381 options, &run, NULL)) ? global_ret : 1;
382} 382}
383 383
diff --git a/src/regex/gnunet-regex-simulation-profiler.c b/src/regex/gnunet-regex-simulation-profiler.c
index 4b3cf5bcd..f00108011 100644
--- a/src/regex/gnunet-regex-simulation-profiler.c
+++ b/src/regex/gnunet-regex-simulation-profiler.c
@@ -21,7 +21,7 @@
21/** 21/**
22 * @file regex/gnunet-regex-simulation-profiler.c 22 * @file regex/gnunet-regex-simulation-profiler.c
23 * @brief Regex profiler that dumps all DFAs into a database instead of 23 * @brief Regex profiler that dumps all DFAs into a database instead of
24 * using the DHT (with mesh). 24 * using the DHT (with cadet).
25 * @author Maximilian Szengel 25 * @author Maximilian Szengel
26 * 26 *
27 */ 27 */
diff --git a/src/regex/regex_internal_dht.c b/src/regex/regex_internal_dht.c
index f7d383406..f9d002eb0 100644
--- a/src/regex/regex_internal_dht.c
+++ b/src/regex/regex_internal_dht.c
@@ -487,7 +487,7 @@ dht_get_string_handler (void *cls, struct GNUNET_TIME_Absolute exp,
487 487
488 488
489/** 489/**
490 * Iterator over found existing mesh regex blocks that match an ongoing search. 490 * Iterator over found existing cadet regex blocks that match an ongoing search.
491 * 491 *
492 * @param cls Closure (current context)- 492 * @param cls Closure (current context)-
493 * @param key Current key code (key for cached block). 493 * @param key Current key code (key for cached block).
@@ -519,7 +519,7 @@ regex_result_iterator (void *cls,
519 GNUNET_BLOCK_is_accepting (block, result->size)); 519 GNUNET_BLOCK_is_accepting (block, result->size));
520 regex_next_edge (block, result->size, ctx); 520 regex_next_edge (block, result->size, ctx);
521 521
522 GNUNET_STATISTICS_update (ctx->info->stats, "# regex mesh blocks iterated", 522 GNUNET_STATISTICS_update (ctx->info->stats, "# regex cadet blocks iterated",
523 1, GNUNET_NO); 523 1, GNUNET_NO);
524 524
525 return GNUNET_YES; 525 return GNUNET_YES;
@@ -763,12 +763,12 @@ regex_cancel_dht_get (void *cls,
763 763
764 764
765/** 765/**
766 * Iterator over hash map entries to free MeshRegexBlocks stored during the 766 * Iterator over hash map entries to free CadetRegexBlocks stored during the
767 * search for connect_by_string. 767 * search for connect_by_string.
768 * 768 *
769 * @param cls Closure (unused). 769 * @param cls Closure (unused).
770 * @param key Current key code (unused). 770 * @param key Current key code (unused).
771 * @param value MeshRegexBlock in the hash map. 771 * @param value CadetRegexBlock in the hash map.
772 * @return GNUNET_YES if we should continue to iterate, 772 * @return GNUNET_YES if we should continue to iterate,
773 * GNUNET_NO if not. 773 * GNUNET_NO if not.
774 */ 774 */
diff --git a/src/regex/regex_test_lib.c b/src/regex/regex_test_lib.c
index 2f3abdc65..7a9c7d1b1 100644
--- a/src/regex/regex_test_lib.c
+++ b/src/regex/regex_test_lib.c
@@ -21,7 +21,7 @@
21 * @file src/regex/regex_test_lib.c 21 * @file src/regex/regex_test_lib.c
22 * @brief library to read regexes representing IP networks from a file. 22 * @brief library to read regexes representing IP networks from a file.
23 * and simplyfinying the into one big regex, in order to run 23 * and simplyfinying the into one big regex, in order to run
24 * tests (regex performance, mesh profiler). 24 * tests (regex performance, cadet profiler).
25 * @author Bartlomiej Polot 25 * @author Bartlomiej Polot
26 */ 26 */
27 27
diff --git a/src/set/gnunet-service-set.c b/src/set/gnunet-service-set.c
index 940401d0a..3a3f91217 100644
--- a/src/set/gnunet-service-set.c
+++ b/src/set/gnunet-service-set.c
@@ -104,10 +104,10 @@ struct Listener
104static const struct GNUNET_CONFIGURATION_Handle *configuration; 104static const struct GNUNET_CONFIGURATION_Handle *configuration;
105 105
106/** 106/**
107 * Handle to the mesh service, used 107 * Handle to the cadet service, used
108 * to listen for and connect to remote peers. 108 * to listen for and connect to remote peers.
109 */ 109 */
110static struct GNUNET_MESH_Handle *mesh; 110static struct GNUNET_CADET_Handle *cadet;
111 111
112/** 112/**
113 * Sets are held in a doubly linked list. 113 * Sets are held in a doubly linked list.
@@ -289,7 +289,7 @@ void
289_GSS_operation_destroy (struct Operation *op) 289_GSS_operation_destroy (struct Operation *op)
290{ 290{
291 struct Set *set; 291 struct Set *set;
292 struct GNUNET_MESH_Channel *channel; 292 struct GNUNET_CADET_Channel *channel;
293 293
294 if (NULL == op->vt) 294 if (NULL == op->vt)
295 return; 295 return;
@@ -325,7 +325,7 @@ _GSS_operation_destroy (struct Operation *op)
325 if (NULL != (channel = op->channel)) 325 if (NULL != (channel = op->channel))
326 { 326 {
327 op->channel = NULL; 327 op->channel = NULL;
328 GNUNET_MESH_channel_destroy (channel); 328 GNUNET_CADET_channel_destroy (channel);
329 } 329 }
330 330
331 collect_generation_garbage (set); 331 collect_generation_garbage (set);
@@ -466,7 +466,7 @@ incoming_destroy (struct Operation *incoming)
466 } 466 }
467 if (NULL != incoming->channel) 467 if (NULL != incoming->channel)
468 { 468 {
469 GNUNET_MESH_channel_destroy (incoming->channel); 469 GNUNET_CADET_channel_destroy (incoming->channel);
470 incoming->channel = NULL; 470 incoming->channel = NULL;
471 } 471 }
472} 472}
@@ -847,7 +847,7 @@ handle_client_reject (void *cls,
847 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 847 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
848 "peer request rejected by client\n"); 848 "peer request rejected by client\n");
849 849
850 GNUNET_MESH_channel_destroy (incoming->channel); 850 GNUNET_CADET_channel_destroy (incoming->channel);
851 //channel destruction handler called immediately upon destruction 851 //channel destruction handler called immediately upon destruction
852 GNUNET_SERVER_receive_done (client, GNUNET_OK); 852 GNUNET_SERVER_receive_done (client, GNUNET_OK);
853} 853}
@@ -980,11 +980,11 @@ handle_client_evaluate (void *cls,
980 op->vt = set->vt; 980 op->vt = set->vt;
981 GNUNET_CONTAINER_DLL_insert (set->ops_head, set->ops_tail, op); 981 GNUNET_CONTAINER_DLL_insert (set->ops_head, set->ops_tail, op);
982 982
983 op->channel = GNUNET_MESH_channel_create (mesh, op, &msg->target_peer, 983 op->channel = GNUNET_CADET_channel_create (cadet, op, &msg->target_peer,
984 GNUNET_APPLICATION_TYPE_SET, 984 GNUNET_APPLICATION_TYPE_SET,
985 GNUNET_MESH_OPTION_RELIABLE); 985 GNUNET_CADET_OPTION_RELIABLE);
986 986
987 op->mq = GNUNET_MESH_mq_create (op->channel); 987 op->mq = GNUNET_CADET_mq_create (op->channel);
988 988
989 set->vt->evaluate (op); 989 set->vt->evaluate (op);
990 GNUNET_SERVER_receive_done (client, GNUNET_OK); 990 GNUNET_SERVER_receive_done (client, GNUNET_OK);
@@ -1173,12 +1173,12 @@ shutdown_task (void *cls,
1173 while (NULL != sets_head) 1173 while (NULL != sets_head)
1174 set_destroy (sets_head); 1174 set_destroy (sets_head);
1175 1175
1176 /* it's important to destroy mesh at the end, as all channels 1176 /* it's important to destroy cadet at the end, as all channels
1177 * must be destroyed before the mesh handle! */ 1177 * must be destroyed before the cadet handle! */
1178 if (NULL != mesh) 1178 if (NULL != cadet)
1179 { 1179 {
1180 GNUNET_MESH_disconnect (mesh); 1180 GNUNET_CADET_disconnect (cadet);
1181 mesh = NULL; 1181 cadet = NULL;
1182 } 1182 }
1183 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1183 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1184 "handled shutdown request\n"); 1184 "handled shutdown request\n");
@@ -1233,7 +1233,7 @@ handle_incoming_disconnect (struct Operation *op)
1233 * Method called whenever another peer has added us to a channel 1233 * Method called whenever another peer has added us to a channel
1234 * the other peer initiated. 1234 * the other peer initiated.
1235 * Only called (once) upon reception of data with a message type which was 1235 * Only called (once) upon reception of data with a message type which was
1236 * subscribed to in GNUNET_MESH_connect(). 1236 * subscribed to in GNUNET_CADET_connect().
1237 * 1237 *
1238 * The channel context represents the operation itself and gets added to a DLL, 1238 * The channel context represents the operation itself and gets added to a DLL,
1239 * from where it gets looked up when our local listener client responds 1239 * from where it gets looked up when our local listener client responds
@@ -1249,9 +1249,9 @@ handle_incoming_disconnect (struct Operation *op)
1249 */ 1249 */
1250static void * 1250static void *
1251channel_new_cb (void *cls, 1251channel_new_cb (void *cls,
1252 struct GNUNET_MESH_Channel *channel, 1252 struct GNUNET_CADET_Channel *channel,
1253 const struct GNUNET_PeerIdentity *initiator, 1253 const struct GNUNET_PeerIdentity *initiator,
1254 uint32_t port, enum GNUNET_MESH_ChannelOption options) 1254 uint32_t port, enum GNUNET_CADET_ChannelOption options)
1255{ 1255{
1256 struct Operation *incoming; 1256 struct Operation *incoming;
1257 static const struct SetVT incoming_vt = { 1257 static const struct SetVT incoming_vt = {
@@ -1265,7 +1265,7 @@ channel_new_cb (void *cls,
1265 if (GNUNET_APPLICATION_TYPE_SET != port) 1265 if (GNUNET_APPLICATION_TYPE_SET != port)
1266 { 1266 {
1267 GNUNET_break (0); 1267 GNUNET_break (0);
1268 GNUNET_MESH_channel_destroy (channel); 1268 GNUNET_CADET_channel_destroy (channel);
1269 return NULL; 1269 return NULL;
1270 } 1270 }
1271 1271
@@ -1274,7 +1274,7 @@ channel_new_cb (void *cls,
1274 incoming->state = GNUNET_new (struct OperationState); 1274 incoming->state = GNUNET_new (struct OperationState);
1275 incoming->state->peer = *initiator; 1275 incoming->state->peer = *initiator;
1276 incoming->channel = channel; 1276 incoming->channel = channel;
1277 incoming->mq = GNUNET_MESH_mq_create (incoming->channel); 1277 incoming->mq = GNUNET_CADET_mq_create (incoming->channel);
1278 incoming->vt = &incoming_vt; 1278 incoming->vt = &incoming_vt;
1279 incoming->state->timeout_task = 1279 incoming->state->timeout_task =
1280 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, 1280 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES,
@@ -1288,7 +1288,7 @@ channel_new_cb (void *cls,
1288/** 1288/**
1289 * Function called whenever a channel is destroyed. Should clean up 1289 * Function called whenever a channel is destroyed. Should clean up
1290 * any associated state. It must NOT call 1290 * any associated state. It must NOT call
1291 * GNUNET_MESH_channel_destroy() on the channel. 1291 * GNUNET_CADET_channel_destroy() on the channel.
1292 * 1292 *
1293 * The peer_disconnect function is part of a a virtual table set initially either 1293 * The peer_disconnect function is part of a a virtual table set initially either
1294 * when a peer creates a new channel with us (channel_new_cb), or once we create 1294 * when a peer creates a new channel with us (channel_new_cb), or once we create
@@ -1297,14 +1297,14 @@ channel_new_cb (void *cls,
1297 * Once we know the exact type of operation (union/intersection), the vt is 1297 * Once we know the exact type of operation (union/intersection), the vt is
1298 * replaced with an operation specific instance (_GSS_[op]_vt). 1298 * replaced with an operation specific instance (_GSS_[op]_vt).
1299 * 1299 *
1300 * @param cls closure (set from GNUNET_MESH_connect()) 1300 * @param cls closure (set from GNUNET_CADET_connect())
1301 * @param channel connection to the other end (henceforth invalid) 1301 * @param channel connection to the other end (henceforth invalid)
1302 * @param channel_ctx place where local state associated 1302 * @param channel_ctx place where local state associated
1303 * with the channel is stored 1303 * with the channel is stored
1304 */ 1304 */
1305static void 1305static void
1306channel_end_cb (void *cls, 1306channel_end_cb (void *cls,
1307 const struct GNUNET_MESH_Channel *channel, void *channel_ctx) 1307 const struct GNUNET_CADET_Channel *channel, void *channel_ctx)
1308{ 1308{
1309 struct Operation *op = channel_ctx; 1309 struct Operation *op = channel_ctx;
1310 1310
@@ -1322,7 +1322,7 @@ channel_end_cb (void *cls,
1322 if (GNUNET_YES == op->keep) 1322 if (GNUNET_YES == op->keep)
1323 return; 1323 return;
1324 1324
1325 /* mesh will never call us with the context again! */ 1325 /* cadet will never call us with the context again! */
1326 GNUNET_free (channel_ctx); 1326 GNUNET_free (channel_ctx);
1327 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1327 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1328 "channel end cb finished\n"); 1328 "channel end cb finished\n");
@@ -1331,7 +1331,7 @@ channel_end_cb (void *cls,
1331 1331
1332/** 1332/**
1333 * Functions with this signature are called whenever a message is 1333 * Functions with this signature are called whenever a message is
1334 * received via a mesh channel. 1334 * received via a cadet channel.
1335 * 1335 *
1336 * The msg_handler is a virtual table set in initially either when a peer 1336 * The msg_handler is a virtual table set in initially either when a peer
1337 * creates a new channel with us (channel_new_cb), or once we create a new channel 1337 * creates a new channel with us (channel_new_cb), or once we create a new channel
@@ -1340,7 +1340,7 @@ channel_end_cb (void *cls,
1340 * Once we know the exact type of operation (union/intersection), the vt is 1340 * Once we know the exact type of operation (union/intersection), the vt is
1341 * replaced with an operation specific instance (_GSS_[op]_vt). 1341 * replaced with an operation specific instance (_GSS_[op]_vt).
1342 * 1342 *
1343 * @param cls Closure (set from GNUNET_MESH_connect()). 1343 * @param cls Closure (set from GNUNET_CADET_connect()).
1344 * @param channel Connection to the other end. 1344 * @param channel Connection to the other end.
1345 * @param channel_ctx Place to store local state associated with the channel. 1345 * @param channel_ctx Place to store local state associated with the channel.
1346 * @param message The actual message. 1346 * @param message The actual message.
@@ -1349,7 +1349,7 @@ channel_end_cb (void *cls,
1349 */ 1349 */
1350static int 1350static int
1351dispatch_p2p_message (void *cls, 1351dispatch_p2p_message (void *cls,
1352 struct GNUNET_MESH_Channel *channel, 1352 struct GNUNET_CADET_Channel *channel,
1353 void **channel_ctx, 1353 void **channel_ctx,
1354 const struct GNUNET_MessageHeader *message) 1354 const struct GNUNET_MessageHeader *message)
1355{ 1355{
@@ -1357,16 +1357,16 @@ dispatch_p2p_message (void *cls,
1357 int ret; 1357 int ret;
1358 1358
1359 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1359 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1360 "dispatching mesh message (type: %u)\n", 1360 "dispatching cadet message (type: %u)\n",
1361 ntohs (message->type)); 1361 ntohs (message->type));
1362 /* do this before the handler, as the handler might kill the channel */ 1362 /* do this before the handler, as the handler might kill the channel */
1363 GNUNET_MESH_receive_done (channel); 1363 GNUNET_CADET_receive_done (channel);
1364 if (NULL != op->vt) 1364 if (NULL != op->vt)
1365 ret = op->vt->msg_handler (op, message); 1365 ret = op->vt->msg_handler (op, message);
1366 else 1366 else
1367 ret = GNUNET_SYSERR; 1367 ret = GNUNET_SYSERR;
1368 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1368 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1369 "handled mesh message (type: %u)\n", 1369 "handled cadet message (type: %u)\n",
1370 ntohs (message->type)); 1370 ntohs (message->type));
1371 return ret; 1371 return ret;
1372} 1372}
@@ -1403,7 +1403,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
1403 sizeof (struct GNUNET_SET_CancelMessage)}, 1403 sizeof (struct GNUNET_SET_CancelMessage)},
1404 {NULL, NULL, 0, 0} 1404 {NULL, NULL, 0, 0}
1405 }; 1405 };
1406 static const struct GNUNET_MESH_MessageHandler mesh_handlers[] = { 1406 static const struct GNUNET_CADET_MessageHandler cadet_handlers[] = {
1407 {dispatch_p2p_message, GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST, 0}, 1407 {dispatch_p2p_message, GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST, 0},
1408 {dispatch_p2p_message, GNUNET_MESSAGE_TYPE_SET_UNION_P2P_IBF, 0}, 1408 {dispatch_p2p_message, GNUNET_MESSAGE_TYPE_SET_UNION_P2P_IBF, 0},
1409 {dispatch_p2p_message, GNUNET_MESSAGE_TYPE_SET_P2P_ELEMENTS, 0}, 1409 {dispatch_p2p_message, GNUNET_MESSAGE_TYPE_SET_P2P_ELEMENTS, 0},
@@ -1415,7 +1415,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
1415 {dispatch_p2p_message, GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF_PART, 0}, 1415 {dispatch_p2p_message, GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF_PART, 0},
1416 {NULL, 0, 0} 1416 {NULL, 0, 0}
1417 }; 1417 };
1418 static const uint32_t mesh_ports[] = {GNUNET_APPLICATION_TYPE_SET, 0}; 1418 static const uint32_t cadet_ports[] = {GNUNET_APPLICATION_TYPE_SET, 0};
1419 1419
1420 configuration = cfg; 1420 configuration = cfg;
1421 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 1421 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
@@ -1423,12 +1423,12 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
1423 GNUNET_SERVER_disconnect_notify (server, &handle_client_disconnect, NULL); 1423 GNUNET_SERVER_disconnect_notify (server, &handle_client_disconnect, NULL);
1424 GNUNET_SERVER_add_handlers (server, server_handlers); 1424 GNUNET_SERVER_add_handlers (server, server_handlers);
1425 1425
1426 mesh = GNUNET_MESH_connect (cfg, NULL, channel_new_cb, channel_end_cb, 1426 cadet = GNUNET_CADET_connect (cfg, NULL, channel_new_cb, channel_end_cb,
1427 mesh_handlers, mesh_ports); 1427 cadet_handlers, cadet_ports);
1428 if (NULL == mesh) 1428 if (NULL == cadet)
1429 { 1429 {
1430 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1430 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1431 _("Could not connect to mesh service\n")); 1431 _("Could not connect to cadet service\n"));
1432 return; 1432 return;
1433 } 1433 }
1434} 1434}
diff --git a/src/set/gnunet-service-set.h b/src/set/gnunet-service-set.h
index 95a24119b..d8450e242 100644
--- a/src/set/gnunet-service-set.h
+++ b/src/set/gnunet-service-set.h
@@ -32,7 +32,7 @@
32#include "gnunet_protocols.h" 32#include "gnunet_protocols.h"
33#include "gnunet_applications.h" 33#include "gnunet_applications.h"
34#include "gnunet_core_service.h" 34#include "gnunet_core_service.h"
35#include "gnunet_mesh_service.h" 35#include "gnunet_cadet_service.h"
36#include "gnunet_set_service.h" 36#include "gnunet_set_service.h"
37#include "set.h" 37#include "set.h"
38 38
@@ -301,7 +301,7 @@ struct Operation
301 /** 301 /**
302 * Tunnel to the peer. 302 * Tunnel to the peer.
303 */ 303 */
304 struct GNUNET_MESH_Channel *channel; 304 struct GNUNET_CADET_Channel *channel;
305 305
306 /** 306 /**
307 * Message queue for the tunnel. 307 * Message queue for the tunnel.
diff --git a/src/set/gnunet-service-set_intersection.c b/src/set/gnunet-service-set_intersection.c
index 5c4bc9dd5..680f91db0 100644
--- a/src/set/gnunet-service-set_intersection.c
+++ b/src/set/gnunet-service-set_intersection.c
@@ -982,7 +982,7 @@ intersection_handle_p2p_message (struct Operation *op,
982 handle_p2p_done (op, mh); 982 handle_p2p_done (op, mh);
983 break; 983 break;
984 default: 984 default:
985 /* something wrong with mesh's message handlers? */ 985 /* something wrong with cadet's message handlers? */
986 GNUNET_assert (0); 986 GNUNET_assert (0);
987 } 987 }
988 return GNUNET_OK; 988 return GNUNET_OK;
diff --git a/src/set/gnunet-service-set_union.c b/src/set/gnunet-service-set_union.c
index 6bb28471a..f7f94cb21 100644
--- a/src/set/gnunet-service-set_union.c
+++ b/src/set/gnunet-service-set_union.c
@@ -854,7 +854,7 @@ decode_and_send (struct Operation *op)
854 struct GNUNET_MQ_Envelope *ev; 854 struct GNUNET_MQ_Envelope *ev;
855 struct GNUNET_MessageHeader *msg; 855 struct GNUNET_MessageHeader *msg;
856 856
857 /* It may be nice to merge multiple requests, but with mesh's corking it is not worth 857 /* It may be nice to merge multiple requests, but with cadet's corking it is not worth
858 * the effort additional complexity. */ 858 * the effort additional complexity. */
859 ev = GNUNET_MQ_msg_header_extra (msg, sizeof (struct IBF_Key), 859 ev = GNUNET_MQ_msg_header_extra (msg, sizeof (struct IBF_Key),
860 GNUNET_MESSAGE_TYPE_SET_P2P_ELEMENT_REQUESTS); 860 GNUNET_MESSAGE_TYPE_SET_P2P_ELEMENT_REQUESTS);
@@ -1327,7 +1327,7 @@ union_handle_p2p_message (struct Operation *op,
1327 handle_p2p_done (op, mh); 1327 handle_p2p_done (op, mh);
1328 break; 1328 break;
1329 default: 1329 default:
1330 /* something wrong with mesh's message handlers? */ 1330 /* something wrong with cadet's message handlers? */
1331 GNUNET_assert (0); 1331 GNUNET_assert (0);
1332 } 1332 }
1333 return GNUNET_OK; 1333 return GNUNET_OK;
diff --git a/src/topology/gnunet-daemon-topology.c b/src/topology/gnunet-daemon-topology.c
index ecead4886..ba78f25dd 100644
--- a/src/topology/gnunet-daemon-topology.c
+++ b/src/topology/gnunet-daemon-topology.c
@@ -20,7 +20,7 @@
20 20
21/** 21/**
22 * @file topology/gnunet-daemon-topology.c 22 * @file topology/gnunet-daemon-topology.c
23 * @brief code for maintaining the mesh topology 23 * @brief code for maintaining the cadet topology
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
@@ -1293,7 +1293,7 @@ main (int argc, char *const *argv)
1293 (GNUNET_OK == 1293 (GNUNET_OK ==
1294 GNUNET_PROGRAM_run (argc, argv, "gnunet-daemon-topology", 1294 GNUNET_PROGRAM_run (argc, argv, "gnunet-daemon-topology",
1295 _ 1295 _
1296 ("GNUnet topology control (maintaining P2P mesh and F2F constraints)"), 1296 ("GNUnet topology control (maintaining P2P cadet and F2F constraints)"),
1297 options, &run, NULL)) ? 0 : 1; 1297 options, &run, NULL)) ? 0 : 1;
1298 GNUNET_free ((void*) argv); 1298 GNUNET_free ((void*) argv);
1299 return ret; 1299 return ret;
diff --git a/src/vpn/gnunet-service-vpn.c b/src/vpn/gnunet-service-vpn.c
index 2c1463519..45da1f988 100644
--- a/src/vpn/gnunet-service-vpn.c
+++ b/src/vpn/gnunet-service-vpn.c
@@ -22,12 +22,12 @@
22 * @file vpn/gnunet-service-vpn.c 22 * @file vpn/gnunet-service-vpn.c
23 * @brief service that opens a virtual interface and allows its clients 23 * @brief service that opens a virtual interface and allows its clients
24 * to allocate IPs on the virtual interface and to then redirect 24 * to allocate IPs on the virtual interface and to then redirect
25 * IP traffic received on those IPs via the GNUnet mesh 25 * IP traffic received on those IPs via the GNUnet cadet
26 * @author Philipp Toelke 26 * @author Philipp Toelke
27 * @author Christian Grothoff 27 * @author Christian Grothoff
28 * 28 *
29 * TODO: 29 * TODO:
30 * - keep multiple peers/mesh channels ready as alternative exits / 30 * - keep multiple peers/cadet channels ready as alternative exits /
31 * detect & recover from channel-to-exit failure gracefully 31 * detect & recover from channel-to-exit failure gracefully
32 */ 32 */
33#include "platform.h" 33#include "platform.h"
@@ -35,7 +35,7 @@
35#include "gnunet_common.h" 35#include "gnunet_common.h"
36#include "gnunet_protocols.h" 36#include "gnunet_protocols.h"
37#include "gnunet_applications.h" 37#include "gnunet_applications.h"
38#include "gnunet_mesh_service.h" 38#include "gnunet_cadet_service.h"
39#include "gnunet_statistics_service.h" 39#include "gnunet_statistics_service.h"
40#include "gnunet_constants.h" 40#include "gnunet_constants.h"
41#include "gnunet_tun_lib.h" 41#include "gnunet_tun_lib.h"
@@ -45,7 +45,7 @@
45 45
46 46
47/** 47/**
48 * Maximum number of messages we allow in the queue for mesh. 48 * Maximum number of messages we allow in the queue for cadet.
49 */ 49 */
50#define MAX_MESSAGE_QUEUE_SIZE 4 50#define MAX_MESSAGE_QUEUE_SIZE 4
51 51
@@ -218,7 +218,7 @@ struct ChannelState
218 * Information about the channel to use, NULL if no channel 218 * Information about the channel to use, NULL if no channel
219 * is available right now. 219 * is available right now.
220 */ 220 */
221 struct GNUNET_MESH_Channel *channel; 221 struct GNUNET_CADET_Channel *channel;
222 222
223 /** 223 /**
224 * Active query with REGEX to locate exit. 224 * Active query with REGEX to locate exit.
@@ -228,7 +228,7 @@ struct ChannelState
228 /** 228 /**
229 * Active transmission handle, NULL for none. 229 * Active transmission handle, NULL for none.
230 */ 230 */
231 struct GNUNET_MESH_TransmitHandle *th; 231 struct GNUNET_CADET_TransmitHandle *th;
232 232
233 /** 233 /**
234 * Entry for this entry in the channel_heap, NULL as long as this 234 * Entry for this entry in the channel_heap, NULL as long as this
@@ -334,13 +334,13 @@ static int global_ret;
334static const struct GNUNET_CONFIGURATION_Handle *cfg; 334static const struct GNUNET_CONFIGURATION_Handle *cfg;
335 335
336/** 336/**
337 * Handle to the mesh service. 337 * Handle to the cadet service.
338 */ 338 */
339static struct GNUNET_MESH_Handle *mesh_handle; 339static struct GNUNET_CADET_Handle *cadet_handle;
340 340
341/** 341/**
342 * Map from IP address to destination information (possibly with a 342 * Map from IP address to destination information (possibly with a
343 * MESH channel handle for fast setup). 343 * CADET channel handle for fast setup).
344 */ 344 */
345static struct GNUNET_CONTAINER_MultiHashMap *destination_map; 345static struct GNUNET_CONTAINER_MultiHashMap *destination_map;
346 346
@@ -351,7 +351,7 @@ static struct GNUNET_CONTAINER_Heap *destination_heap;
351 351
352/** 352/**
353 * Map from source and destination address (IP+port) to connection 353 * Map from source and destination address (IP+port) to connection
354 * information (mostly with the respective MESH channel handle). 354 * information (mostly with the respective CADET channel handle).
355 */ 355 */
356static struct GNUNET_CONTAINER_MultiHashMap *channel_map; 356static struct GNUNET_CONTAINER_MultiHashMap *channel_map;
357 357
@@ -542,7 +542,7 @@ free_channel_state (struct ChannelState *ts)
542{ 542{
543 struct GNUNET_HashCode key; 543 struct GNUNET_HashCode key;
544 struct ChannelMessageQueueEntry *tnq; 544 struct ChannelMessageQueueEntry *tnq;
545 struct GNUNET_MESH_Channel *channel; 545 struct GNUNET_CADET_Channel *channel;
546 546
547 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 547 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
548 "Cleaning up channel state\n"); 548 "Cleaning up channel state\n");
@@ -560,14 +560,14 @@ free_channel_state (struct ChannelState *ts)
560 GNUNET_assert (0 == ts->tmq_length); 560 GNUNET_assert (0 == ts->tmq_length);
561 if (NULL != ts->th) 561 if (NULL != ts->th)
562 { 562 {
563 GNUNET_MESH_notify_transmit_ready_cancel (ts->th); 563 GNUNET_CADET_notify_transmit_ready_cancel (ts->th);
564 ts->th = NULL; 564 ts->th = NULL;
565 } 565 }
566 GNUNET_assert (NULL == ts->destination.heap_node); 566 GNUNET_assert (NULL == ts->destination.heap_node);
567 if (NULL != (channel = ts->channel)) 567 if (NULL != (channel = ts->channel))
568 { 568 {
569 ts->channel = NULL; 569 ts->channel = NULL;
570 GNUNET_MESH_channel_destroy (channel); 570 GNUNET_CADET_channel_destroy (channel);
571 } 571 }
572 if (NULL != ts->search) 572 if (NULL != ts->search)
573 { 573 {
@@ -601,7 +601,7 @@ free_channel_state (struct ChannelState *ts)
601 601
602 602
603/** 603/**
604 * Send a message from the message queue via mesh. 604 * Send a message from the message queue via cadet.
605 * 605 *
606 * @param cls the `struct ChannelState` with the message queue 606 * @param cls the `struct ChannelState` with the message queue
607 * @param size number of bytes available in @a buf 607 * @param size number of bytes available in @a buf
@@ -622,7 +622,7 @@ send_to_peer_notify_callback (void *cls, size_t size, void *buf)
622 GNUNET_assert (NULL != tnq); 622 GNUNET_assert (NULL != tnq);
623 GNUNET_assert (size >= tnq->len); 623 GNUNET_assert (size >= tnq->len);
624 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 624 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
625 "Sending %u bytes via mesh channel\n", 625 "Sending %u bytes via cadet channel\n",
626 tnq->len); 626 tnq->len);
627 GNUNET_CONTAINER_DLL_remove (ts->tmq_head, 627 GNUNET_CONTAINER_DLL_remove (ts->tmq_head,
628 ts->tmq_tail, 628 ts->tmq_tail,
@@ -632,14 +632,14 @@ send_to_peer_notify_callback (void *cls, size_t size, void *buf)
632 ret = tnq->len; 632 ret = tnq->len;
633 GNUNET_free (tnq); 633 GNUNET_free (tnq);
634 if (NULL != (tnq = ts->tmq_head)) 634 if (NULL != (tnq = ts->tmq_head))
635 ts->th = GNUNET_MESH_notify_transmit_ready (ts->channel, 635 ts->th = GNUNET_CADET_notify_transmit_ready (ts->channel,
636 GNUNET_NO /* cork */, 636 GNUNET_NO /* cork */,
637 GNUNET_TIME_UNIT_FOREVER_REL, 637 GNUNET_TIME_UNIT_FOREVER_REL,
638 tnq->len, 638 tnq->len,
639 &send_to_peer_notify_callback, 639 &send_to_peer_notify_callback,
640 ts); 640 ts);
641 GNUNET_STATISTICS_update (stats, 641 GNUNET_STATISTICS_update (stats,
642 gettext_noop ("# Bytes given to mesh for transmission"), 642 gettext_noop ("# Bytes given to cadet for transmission"),
643 ret, GNUNET_NO); 643 ret, GNUNET_NO);
644 return ret; 644 return ret;
645} 645}
@@ -657,7 +657,7 @@ send_to_channel (struct ChannelMessageQueueEntry *tnq,
657 struct ChannelState *ts) 657 struct ChannelState *ts)
658{ 658{
659 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 659 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
660 "Queueing %u bytes for transmission via mesh channel\n", 660 "Queueing %u bytes for transmission via cadet channel\n",
661 tnq->len); 661 tnq->len);
662 GNUNET_assert (NULL != ts->channel); 662 GNUNET_assert (NULL != ts->channel);
663 GNUNET_CONTAINER_DLL_insert_tail (ts->tmq_head, 663 GNUNET_CONTAINER_DLL_insert_tail (ts->tmq_head,
@@ -674,16 +674,16 @@ send_to_channel (struct ChannelMessageQueueEntry *tnq,
674 ts->tmq_tail, 674 ts->tmq_tail,
675 dq); 675 dq);
676 ts->tmq_length--; 676 ts->tmq_length--;
677 GNUNET_MESH_notify_transmit_ready_cancel (ts->th); 677 GNUNET_CADET_notify_transmit_ready_cancel (ts->th);
678 ts->th = NULL; 678 ts->th = NULL;
679 GNUNET_STATISTICS_update (stats, 679 GNUNET_STATISTICS_update (stats,
680 gettext_noop ("# Bytes dropped in mesh queue (overflow)"), 680 gettext_noop ("# Bytes dropped in cadet queue (overflow)"),
681 dq->len, 681 dq->len,
682 GNUNET_NO); 682 GNUNET_NO);
683 GNUNET_free (dq); 683 GNUNET_free (dq);
684 } 684 }
685 if (NULL == ts->th) 685 if (NULL == ts->th)
686 ts->th = GNUNET_MESH_notify_transmit_ready (ts->channel, 686 ts->th = GNUNET_CADET_notify_transmit_ready (ts->channel,
687 GNUNET_NO /* cork */, 687 GNUNET_NO /* cork */,
688 GNUNET_TIME_UNIT_FOREVER_REL, 688 GNUNET_TIME_UNIT_FOREVER_REL,
689 tnq->len, 689 tnq->len,
@@ -727,16 +727,16 @@ handle_regex_result (void *cls,
727 GNUNET_break (0); 727 GNUNET_break (0);
728 return; 728 return;
729 } 729 }
730 ts->channel = GNUNET_MESH_channel_create (mesh_handle, 730 ts->channel = GNUNET_CADET_channel_create (cadet_handle,
731 ts, 731 ts,
732 id, 732 id,
733 apptype, 733 apptype,
734 GNUNET_MESH_OPTION_DEFAULT); 734 GNUNET_CADET_OPTION_DEFAULT);
735} 735}
736 736
737 737
738/** 738/**
739 * Initialize the given destination entry's mesh channel. 739 * Initialize the given destination entry's cadet channel.
740 * 740 *
741 * @param dt destination channel for which we need to setup a channel 741 * @param dt destination channel for which we need to setup a channel
742 * @param client_af address family of the address returned to the client 742 * @param client_af address family of the address returned to the client
@@ -750,7 +750,7 @@ create_channel_to_destination (struct DestinationChannel *dt,
750 unsigned int apptype; 750 unsigned int apptype;
751 751
752 GNUNET_STATISTICS_update (stats, 752 GNUNET_STATISTICS_update (stats,
753 gettext_noop ("# Mesh channels created"), 753 gettext_noop ("# Cadet channels created"),
754 1, GNUNET_NO); 754 1, GNUNET_NO);
755 GNUNET_assert (NULL == dt->ts); 755 GNUNET_assert (NULL == dt->ts);
756 switch (client_af) 756 switch (client_af)
@@ -773,15 +773,15 @@ create_channel_to_destination (struct DestinationChannel *dt,
773 ts->destination_container = dt; /* we are referenced from dt */ 773 ts->destination_container = dt; /* we are referenced from dt */
774 if (dt->destination->is_service) 774 if (dt->destination->is_service)
775 { 775 {
776 ts->channel = GNUNET_MESH_channel_create (mesh_handle, 776 ts->channel = GNUNET_CADET_channel_create (cadet_handle,
777 ts, 777 ts,
778 &dt->destination->details.service_destination.target, 778 &dt->destination->details.service_destination.target,
779 apptype, 779 apptype,
780 GNUNET_MESH_OPTION_DEFAULT); 780 GNUNET_CADET_OPTION_DEFAULT);
781 if (NULL == ts->channel) 781 if (NULL == ts->channel)
782 { 782 {
783 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 783 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
784 _("Failed to setup mesh channel!\n")); 784 _("Failed to setup cadet channel!\n"));
785 GNUNET_free (ts); 785 GNUNET_free (ts);
786 return NULL; 786 return NULL;
787 } 787 }
@@ -857,7 +857,7 @@ expire_channel (struct ChannelState *except)
857 857
858 858
859/** 859/**
860 * Route a packet via mesh to the given destination. 860 * Route a packet via cadet to the given destination.
861 * 861 *
862 * @param destination description of the destination 862 * @param destination description of the destination
863 * @param af address family on this end (AF_INET or AF_INET6) 863 * @param af address family on this end (AF_INET or AF_INET6)
@@ -1510,7 +1510,7 @@ route_packet (struct DestinationEntry *destination,
1510/** 1510/**
1511 * Receive packets from the helper-process (someone send to the local 1511 * Receive packets from the helper-process (someone send to the local
1512 * virtual channel interface). Find the destination mapping, and if it 1512 * virtual channel interface). Find the destination mapping, and if it
1513 * exists, identify the correct MESH channel (or possibly create it) 1513 * exists, identify the correct CADET channel (or possibly create it)
1514 * and forward the packet. 1514 * and forward the packet.
1515 * 1515 *
1516 * @param cls closure, NULL 1516 * @param cls closure, NULL
@@ -1682,7 +1682,7 @@ make_up_icmpv6_payload (struct ChannelState *ts,
1682 1682
1683 1683
1684/** 1684/**
1685 * We got an ICMP packet back from the MESH channel. Pass it on to the 1685 * We got an ICMP packet back from the CADET channel. Pass it on to the
1686 * local virtual interface via the helper. 1686 * local virtual interface via the helper.
1687 * 1687 *
1688 * @param cls closure, NULL 1688 * @param cls closure, NULL
@@ -1694,7 +1694,7 @@ make_up_icmpv6_payload (struct ChannelState *ts,
1694 */ 1694 */
1695static int 1695static int
1696receive_icmp_back (void *cls, 1696receive_icmp_back (void *cls,
1697 struct GNUNET_MESH_Channel *channel, 1697 struct GNUNET_CADET_Channel *channel,
1698 void **channel_ctx, 1698 void **channel_ctx,
1699 const struct GNUNET_MessageHeader *message) 1699 const struct GNUNET_MessageHeader *message)
1700{ 1700{
@@ -1703,7 +1703,7 @@ receive_icmp_back (void *cls,
1703 size_t mlen; 1703 size_t mlen;
1704 1704
1705 GNUNET_STATISTICS_update (stats, 1705 GNUNET_STATISTICS_update (stats,
1706 gettext_noop ("# ICMP packets received from mesh"), 1706 gettext_noop ("# ICMP packets received from cadet"),
1707 1, GNUNET_NO); 1707 1, GNUNET_NO);
1708 mlen = ntohs (message->size); 1708 mlen = ntohs (message->size);
1709 if (mlen < sizeof (struct GNUNET_EXIT_IcmpToVPNMessage)) 1709 if (mlen < sizeof (struct GNUNET_EXIT_IcmpToVPNMessage))
@@ -1728,7 +1728,7 @@ receive_icmp_back (void *cls,
1728 char dbuf[INET6_ADDRSTRLEN]; 1728 char dbuf[INET6_ADDRSTRLEN];
1729 1729
1730 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1730 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1731 "Received ICMP packet from mesh, sending %u bytes from %s -> %s via TUN\n", 1731 "Received ICMP packet from cadet, sending %u bytes from %s -> %s via TUN\n",
1732 (unsigned int) mlen, 1732 (unsigned int) mlen,
1733 inet_ntop (ts->af, &ts->destination_ip, sbuf, sizeof (sbuf)), 1733 inet_ntop (ts->af, &ts->destination_ip, sbuf, sizeof (sbuf)),
1734 inet_ntop (ts->af, &ts->source_ip, dbuf, sizeof (dbuf))); 1734 inet_ntop (ts->af, &ts->source_ip, dbuf, sizeof (dbuf)));
@@ -2021,7 +2021,7 @@ receive_icmp_back (void *cls,
2021 2021
2022 2022
2023/** 2023/**
2024 * We got a UDP packet back from the MESH channel. Pass it on to the 2024 * We got a UDP packet back from the CADET channel. Pass it on to the
2025 * local virtual interface via the helper. 2025 * local virtual interface via the helper.
2026 * 2026 *
2027 * @param cls closure, NULL 2027 * @param cls closure, NULL
@@ -2033,7 +2033,7 @@ receive_icmp_back (void *cls,
2033 */ 2033 */
2034static int 2034static int
2035receive_udp_back (void *cls, 2035receive_udp_back (void *cls,
2036 struct GNUNET_MESH_Channel *channel, 2036 struct GNUNET_CADET_Channel *channel,
2037 void **channel_ctx, 2037 void **channel_ctx,
2038 const struct GNUNET_MessageHeader *message) 2038 const struct GNUNET_MessageHeader *message)
2039{ 2039{
@@ -2042,7 +2042,7 @@ receive_udp_back (void *cls,
2042 size_t mlen; 2042 size_t mlen;
2043 2043
2044 GNUNET_STATISTICS_update (stats, 2044 GNUNET_STATISTICS_update (stats,
2045 gettext_noop ("# UDP packets received from mesh"), 2045 gettext_noop ("# UDP packets received from cadet"),
2046 1, GNUNET_NO); 2046 1, GNUNET_NO);
2047 mlen = ntohs (message->size); 2047 mlen = ntohs (message->size);
2048 if (mlen < sizeof (struct GNUNET_EXIT_UdpReplyMessage)) 2048 if (mlen < sizeof (struct GNUNET_EXIT_UdpReplyMessage))
@@ -2067,7 +2067,7 @@ receive_udp_back (void *cls,
2067 char dbuf[INET6_ADDRSTRLEN]; 2067 char dbuf[INET6_ADDRSTRLEN];
2068 2068
2069 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2069 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2070 "Received UDP reply from mesh, sending %u bytes from %s:%u -> %s:%u via TUN\n", 2070 "Received UDP reply from cadet, sending %u bytes from %s:%u -> %s:%u via TUN\n",
2071 (unsigned int) mlen, 2071 (unsigned int) mlen,
2072 inet_ntop (ts->af, &ts->destination_ip, sbuf, sizeof (sbuf)), 2072 inet_ntop (ts->af, &ts->destination_ip, sbuf, sizeof (sbuf)),
2073 ts->destination_port, 2073 ts->destination_port,
@@ -2176,7 +2176,7 @@ receive_udp_back (void *cls,
2176 2176
2177 2177
2178/** 2178/**
2179 * We got a TCP packet back from the MESH channel. Pass it on to the 2179 * We got a TCP packet back from the CADET channel. Pass it on to the
2180 * local virtual interface via the helper. 2180 * local virtual interface via the helper.
2181 * 2181 *
2182 * @param cls closure, NULL 2182 * @param cls closure, NULL
@@ -2188,7 +2188,7 @@ receive_udp_back (void *cls,
2188 */ 2188 */
2189static int 2189static int
2190receive_tcp_back (void *cls, 2190receive_tcp_back (void *cls,
2191 struct GNUNET_MESH_Channel *channel, 2191 struct GNUNET_CADET_Channel *channel,
2192 void **channel_ctx, 2192 void **channel_ctx,
2193 const struct GNUNET_MessageHeader *message) 2193 const struct GNUNET_MessageHeader *message)
2194{ 2194{
@@ -2197,7 +2197,7 @@ receive_tcp_back (void *cls,
2197 size_t mlen; 2197 size_t mlen;
2198 2198
2199 GNUNET_STATISTICS_update (stats, 2199 GNUNET_STATISTICS_update (stats,
2200 gettext_noop ("# TCP packets received from mesh"), 2200 gettext_noop ("# TCP packets received from cadet"),
2201 1, GNUNET_NO); 2201 1, GNUNET_NO);
2202 mlen = ntohs (message->size); 2202 mlen = ntohs (message->size);
2203 if (mlen < sizeof (struct GNUNET_EXIT_TcpDataMessage)) 2203 if (mlen < sizeof (struct GNUNET_EXIT_TcpDataMessage))
@@ -2217,7 +2217,7 @@ receive_tcp_back (void *cls,
2217 char dbuf[INET6_ADDRSTRLEN]; 2217 char dbuf[INET6_ADDRSTRLEN];
2218 2218
2219 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2219 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2220 "Received TCP reply from mesh, sending %u bytes from %s:%u -> %s:%u via TUN\n", 2220 "Received TCP reply from cadet, sending %u bytes from %s:%u -> %s:%u via TUN\n",
2221 (unsigned int) mlen, 2221 (unsigned int) mlen,
2222 inet_ntop (ts->af, &ts->destination_ip, sbuf, sizeof (sbuf)), 2222 inet_ntop (ts->af, &ts->destination_ip, sbuf, sizeof (sbuf)),
2223 ts->destination_port, 2223 ts->destination_port,
@@ -2774,19 +2774,19 @@ service_redirect_to_service (void *cls,
2774 * Function called whenever a channel is destroyed. Should clean up 2774 * Function called whenever a channel is destroyed. Should clean up
2775 * any associated state. 2775 * any associated state.
2776 * 2776 *
2777 * @param cls closure (set from #GNUNET_MESH_connect) 2777 * @param cls closure (set from #GNUNET_CADET_connect)
2778 * @param channel connection to the other end (henceforth invalid) 2778 * @param channel connection to the other end (henceforth invalid)
2779 * @param channel_ctx place where local state associated 2779 * @param channel_ctx place where local state associated
2780 * with the channel is stored (our `struct ChannelState`) 2780 * with the channel is stored (our `struct ChannelState`)
2781 */ 2781 */
2782static void 2782static void
2783channel_cleaner (void *cls, 2783channel_cleaner (void *cls,
2784 const struct GNUNET_MESH_Channel *channel, 2784 const struct GNUNET_CADET_Channel *channel,
2785 void *channel_ctx) 2785 void *channel_ctx)
2786{ 2786{
2787 struct ChannelState *ts = channel_ctx; 2787 struct ChannelState *ts = channel_ctx;
2788 2788
2789 ts->channel = NULL; /* we must not call GNUNET_MESH_channel_destroy() anymore */ 2789 ts->channel = NULL; /* we must not call GNUNET_CADET_channel_destroy() anymore */
2790 free_channel_state (ts); 2790 free_channel_state (ts);
2791} 2791}
2792 2792
@@ -2871,10 +2871,10 @@ cleanup (void *cls,
2871 GNUNET_CONTAINER_heap_destroy (channel_heap); 2871 GNUNET_CONTAINER_heap_destroy (channel_heap);
2872 channel_heap = NULL; 2872 channel_heap = NULL;
2873 } 2873 }
2874 if (NULL != mesh_handle) 2874 if (NULL != cadet_handle)
2875 { 2875 {
2876 GNUNET_MESH_disconnect (mesh_handle); 2876 GNUNET_CADET_disconnect (cadet_handle);
2877 mesh_handle = NULL; 2877 cadet_handle = NULL;
2878 } 2878 }
2879 if (NULL != helper_handle) 2879 if (NULL != helper_handle)
2880 { 2880 {
@@ -2916,7 +2916,7 @@ run (void *cls,
2916 sizeof (struct RedirectToServiceRequestMessage) }, 2916 sizeof (struct RedirectToServiceRequestMessage) },
2917 {NULL, NULL, 0, 0} 2917 {NULL, NULL, 0, 0}
2918 }; 2918 };
2919 static const struct GNUNET_MESH_MessageHandler mesh_handlers[] = { 2919 static const struct GNUNET_CADET_MessageHandler cadet_handlers[] = {
2920 { &receive_udp_back, GNUNET_MESSAGE_TYPE_VPN_UDP_REPLY, 0}, 2920 { &receive_udp_back, GNUNET_MESSAGE_TYPE_VPN_UDP_REPLY, 0},
2921 { &receive_tcp_back, GNUNET_MESSAGE_TYPE_VPN_TCP_DATA_TO_VPN, 0}, 2921 { &receive_tcp_back, GNUNET_MESSAGE_TYPE_VPN_TCP_DATA_TO_VPN, 0},
2922 { &receive_icmp_back, GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_VPN, 0}, 2922 { &receive_icmp_back, GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_VPN, 0},
@@ -3053,11 +3053,11 @@ run (void *cls,
3053 } 3053 }
3054 vpn_argv[6] = NULL; 3054 vpn_argv[6] = NULL;
3055 3055
3056 mesh_handle = 3056 cadet_handle =
3057 GNUNET_MESH_connect (cfg_, NULL, 3057 GNUNET_CADET_connect (cfg_, NULL,
3058 NULL, 3058 NULL,
3059 &channel_cleaner, 3059 &channel_cleaner,
3060 mesh_handlers, 3060 cadet_handlers,
3061 NULL); 3061 NULL);
3062 helper_handle = GNUNET_HELPER_start (GNUNET_NO, 3062 helper_handle = GNUNET_HELPER_start (GNUNET_NO,
3063 "gnunet-helper-vpn", vpn_argv, 3063 "gnunet-helper-vpn", vpn_argv,