aboutsummaryrefslogtreecommitdiff
path: root/src/mesh/gnunet-service-mesh_local.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesh/gnunet-service-mesh_local.c')
-rw-r--r--src/mesh/gnunet-service-mesh_local.c274
1 files changed, 137 insertions, 137 deletions
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