aboutsummaryrefslogtreecommitdiff
path: root/src/mesh/gnunet-service-mesh.c
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2011-04-13 15:48:05 +0000
committerBart Polot <bart@net.in.tum.de>2011-04-13 15:48:05 +0000
commitc8048958a43ce41ca611580111164ae2ca73f9aa (patch)
tree93feb99b858e8ee0593308cb7d28275c358a7da4 /src/mesh/gnunet-service-mesh.c
parent669c0c17bf9f9bcdd315767f4223c10c0034deff (diff)
downloadgnunet-c8048958a43ce41ca611580111164ae2ca73f9aa.tar.gz
gnunet-c8048958a43ce41ca611580111164ae2ca73f9aa.zip
WiP
Diffstat (limited to 'src/mesh/gnunet-service-mesh.c')
-rw-r--r--src/mesh/gnunet-service-mesh.c57
1 files changed, 47 insertions, 10 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c
index 9e0119b24..6e94fbb5a 100644
--- a/src/mesh/gnunet-service-mesh.c
+++ b/src/mesh/gnunet-service-mesh.c
@@ -267,6 +267,7 @@ struct Path
267 */ 267 */
268 struct Path *next; 268 struct Path *next;
269 struct Path *prev; 269 struct Path *prev;
270
270 /** 271 /**
271 * Id of the path, in case it's needed 272 * Id of the path, in case it's needed
272 */ 273 */
@@ -283,6 +284,30 @@ struct Path
283 GNUNET_PEER_Id *peers; 284 GNUNET_PEER_Id *peers;
284}; 285};
285 286
287struct MESH_queue
288{
289 /**
290 * Double linked list
291 */
292 struct MESH_queue *next;
293 struct MESH_queue *prev;
294
295 /**
296 * Size of the message to transmit
297 */
298 unsigned int size;
299
300 /**
301 * How old is the data?
302 */
303 struct GNUNET_TIME_Absolute timestamp;
304
305 /**
306 * Data itself
307 */
308 struct GNUNET_MessageHeader *data;
309};
310
286 311
287struct Client; /* FWD declaration */ 312struct Client; /* FWD declaration */
288/** 313/**
@@ -356,14 +381,16 @@ struct MESH_tunnel
356 struct Client *client; 381 struct Client *client;
357 382
358 /** 383 /**
359 * Messages ready to transmit??? -- FIXME real queues needed 384 * Messages ready to transmit
360 */ 385 */
361 struct GNUNET_MessageHeader *msg_out; 386 struct MESH_queue *out_head;
387 struct MESH_queue *out_tail;
362 388
363 /** 389 /**
364 * Messages received and not processed??? -- FIXME real queues needed 390 * Messages received and not processed
365 */ 391 */
366 struct GNUNET_MessageHeader *msg_in; 392 struct MESH_queue *in_head;
393 struct MESH_queue *in_tail;
367 394
368}; 395};
369 396
@@ -637,18 +664,28 @@ handle_local_tunnel_create (void *cls,
637 } 664 }
638 /* Sanity check for duplicate tunnel IDs */ 665 /* Sanity check for duplicate tunnel IDs */
639 for (t = tunnels_head; t != tunnels_head; t = t->next) { 666 for (t = tunnels_head; t != tunnels_head; t = t->next) {
640 /* TODO - maybe this is not enough, need to consider the whole 667 if(t->tid == ntohl(tunnel_msg->tunnel_id)) {
641 * local/global numbering system, but probably it's ok (WiP)
642 */
643 if(t->tid == tunnel_msg->tunnel_id) {
644 GNUNET_break(0); 668 GNUNET_break(0);
645 GNUNET_SERVER_receive_done(client, GNUNET_SYSERR); 669 GNUNET_SERVER_receive_done(client, GNUNET_SYSERR);
646 return; 670 return;
647 } 671 }
648 } 672 }
649 //tunnel_msg->tunnel_id; 673 /* FIXME: calloc? is NULL != 0 on any platform? */
650 674 t = GNUNET_malloc(sizeof(MESH_tunnel));
675 t->tid = ntohl(tunnel_msg->tunnel_id);
676 /* FIXME: t->oid = selfid;*/
677 t->peers_ready = 0;
678 t->peers_total = 0;
679 t->peers_head = NULL;
680 t->peers_tail = NULL;
681 t->paths_head = NULL;
682 t->paths_tail = NULL;
683 t->in_head = NULL;
684 t->in_tail = NULL;
685 t->out_head = NULL;
686 t->out_tail = NULL;
651 687
688 GNUNET_SERVER_receive_done(client, GNUNET_OK);
652 return; 689 return;
653} 690}
654 691