diff options
author | Supriti Singh <supritisingh08@gmail.com> | 2014-02-17 15:57:11 +0000 |
---|---|---|
committer | Supriti Singh <supritisingh08@gmail.com> | 2014-02-17 15:57:11 +0000 |
commit | 85755103143297d41ccf63c68492822e9b951495 (patch) | |
tree | 2e670cf704d6d4c377406e0551135e1f7af4324f /src/dht | |
parent | 1d6824b116658d2490aaa1a5d1662e3857e86d3f (diff) | |
download | gnunet-85755103143297d41ccf63c68492822e9b951495.tar.gz gnunet-85755103143297d41ccf63c68492822e9b951495.zip |
1.Modified struct PeerTrailSetupMessage and PeerTrailSetupResultMessage.
2.Handling trail setup result message.
Diffstat (limited to 'src/dht')
-rw-r--r-- | src/dht/gnunet-service-dht_neighbours.c | 4 | ||||
-rw-r--r-- | src/dht/gnunet-service-xdht_neighbours.c | 690 | ||||
-rw-r--r-- | src/dht/gnunet-service-xdht_neighbours.h | 1 | ||||
-rw-r--r-- | src/dht/gnunet-service-xdht_routing.c | 9 | ||||
-rw-r--r-- | src/dht/gnunet-service-xdht_routing.h | 6 |
5 files changed, 397 insertions, 313 deletions
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c index 0ee29ec49..0cf46f562 100644 --- a/src/dht/gnunet-service-dht_neighbours.c +++ b/src/dht/gnunet-service-dht_neighbours.c | |||
@@ -645,7 +645,7 @@ handle_core_connect (void *cls, const struct GNUNET_PeerIdentity *peer) | |||
645 | struct PeerInfo *ret; | 645 | struct PeerInfo *ret; |
646 | struct GNUNET_HashCode phash; | 646 | struct GNUNET_HashCode phash; |
647 | int peer_bucket; | 647 | int peer_bucket; |
648 | 648 | ||
649 | /* Check for connect to self message */ | 649 | /* Check for connect to self message */ |
650 | if (0 == memcmp (&my_identity, peer, sizeof (struct GNUNET_PeerIdentity))) | 650 | if (0 == memcmp (&my_identity, peer, sizeof (struct GNUNET_PeerIdentity))) |
651 | return; | 651 | return; |
@@ -784,7 +784,7 @@ core_transmit_notify (void *cls, size_t size, void *buf) | |||
784 | struct P2PPendingMessage *pending; | 784 | struct P2PPendingMessage *pending; |
785 | size_t off; | 785 | size_t off; |
786 | size_t msize; | 786 | size_t msize; |
787 | 787 | ||
788 | peer->th = NULL; | 788 | peer->th = NULL; |
789 | while ((NULL != (pending = peer->head)) && | 789 | while ((NULL != (pending = peer->head)) && |
790 | (0 == GNUNET_TIME_absolute_get_remaining (pending->timeout).rel_value_us)) | 790 | (0 == GNUNET_TIME_absolute_get_remaining (pending->timeout).rel_value_us)) |
diff --git a/src/dht/gnunet-service-xdht_neighbours.c b/src/dht/gnunet-service-xdht_neighbours.c index 020676a9b..aa52591bb 100644 --- a/src/dht/gnunet-service-xdht_neighbours.c +++ b/src/dht/gnunet-service-xdht_neighbours.c | |||
@@ -49,11 +49,11 @@ | |||
49 | #include "dht.h" | 49 | #include "dht.h" |
50 | 50 | ||
51 | 51 | ||
52 | /*TODO | 52 | /* FIXME: |
53 | * 1. Remove extra comments - FIXME,TODO,SUPU | 53 | 1. You are not using mod when searching for the closest successor of a finger. |
54 | * 2. Use GNUNET_Log to debug | ||
55 | */ | 54 | */ |
56 | 55 | ||
56 | |||
57 | /** | 57 | /** |
58 | * Maximum possible fingers of a peer. | 58 | * Maximum possible fingers of a peer. |
59 | */ | 59 | */ |
@@ -74,6 +74,12 @@ | |||
74 | */ | 74 | */ |
75 | #define DHT_MAXIMUM_FIND_FINGER_TRAIL_INTERVAL GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 10) | 75 | #define DHT_MAXIMUM_FIND_FINGER_TRAIL_INTERVAL GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 10) |
76 | 76 | ||
77 | /** | ||
78 | * FIXME: Currently used in GDS_NEIGHBOURS_handle_trail_setup. | ||
79 | * I have just copied it from gnunet-service-dht_neighbours. Will it work here? | ||
80 | * How long at most to wait for transmission of a GET request to another peer? | ||
81 | */ | ||
82 | #define GET_TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 2) | ||
77 | 83 | ||
78 | GNUNET_NETWORK_STRUCT_BEGIN | 84 | GNUNET_NETWORK_STRUCT_BEGIN |
79 | 85 | ||
@@ -238,36 +244,8 @@ struct PeerGetMessage | |||
238 | 244 | ||
239 | 245 | ||
240 | /** | 246 | /** |
241 | * FIXME: I have defined this struct between GNUNET_NETWORK_STRUCT_BEGIN. Is | ||
242 | * it correct? Also, I am using the same struct inside finger info and trailsetup | ||
243 | * trailsetupresult message. Is it correct? Verify while testing. */ | ||
244 | /** | ||
245 | * Linked List of peers which are part of trail to reach a particular Finger. | ||
246 | */ | ||
247 | struct TrailPeerList | ||
248 | { | ||
249 | /** | ||
250 | * Pointer to next item in the list | ||
251 | */ | ||
252 | struct TrailPeerList *next; | ||
253 | |||
254 | /** | ||
255 | * Pointer to previous item in the list | ||
256 | */ | ||
257 | struct TrailPeerList *prev; | ||
258 | |||
259 | /** | ||
260 | * An element in this trail list | ||
261 | */ | ||
262 | struct GNUNET_PeerIdentity *peer; | ||
263 | |||
264 | }; | ||
265 | |||
266 | |||
267 | /** | ||
268 | * FIXME : I am using the same struct TrailPeerList in both finger info | ||
269 | * and peertrailsetupmessage. Verify if its okay. | ||
270 | * P2P Trail setup message | 247 | * P2P Trail setup message |
248 | * TODO: Take reference from put_path and get_path to understand how to use size of trail list. | ||
271 | */ | 249 | */ |
272 | struct PeerTrailSetupMessage | 250 | struct PeerTrailSetupMessage |
273 | { | 251 | { |
@@ -279,27 +257,31 @@ struct PeerTrailSetupMessage | |||
279 | /** | 257 | /** |
280 | * Source peer which wants to find trail to one of its finger. | 258 | * Source peer which wants to find trail to one of its finger. |
281 | */ | 259 | */ |
282 | struct GNUNET_PeerIdentity *source_peer; | 260 | struct GNUNET_PeerIdentity source_peer; |
283 | 261 | ||
284 | /** | 262 | /** |
285 | * Finger id to which we want to set up the trail to. | 263 | * Finger id to which we want to set up the trail to. |
286 | */ | 264 | */ |
287 | struct GNUNET_PeerIdentity *destination_finger; | 265 | struct GNUNET_PeerIdentity destination_finger; |
288 | 266 | ||
267 | /* FIXME: Temporary field to handle current_destination properly. | ||
268 | If flag = 0, then this message's current_destination is a friend. | ||
269 | If flag = 1, then the message's current destination is a finger. */ | ||
270 | int flag; | ||
289 | /** | 271 | /** |
290 | * This field contains the peer to which this packet is forwarded. | 272 | * This field contains the peer to which this packet is forwarded. |
291 | */ | 273 | */ |
292 | struct GNUNET_PeerIdentity *current_destination; | 274 | struct GNUNET_PeerIdentity current_destination; |
293 | 275 | ||
294 | /** | 276 | /** |
295 | * Head of trail list. | 277 | * Number of entries in trail list. |
278 | * FIXME: Is this data type correct? | ||
279 | * FIMXE: Is usage of GNUNET_PACKED correct? | ||
296 | */ | 280 | */ |
297 | struct TrailPeerList *head; | 281 | uint32_t trail_length GNUNET_PACKED; |
298 | 282 | ||
299 | /** | 283 | /* The finger index in finger map. */ |
300 | * Tail of trail list. | 284 | unsigned int finger_index; |
301 | */ | ||
302 | struct TrailPeerList *tail; | ||
303 | 285 | ||
304 | }; | 286 | }; |
305 | 287 | ||
@@ -317,27 +299,30 @@ struct PeerTrailSetupResultMessage | |||
317 | /** | 299 | /** |
318 | * Finger to which we have found the path. | 300 | * Finger to which we have found the path. |
319 | */ | 301 | */ |
320 | struct GNUNET_PeerIdentity *finger; | 302 | struct GNUNET_PeerIdentity finger; |
321 | 303 | ||
322 | /** | 304 | /** |
323 | * Peer which was looking for the trail to finger. | 305 | * Peer which was looking for the trail to finger. |
324 | */ | 306 | */ |
325 | struct GNUNET_PeerIdentity *destination_peer; | 307 | struct GNUNET_PeerIdentity destination_peer; |
326 | 308 | ||
327 | /** | 309 | /** |
328 | * This field contains the peer to which this packet is forwarded. | 310 | * This field contains the peer to which this packet is forwarded. |
329 | */ | 311 | */ |
330 | struct GNUNET_PeerIdentity *current_destination; | 312 | struct GNUNET_PeerIdentity current_destination; |
331 | 313 | ||
332 | /** | 314 | /** |
333 | * Head of trail list. | 315 | * FIXME: Temporary field used to remember at which index we should read |
316 | * to get our next peer. | ||
334 | */ | 317 | */ |
335 | struct TrailPeerList *head; | 318 | unsigned int current_index; |
336 | 319 | ||
337 | /** | 320 | /** |
338 | * Tail of trail list. | 321 | * Number of entries in trail list. |
322 | * FIXME: Is this data type correct? | ||
323 | * FIXME: Is usage of GNUNET_PACKED correct? | ||
339 | */ | 324 | */ |
340 | struct TrailPeerList *tail; | 325 | uint32_t list_size GNUNET_PACKED; |
341 | 326 | ||
342 | }; | 327 | }; |
343 | 328 | ||
@@ -378,25 +363,53 @@ struct P2PPendingMessage | |||
378 | 363 | ||
379 | }; | 364 | }; |
380 | 365 | ||
366 | |||
367 | /** | ||
368 | * Linked List of peers which are part of trail to reach a particular Finger. | ||
369 | */ | ||
370 | struct TrailPeerList | ||
371 | { | ||
372 | /** | ||
373 | * Pointer to next item in the list | ||
374 | */ | ||
375 | struct TrailPeerList *next; | ||
376 | |||
377 | /** | ||
378 | * Pointer to previous item in the list | ||
379 | */ | ||
380 | struct TrailPeerList *prev; | ||
381 | |||
382 | /** | ||
383 | * An element in this trail list | ||
384 | */ | ||
385 | struct GNUNET_PeerIdentity peer; | ||
386 | |||
387 | }; | ||
388 | |||
389 | |||
381 | /** | 390 | /** |
382 | * Entry in friend_peers map. | 391 | * Entry in friend_peermap. |
383 | */ | 392 | */ |
384 | struct FriendInfo | 393 | struct FriendInfo |
385 | { | 394 | { |
386 | 395 | /** | |
387 | /** | 396 | * What is the identity of the peer? |
388 | * What is the identity of the peer? | 397 | */ |
389 | */ | ||
390 | struct GNUNET_PeerIdentity id; | 398 | struct GNUNET_PeerIdentity id; |
391 | 399 | ||
392 | /** | 400 | /** |
393 | * Count of outstanding messages for peer. | 401 | * Count of outstanding messages for peer. |
394 | */ | 402 | */ |
395 | unsigned int pending_count; | 403 | unsigned int pending_count; |
396 | 404 | ||
397 | /** | 405 | /** |
398 | * Head of pending messages to be sent to this peer. | 406 | * Peer id of next friend in friend peermap in 64 bit format. |
399 | */ | 407 | */ |
408 | uint64_t interval_end; | ||
409 | |||
410 | /** | ||
411 | * Head of pending messages to be sent to this peer. | ||
412 | */ | ||
400 | struct P2PPendingMessage *head; | 413 | struct P2PPendingMessage *head; |
401 | 414 | ||
402 | /** | 415 | /** |
@@ -412,8 +425,9 @@ struct FriendInfo | |||
412 | 425 | ||
413 | }; | 426 | }; |
414 | 427 | ||
428 | |||
415 | /** | 429 | /** |
416 | * Entry in finger_peers map. | 430 | * Entry in finger_peermap. |
417 | */ | 431 | */ |
418 | struct FingerInfo | 432 | struct FingerInfo |
419 | { | 433 | { |
@@ -442,6 +456,10 @@ struct FingerInfo | |||
442 | */ | 456 | */ |
443 | struct TrailPeerList *tail; | 457 | struct TrailPeerList *tail; |
444 | 458 | ||
459 | /** | ||
460 | * Finger index. | ||
461 | */ | ||
462 | unsigned int finger_index; | ||
445 | }; | 463 | }; |
446 | 464 | ||
447 | 465 | ||
@@ -464,12 +482,12 @@ static struct GNUNET_HashCode my_identity_hash; | |||
464 | /** | 482 | /** |
465 | * Hash map of all the friends of a peer | 483 | * Hash map of all the friends of a peer |
466 | */ | 484 | */ |
467 | static struct GNUNET_CONTAINER_MultiPeerMap *friend_peers; | 485 | static struct GNUNET_CONTAINER_MultiPeerMap *friend_peermap; |
468 | 486 | ||
469 | /** | 487 | /** |
470 | * Hash map of all the fingers of a peer | 488 | * Hash map of all the fingers of a peer |
471 | */ | 489 | */ |
472 | static struct GNUNET_CONTAINER_MultiPeerMap *finger_peers; | 490 | static struct GNUNET_CONTAINER_MultiPeerMap *finger_peermap; |
473 | 491 | ||
474 | /** | 492 | /** |
475 | * TODO: Ask whats the use of ATS. | 493 | * TODO: Ask whats the use of ATS. |
@@ -490,9 +508,9 @@ static unsigned int current_finger_index; | |||
490 | 508 | ||
491 | /** | 509 | /** |
492 | * Called when core is ready to send a message we asked for | 510 | * Called when core is ready to send a message we asked for |
493 | * out to the destination. | 511 | * out to the destination. |
494 | * | 512 | * |
495 | * @param cls the 'struct FriendInfo' of the target friend peer | 513 | * @param cls the 'struct PeerInfo' of the target peer |
496 | * @param size number of bytes available in buf | 514 | * @param size number of bytes available in buf |
497 | * @param buf where the callee should write the message | 515 | * @param buf where the callee should write the message |
498 | * @return number of bytes written to buf | 516 | * @return number of bytes written to buf |
@@ -511,19 +529,19 @@ core_transmit_notify (void *cls, size_t size, void *buf) | |||
511 | (0 == GNUNET_TIME_absolute_get_remaining (pending->timeout).rel_value_us)) | 529 | (0 == GNUNET_TIME_absolute_get_remaining (pending->timeout).rel_value_us)) |
512 | { | 530 | { |
513 | peer->pending_count--; | 531 | peer->pending_count--; |
514 | GNUNET_CONTAINER_DLL_remove (peer->head, peer->tail, pending); | 532 | GNUNET_CONTAINER_DLL_remove (peer->head, peer->tail, pending); |
515 | GNUNET_free (pending); | 533 | GNUNET_free (pending); |
516 | } | 534 | } |
517 | if (pending == NULL) | 535 | if (NULL == pending) |
518 | { | 536 | { |
519 | /* no messages pending */ | 537 | /* no messages pending */ |
520 | return 0; | 538 | return 0; |
521 | } | 539 | } |
522 | if (buf == NULL) | 540 | if (NULL == buf) |
523 | { | 541 | { |
524 | peer->th = | 542 | peer->th = |
525 | GNUNET_CORE_notify_transmit_ready (core_api, GNUNET_NO, | 543 | GNUNET_CORE_notify_transmit_ready (core_api, GNUNET_NO, |
526 | pending->importance, | 544 | GNUNET_CORE_PRIO_BEST_EFFORT, |
527 | GNUNET_TIME_absolute_get_remaining | 545 | GNUNET_TIME_absolute_get_remaining |
528 | (pending->timeout), &peer->id, | 546 | (pending->timeout), &peer->id, |
529 | ntohs (pending->msg->size), | 547 | ntohs (pending->msg->size), |
@@ -549,7 +567,7 @@ core_transmit_notify (void *cls, size_t size, void *buf) | |||
549 | { | 567 | { |
550 | peer->th = | 568 | peer->th = |
551 | GNUNET_CORE_notify_transmit_ready (core_api, GNUNET_NO, | 569 | GNUNET_CORE_notify_transmit_ready (core_api, GNUNET_NO, |
552 | pending->importance, | 570 | GNUNET_CORE_PRIO_BEST_EFFORT, |
553 | GNUNET_TIME_absolute_get_remaining | 571 | GNUNET_TIME_absolute_get_remaining |
554 | (pending->timeout), &peer->id, msize, | 572 | (pending->timeout), &peer->id, msize, |
555 | &core_transmit_notify, peer); | 573 | &core_transmit_notify, peer); |
@@ -568,18 +586,18 @@ static void | |||
568 | process_friend_queue (struct FriendInfo *peer) | 586 | process_friend_queue (struct FriendInfo *peer) |
569 | { | 587 | { |
570 | struct P2PPendingMessage *pending; | 588 | struct P2PPendingMessage *pending; |
571 | 589 | ||
572 | if (NULL == (pending = peer->head)) | 590 | if (NULL == (pending = peer->head)) |
573 | return; | 591 | return; |
574 | if (NULL != peer->th) | 592 | if (NULL != peer->th) |
575 | return; | 593 | return; |
594 | |||
576 | GNUNET_STATISTICS_update (GDS_stats, | 595 | GNUNET_STATISTICS_update (GDS_stats, |
577 | gettext_noop | 596 | gettext_noop |
578 | ("# Bytes of bandwidth requested from core"), | 597 | ("# Bytes of bandwidth requested from core"), |
579 | ntohs (pending->msg->size), GNUNET_NO); | 598 | ntohs (pending->msg->size), GNUNET_NO); |
580 | 599 | ||
581 | /*FIXME : here I don't know the use of importance, time out | 600 | /* FIXME: Are we correctly initializing importance and pending. */ |
582 | Will check at run time if its all correct. */ | ||
583 | peer->th = | 601 | peer->th = |
584 | GNUNET_CORE_notify_transmit_ready (core_api, GNUNET_NO, | 602 | GNUNET_CORE_notify_transmit_ready (core_api, GNUNET_NO, |
585 | pending->importance, | 603 | pending->importance, |
@@ -592,41 +610,117 @@ process_friend_queue (struct FriendInfo *peer) | |||
592 | 610 | ||
593 | 611 | ||
594 | /** | 612 | /** |
595 | * FIXME: Check the parameters. | 613 | * FIXME: Do we need to use some block type in this function? |
596 | * Set up the trial message and forwards this message to friend. | 614 | * Set up the trial message and forwards this message to friend. |
597 | * | 615 | * |
598 | * @param Finger id to which we want to setup the trail. | 616 | * @param Finger id to which we want to setup the trail. |
599 | * @param Friend id through which we will try to setup the trail. | 617 | * @param Friend id through which we will try to setup the trail. |
600 | */ | 618 | */ |
601 | void | 619 | void |
602 | GDS_NEIGHBOURS_trail_setup(struct GNUNET_PeerIdentity *finger_id, | 620 | GDS_NEIGHBOURS_handle_trail_setup(struct GNUNET_PeerIdentity *finger_id, |
603 | struct FriendInfo *target_friend) | 621 | struct FriendInfo *target_friend, |
622 | unsigned int finger_index) | ||
604 | { | 623 | { |
605 | /* | ||
606 | * FIXME: check if pending message actually contains the correct data. | ||
607 | */ | ||
608 | struct P2PPendingMessage *pending; | 624 | struct P2PPendingMessage *pending; |
609 | /* FIXME: why I have defined as **? verify by testing. */ | ||
610 | struct PeerTrailSetupMessage *tsm; | 625 | struct PeerTrailSetupMessage *tsm; |
626 | struct GNUNET_PeerIdentity *peer_id; | ||
627 | size_t msize; | ||
611 | 628 | ||
612 | if (target_friend->pending_count >= MAXIMUM_PENDING_PER_FRIEND) | 629 | /* We will add target_friend to our trail_list. Hence, we add its size to size |
630 | of PeerTrailSetupMessage to get msize. */ | ||
631 | msize = sizeof(struct PeerTrailSetupMessage) + sizeof(struct GNUNET_PeerIdentity); | ||
632 | |||
633 | if (msize >= GNUNET_SERVER_MAX_MESSAGE_SIZE) | ||
613 | { | 634 | { |
635 | GNUNET_break (0); | ||
636 | return; | ||
637 | } | ||
638 | |||
639 | if (target_friend->pending_count >= MAXIMUM_PENDING_PER_FRIEND) | ||
640 | { | ||
614 | GNUNET_STATISTICS_update (GDS_stats, gettext_noop ("# P2P messages dropped due to full queue"), | 641 | GNUNET_STATISTICS_update (GDS_stats, gettext_noop ("# P2P messages dropped due to full queue"), |
615 | 1, GNUNET_NO); | 642 | 1, GNUNET_NO); |
616 | } | 643 | } |
617 | 644 | ||
618 | /* SUPU: Verify if this copy between pending message, tsm is correct? */ | 645 | pending = GNUNET_malloc (sizeof (struct P2PPendingMessage) + msize); |
619 | pending = GNUNET_malloc (sizeof (struct P2PPendingMessage)); | 646 | pending->importance = 0; /* FIXME */ |
620 | /*SUPU: What does this code do? Does this initialize pending with | 647 | pending->timeout = GNUNET_TIME_relative_to_absolute (GET_TIMEOUT); |
621 | values of tsm? */ | 648 | tsm = (struct PeerTrailSetupMessage *) &pending[1]; |
622 | tsm = (struct PeerTrailSetupMessage *) &pending[1]; | ||
623 | pending->msg = &tsm->header; | 649 | pending->msg = &tsm->header; |
650 | tsm->header.size = htons (msize); | ||
624 | tsm->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_P2P_TRAIL_SETUP); | 651 | tsm->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_P2P_TRAIL_SETUP); |
625 | tsm->destination_finger = finger_id; | 652 | memcpy(&(tsm->destination_finger), finger_id, sizeof (struct GNUNET_PeerIdentity)); |
626 | tsm->source_peer = &my_identity; | 653 | memcpy(&(tsm->source_peer), &my_identity, sizeof (struct GNUNET_PeerIdentity)); |
654 | memcpy(&(tsm->current_destination),&(target_friend->id), sizeof (struct GNUNET_PeerIdentity)); | ||
655 | tsm->flag = 0; /*FIXME: Replace 0 by enum for friend/finger.*/ | ||
656 | tsm->finger_index = finger_index; | ||
657 | tsm->trail_length = 1; | ||
658 | |||
659 | peer_id = (struct GNUNET_PeerIdentity *)&tsm[1]; | ||
660 | memcpy(peer_id, target_friend, sizeof (struct GNUNET_PeerIdentity)); | ||
661 | |||
627 | GNUNET_CONTAINER_DLL_insert_tail (target_friend->head, target_friend->tail, pending); | 662 | GNUNET_CONTAINER_DLL_insert_tail (target_friend->head, target_friend->tail, pending); |
663 | |||
628 | target_friend->pending_count++; | 664 | target_friend->pending_count++; |
629 | process_friend_queue(target_friend); | 665 | process_friend_queue (target_friend); |
666 | } | ||
667 | |||
668 | |||
669 | /** | ||
670 | * Handle a trail setup result message. | ||
671 | * @tsm PeerTrailSetupMessage | ||
672 | */ | ||
673 | void | ||
674 | GDS_NEIGHBOURS_handle_trail_setup_result(struct PeerTrailSetupMessage *tsm) | ||
675 | { | ||
676 | /* In this function, you need to setup the trail result message. */ | ||
677 | struct PeerTrailSetupResultMessage *tsrm; | ||
678 | struct P2PPendingMessage *pending; | ||
679 | struct FriendInfo *friend; | ||
680 | struct GNUNET_PeerIdentity *peer; | ||
681 | size_t msize; | ||
682 | |||
683 | /* FIXME: Check if this msize is correct or not. */ | ||
684 | msize = sizeof(struct PeerTrailSetupMessage) + (tsm->trail_length * sizeof(struct GNUNET_PeerIdentity)); | ||
685 | |||
686 | if (msize >= GNUNET_SERVER_MAX_MESSAGE_SIZE) | ||
687 | { | ||
688 | GNUNET_break (0); | ||
689 | return; | ||
690 | } | ||
691 | |||
692 | pending = GNUNET_malloc (sizeof (struct P2PPendingMessage) + msize); | ||
693 | pending->importance = 0; /* FIXME */ | ||
694 | pending->timeout = GNUNET_TIME_relative_to_absolute (GET_TIMEOUT); | ||
695 | tsrm = (struct PeerTrailSetupResultMessage *) &pending[1]; | ||
696 | pending->msg = &tsrm->header; | ||
697 | tsrm->header.size = htons (msize); | ||
698 | tsrm->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_P2P_TRAIL_SETUP_RESULT); | ||
699 | memcpy(&(tsrm->finger), &(tsm->current_destination), sizeof(struct GNUNET_PeerIdentity)); | ||
700 | memcpy(&(tsrm->destination_peer), &(tsm->source_peer), sizeof(struct GNUNET_PeerIdentity)); | ||
701 | tsrm->list_size = tsm->trail_length; | ||
702 | |||
703 | /* TODO: Copy the whole trail list into tsrm. */ | ||
704 | |||
705 | /* Read the elements of trail list backwards to get the target friend to sent | ||
706 | the packet to. Assuming we did not add ourself to the trail list, the last element | ||
707 | will be the element to which we want to send the packet. */ | ||
708 | peer = (struct GNUNET_PeerIdentity *)&tsm[tsm->trail_length]; | ||
709 | |||
710 | /* Get the friend corresponding to this peer. */ | ||
711 | friend = GNUNET_CONTAINER_multipeermap_get (friend_peermap, peer); | ||
712 | |||
713 | if (friend->pending_count >= MAXIMUM_PENDING_PER_FRIEND) | ||
714 | { | ||
715 | GNUNET_STATISTICS_update (GDS_stats, gettext_noop ("# P2P messages dropped due to full queue"), | ||
716 | 1, GNUNET_NO); | ||
717 | } | ||
718 | |||
719 | /* call process_friend_queue. */ | ||
720 | GNUNET_CONTAINER_DLL_insert_tail (friend->head, friend->tail, pending); | ||
721 | |||
722 | friend->pending_count++; | ||
723 | process_friend_queue (friend); | ||
630 | } | 724 | } |
631 | 725 | ||
632 | 726 | ||
@@ -729,19 +823,11 @@ GDS_NEIGHBOURS_handle_reply (const struct GNUNET_PeerIdentity *target, | |||
729 | 823 | ||
730 | 824 | ||
731 | /** | 825 | /** |
732 | * SUPU: Check again. | ||
733 | * I have written a code where | ||
734 | * 1. I choose a random index from 0 to current size of my map. | ||
735 | * 2. Create an iterator. | ||
736 | * 3. set the iterator value to the current index id. | ||
737 | * 4. get the element stored at that index id. | ||
738 | * 5. return the index to calling function. | ||
739 | * I have not yet tested this function and I am not sure if its correct. | ||
740 | * Randomly choose one of your friends from the friends_peer map | 826 | * Randomly choose one of your friends from the friends_peer map |
741 | * @return Friend | 827 | * @return Friend |
742 | */ | 828 | */ |
743 | static struct FriendInfo * | 829 | static struct FriendInfo * |
744 | get_random_friend() | 830 | select_random_friend() |
745 | { | 831 | { |
746 | unsigned int current_size; | 832 | unsigned int current_size; |
747 | unsigned int *index; | 833 | unsigned int *index; |
@@ -750,13 +836,13 @@ get_random_friend() | |||
750 | struct GNUNET_PeerIdentity key_ret; | 836 | struct GNUNET_PeerIdentity key_ret; |
751 | struct FriendInfo *friend; | 837 | struct FriendInfo *friend; |
752 | 838 | ||
753 | current_size = GNUNET_CONTAINER_multipeermap_size(friend_peers); | 839 | current_size = GNUNET_CONTAINER_multipeermap_size(friend_peermap); |
754 | 840 | ||
755 | /* Element stored at this index in friend_peers map should be chosen friend. */ | 841 | /* Element stored at this index in friend_peermap should be selected friend. */ |
756 | index = GNUNET_CRYPTO_random_permute (GNUNET_CRYPTO_QUALITY_WEAK, current_size); | 842 | index = GNUNET_CRYPTO_random_permute (GNUNET_CRYPTO_QUALITY_WEAK, current_size); |
757 | 843 | ||
758 | /* Create an iterator for friend_peers map. */ | 844 | /* Create an iterator for friend_peermap. */ |
759 | iter = GNUNET_CONTAINER_multipeermap_iterator_create(friend_peers); | 845 | iter = GNUNET_CONTAINER_multipeermap_iterator_create(friend_peermap); |
760 | 846 | ||
761 | /* Set the position of iterator to index. */ | 847 | /* Set the position of iterator to index. */ |
762 | while(j < (*index)) | 848 | while(j < (*index)) |
@@ -777,8 +863,8 @@ get_random_friend() | |||
777 | 863 | ||
778 | 864 | ||
779 | /** | 865 | /** |
780 | * Find finger id to which we want to setup the trail | 866 | * Compute finger_identity to which we want to setup the trail |
781 | * @return finger id | 867 | * @return finger_identity |
782 | */ | 868 | */ |
783 | static | 869 | static |
784 | struct GNUNET_PeerIdentity * | 870 | struct GNUNET_PeerIdentity * |
@@ -786,20 +872,27 @@ compute_finger_identity() | |||
786 | { | 872 | { |
787 | struct GNUNET_PeerIdentity *finger_identity; | 873 | struct GNUNET_PeerIdentity *finger_identity; |
788 | 874 | ||
789 | finger_identity = GNUNET_CRYPTO_compute_finger(&my_identity,current_finger_index); | 875 | finger_identity = GNUNET_malloc(sizeof(struct GNUNET_PeerIdentity)); |
876 | finger_identity = GNUNET_CRYPTO_compute_finger_identity(&my_identity,current_finger_index ); | ||
790 | 877 | ||
791 | current_finger_index = (current_finger_index+1) % MAX_FINGERS; | 878 | |
792 | 879 | ||
793 | /* Check if you already have an entry in finger_peers for this finger_id. | 880 | |
881 | |||
882 | current_finger_index = (current_finger_index+1) % MAX_FINGERS; | ||
883 | |||
884 | /* Check if you already have an entry in finger_peermap for this finger_id. | ||
794 | If yes then again look for a new finger_id. | 885 | If yes then again look for a new finger_id. |
795 | FIXME: Should we return NULL here? | 886 | FIXME: Should we return NULL here? |
796 | if(NULL != GNUNET_CONTAINER_multipeermap_get(finger_peers,finger_peer_id)) | 887 | if(NULL != GNUNET_CONTAINER_multipeermap_get(finger_peermap,finger_peer_id)) |
797 | { | 888 | { |
798 | finger_peer_id = compute_finger_identity(); | 889 | finger_peer_id = compute_finger_identity(); |
799 | }*/ | 890 | }*/ |
891 | |||
800 | return finger_identity; | 892 | return finger_identity; |
801 | } | 893 | } |
802 | 894 | ||
895 | |||
803 | /** | 896 | /** |
804 | * TODO: Implement after testing friend/finger map. | 897 | * TODO: Implement after testing friend/finger map. |
805 | * TODO: Handle the case when we already have a trail to our predecessor in | 898 | * TODO: Handle the case when we already have a trail to our predecessor in |
@@ -835,37 +928,53 @@ static void | |||
835 | send_find_finger_trail_message (void *cls, | 928 | send_find_finger_trail_message (void *cls, |
836 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 929 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
837 | { | 930 | { |
838 | struct GNUNET_PeerIdentity *finger_peer_id; | 931 | struct GNUNET_PeerIdentity *finger_identity; |
839 | struct FriendInfo *friend_peer_id; | 932 | struct FriendInfo *friend; |
840 | struct GNUNET_TIME_Relative next_send_time; | 933 | struct GNUNET_TIME_Relative next_send_time; |
841 | 934 | unsigned int finger_index; | |
935 | |||
936 | /* FIXME: How do we use the finger_index in rest of the algorithm | ||
937 | If not use then remove later. */ | ||
938 | finger_index = current_finger_index; | ||
939 | |||
842 | /* We already have found trail to each of our possible fingers in the network. */ | 940 | /* We already have found trail to each of our possible fingers in the network. */ |
843 | if (GNUNET_CONTAINER_multipeermap_size(finger_peers) == MAX_FINGERS) | 941 | if (GNUNET_CONTAINER_multipeermap_size (finger_peermap) == MAX_FINGERS) |
844 | { | 942 | { |
845 | /* We can find trail to our immediate predecessor in the network. */ | 943 | /* FIXME: I call find_immediate_predecessor when I have found trail to |
846 | finger_peer_id = find_immediate_predecessor(); | 944 | * all the possible fingers in the network. But we need to find immediate |
847 | if(NULL == finger_peer_id) | 945 | * predecessor when there is a node failure/join. It may happen before. |
946 | * Think of a better strategy to decide when to call this function. | ||
947 | * We can find trail to our immediate predecessor in the network. | ||
948 | */ | ||
949 | finger_identity = find_immediate_predecessor(); | ||
950 | |||
951 | if(NULL == finger_identity) | ||
848 | { | 952 | { |
849 | /* We already have a trail to reach to immediate predecessor. */ | 953 | /* We already have a trail to reach to immediate predecessor. */ |
850 | goto new_find_trail_request; | 954 | goto new_find_finger_trail_request; |
851 | } | 955 | } |
852 | } | 956 | } |
853 | else | 957 | else |
854 | { | 958 | { |
855 | /* Find the finger_peer_id for which we want to setup the trail */ | 959 | /* Find the finger_peer_id for which we want to setup the trail */ |
856 | finger_peer_id = compute_finger_identity(); | 960 | finger_identity = GNUNET_malloc (sizeof (struct GNUNET_PeerIdentity)); |
961 | finger_identity = compute_finger_identity(); | ||
962 | |||
963 | if(finger_identity == NULL) | ||
964 | { | ||
965 | goto new_find_finger_trail_request; | ||
966 | } | ||
857 | } | 967 | } |
858 | 968 | ||
859 | /* Choose a friend randomly from your friend_peers map. */ | 969 | friend = GNUNET_malloc (sizeof (struct FriendInfo)); |
860 | friend_peer_id = get_random_friend(); | 970 | friend = select_random_friend(); |
861 | 971 | ||
862 | /* We found a friend.*/ | 972 | /* We found a friend.*/ |
863 | if(NULL != friend_peer_id) | 973 | if(NULL != friend) |
864 | GDS_NEIGHBOURS_trail_setup(finger_peer_id, friend_peer_id); | 974 | GDS_NEIGHBOURS_handle_trail_setup(finger_identity, friend, finger_index); |
865 | |||
866 | 975 | ||
867 | new_find_trail_request: | 976 | /* FIXME: Should we be using current_finger_index to generate random interval.*/ |
868 | 977 | new_find_finger_trail_request: | |
869 | next_send_time.rel_value_us = | 978 | next_send_time.rel_value_us = |
870 | DHT_MINIMUM_FIND_FINGER_TRAIL_INTERVAL.rel_value_us + | 979 | DHT_MINIMUM_FIND_FINGER_TRAIL_INTERVAL.rel_value_us + |
871 | GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, | 980 | GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, |
@@ -888,18 +997,18 @@ static void | |||
888 | handle_core_connect (void *cls, const struct GNUNET_PeerIdentity *peer) | 997 | handle_core_connect (void *cls, const struct GNUNET_PeerIdentity *peer) |
889 | { | 998 | { |
890 | struct FriendInfo *ret; | 999 | struct FriendInfo *ret; |
891 | 1000 | ||
892 | /* Check for connect to self message */ | 1001 | /* Check for connect to self message */ |
893 | if (0 == memcmp (&my_identity, peer, sizeof (struct GNUNET_PeerIdentity))) | 1002 | if (0 == memcmp (&my_identity, peer, sizeof (struct GNUNET_PeerIdentity))) |
894 | return; | 1003 | return; |
895 | 1004 | ||
896 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1005 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
897 | "Connected to %s\n", | 1006 | "Connected to %s\n", |
898 | GNUNET_i2s (peer)); | 1007 | GNUNET_i2s (peer)); |
899 | 1008 | ||
900 | /* If peer already exists in our friend_peers, then exit. */ | 1009 | /* If peer already exists in our friend_peermap, then exit. */ |
901 | if (GNUNET_YES == | 1010 | if (GNUNET_YES == |
902 | GNUNET_CONTAINER_multipeermap_contains (friend_peers, | 1011 | GNUNET_CONTAINER_multipeermap_contains (friend_peermap, |
903 | peer)) | 1012 | peer)) |
904 | { | 1013 | { |
905 | GNUNET_break (0); | 1014 | GNUNET_break (0); |
@@ -913,12 +1022,12 @@ handle_core_connect (void *cls, const struct GNUNET_PeerIdentity *peer) | |||
913 | ret->id = *peer; | 1022 | ret->id = *peer; |
914 | 1023 | ||
915 | GNUNET_assert (GNUNET_OK == | 1024 | GNUNET_assert (GNUNET_OK == |
916 | GNUNET_CONTAINER_multipeermap_put (friend_peers, | 1025 | GNUNET_CONTAINER_multipeermap_put (friend_peermap, |
917 | peer, ret, | 1026 | peer, ret, |
918 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 1027 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
919 | 1028 | ||
920 | /* got a first connection, good time to start with FIND FINGER TRAIL requests... */ | 1029 | /* got a first connection, good time to start with FIND FINGER TRAIL requests... */ |
921 | if (1 == GNUNET_CONTAINER_multipeermap_size(friend_peers)) | 1030 | if (1 == GNUNET_CONTAINER_multipeermap_size (friend_peermap)) |
922 | find_finger_trail_task = GNUNET_SCHEDULER_add_now (&send_find_finger_trail_message, NULL); | 1031 | find_finger_trail_task = GNUNET_SCHEDULER_add_now (&send_find_finger_trail_message, NULL); |
923 | } | 1032 | } |
924 | 1033 | ||
@@ -1029,21 +1138,25 @@ handle_dht_p2p_result (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1029 | 1138 | ||
1030 | 1139 | ||
1031 | /** | 1140 | /** |
1032 | * FIXME:1. Check if current_destination field is set correctly. | 1141 | * FIXMEl Where do we use mod MAX_FINGERS? |
1033 | * 2. Is it correct to use GNUNET_CMP_PEER_IDENTITY to find out the successor | 1142 | * @param destination |
1034 | * of a finger. | 1143 | * @param flag Set the value of flag to 0, if next_hop = friend/1 if next_hop = finger. |
1035 | * 3. We should check the interval of the keys for which a peer is responsible | 1144 | * @param current_destination We should set this field to finger id/friend id chosen to be next_hop. |
1036 | * when we are looking to find the correct peer to store a key. But | 1145 | * @return |
1037 | * --> How do we maintain this interval? | ||
1038 | * --> Should we check this interval when we are looking for trail to a finger | ||
1039 | * as in this function? | ||
1040 | * The code flow seems to be very large. Could do better. | ||
1041 | * @param destination peer id's predecessor we are looking for. | ||
1042 | * @return | ||
1043 | */ | 1146 | */ |
1044 | static struct GNUNET_PeerIdentity * | 1147 | static struct GNUNET_PeerIdentity * |
1045 | find_successor(struct GNUNET_PeerIdentity *destination, struct GNUNET_PeerIdentity *current_destination) | 1148 | find_successor(struct GNUNET_PeerIdentity *destination, struct GNUNET_PeerIdentity *current_destination,int *flag) |
1046 | { | 1149 | { |
1150 | /* | ||
1151 | * 1. Compare your identity with destination identity. | ||
1152 | * 2. Iterate over friend_map to find the peer identity with identity >= destination | ||
1153 | * 3. Iterate over finger_map to find the peer identity with identity >= destination | ||
1154 | * 4. Compare id,friend and finger to select one which is the least and still >= destination. | ||
1155 | * 5. If friend/my_identity then flag = 0 | ||
1156 | * 6. If finger, then flag = 1. | ||
1157 | * 7. Set the current_destination value with chosen friend/finger/my_identity | ||
1158 | * 8. If finger, then search in your own finger table send the next hop to reach that finger. | ||
1159 | */ | ||
1047 | unsigned int friend_index; | 1160 | unsigned int friend_index; |
1048 | unsigned int finger_index; | 1161 | unsigned int finger_index; |
1049 | struct GNUNET_CONTAINER_MultiPeerMapIterator *friend_iter; | 1162 | struct GNUNET_CONTAINER_MultiPeerMapIterator *friend_iter; |
@@ -1054,7 +1167,7 @@ find_successor(struct GNUNET_PeerIdentity *destination, struct GNUNET_PeerIdenti | |||
1054 | struct GNUNET_PeerIdentity *current_successor; | 1167 | struct GNUNET_PeerIdentity *current_successor; |
1055 | 1168 | ||
1056 | /* FIXME: Temporary field used to understand if we got a friend or finger | 1169 | /* FIXME: Temporary field used to understand if we got a friend or finger |
1057 | as next successor. find something better.*/ | 1170 | as next successor. find something better. */ |
1058 | int successor; | 1171 | int successor; |
1059 | int finger_peer = 0; | 1172 | int finger_peer = 0; |
1060 | int friend_peer = 1; | 1173 | int friend_peer = 1; |
@@ -1062,14 +1175,14 @@ find_successor(struct GNUNET_PeerIdentity *destination, struct GNUNET_PeerIdenti | |||
1062 | 1175 | ||
1063 | current_successor = GNUNET_malloc (sizeof (struct GNUNET_PeerIdentity)); | 1176 | current_successor = GNUNET_malloc (sizeof (struct GNUNET_PeerIdentity)); |
1064 | 1177 | ||
1065 | /* initialize current_successor with your own identity.*/ | 1178 | /* initialize current_successor with your own identity. */ |
1066 | memcpy(current_successor,&my_identity,sizeof(struct GNUNET_PeerIdentity)); | 1179 | memcpy(current_successor,&my_identity,sizeof(struct GNUNET_PeerIdentity)); |
1067 | successor = me; | 1180 | successor = me; |
1068 | 1181 | ||
1069 | friend_iter = GNUNET_CONTAINER_multipeermap_iterator_create (friend_peers); | 1182 | friend_iter = GNUNET_CONTAINER_multipeermap_iterator_create (friend_peermap); |
1070 | 1183 | ||
1071 | /*iterate over friend map till you reach a peer id such that destination <= peer id */ | 1184 | /*iterate over friend map till you reach a peer id such that destination <= peer id */ |
1072 | for (friend_index = 0; friend_index < GNUNET_CONTAINER_multipeermap_size (friend_peers); friend_index++) | 1185 | for (friend_index = 0; friend_index < GNUNET_CONTAINER_multipeermap_size (friend_peermap); friend_index++) |
1073 | { | 1186 | { |
1074 | if(GNUNET_YES == GNUNET_CONTAINER_multipeermap_iterator_next(friend_iter,&key_ret,(const void **)&friend)) | 1187 | if(GNUNET_YES == GNUNET_CONTAINER_multipeermap_iterator_next(friend_iter,&key_ret,(const void **)&friend)) |
1075 | { | 1188 | { |
@@ -1088,59 +1201,46 @@ find_successor(struct GNUNET_PeerIdentity *destination, struct GNUNET_PeerIdenti | |||
1088 | } | 1201 | } |
1089 | 1202 | ||
1090 | 1203 | ||
1091 | finger_iter = GNUNET_CONTAINER_multipeermap_iterator_create (finger_peers); | 1204 | finger_iter = GNUNET_CONTAINER_multipeermap_iterator_create (finger_peermap); |
1092 | /*iterate over finger map till you reach a peer id such that destination <= peer id */ | 1205 | /* iterate over finger map till you reach a peer id such that destination <= peer id */ |
1093 | for (finger_index = 0; finger_index < GNUNET_CONTAINER_multipeermap_size (finger_peers); finger_index++) | 1206 | for (finger_index = 0; finger_index < GNUNET_CONTAINER_multipeermap_size (finger_peermap); finger_index++) |
1094 | { | 1207 | { |
1095 | if(GNUNET_YES == GNUNET_CONTAINER_multipeermap_iterator_next(finger_iter,&key_ret,(const void **)&finger)) | 1208 | if(GNUNET_YES == GNUNET_CONTAINER_multipeermap_iterator_next(finger_iter,&key_ret,(const void **)&finger)) |
1096 | { | 1209 | { |
1097 | if(0 > GNUNET_CRYPTO_cmp_peer_identity(&finger->id,destination) || | 1210 | if(0 > GNUNET_CRYPTO_cmp_peer_identity(&finger->id,destination) || |
1098 | (0 == GNUNET_CRYPTO_cmp_peer_identity(&finger->id,destination))) | 1211 | (0 == GNUNET_CRYPTO_cmp_peer_identity(&finger->id,destination))) |
1099 | { | 1212 | { |
1100 | /* If yes then check if finger <= current_friend_successor */ | 1213 | /* If yes then check if finger <= current_friend_successor */ |
1101 | if(0 < GNUNET_CRYPTO_cmp_peer_identity(&finger->id,current_successor) | 1214 | if(0 < GNUNET_CRYPTO_cmp_peer_identity(&finger->id,current_successor) |
1102 | || (0 == GNUNET_CRYPTO_cmp_peer_identity(&finger->id,current_successor))) | 1215 | || (0 == GNUNET_CRYPTO_cmp_peer_identity(&finger->id,current_successor))) |
1103 | { | 1216 | { |
1104 | memcpy(current_successor,finger,sizeof(struct GNUNET_PeerIdentity)); | 1217 | memcpy(current_successor,finger,sizeof(struct GNUNET_PeerIdentity)); |
1105 | successor = finger_peer; | 1218 | successor = finger_peer; |
1106 | } | 1219 | } |
1107 | } | 1220 | } |
1108 | } | 1221 | } |
1109 | } | 1222 | } |
1223 | |||
1224 | memcpy(current_destination,current_successor,sizeof(struct GNUNET_PeerIdentity)); | ||
1110 | 1225 | ||
1111 | if(successor == finger_peer) | 1226 | if(successor == finger_peer) |
1112 | { | 1227 | { |
1113 | memcpy(current_destination,current_successor,sizeof(struct GNUNET_PeerIdentity)); | 1228 | *flag = 1; |
1114 | } | 1229 | } |
1115 | else | 1230 | else |
1116 | { | 1231 | { |
1117 | /* The successor is either my_identity or friend. */ | 1232 | /* The successor is either my_identity or friend. */ |
1118 | current_destination = NULL; | 1233 | *flag = 0; |
1119 | } | 1234 | } |
1120 | 1235 | ||
1121 | return current_successor; | 1236 | return current_successor; |
1122 | } | 1237 | } |
1123 | 1238 | ||
1124 | 1239 | ||
1125 | /* Traverse the trail list to find the prev hop to store in routing table. */ | ||
1126 | static | ||
1127 | struct GNUNET_PeerIdentity * | ||
1128 | find_trail_list_prev_hop(struct PeerTrailSetupMessage *trail_result) | ||
1129 | { | ||
1130 | /*FIXME: I don't see any function in existing dll implementation, to | ||
1131 | just read the dll backward or forward. So, I would implement one here. | ||
1132 | * As no one else uses this functionality so I guess its okay to just | ||
1133 | * implement it here. */ | ||
1134 | return NULL; | ||
1135 | } | ||
1136 | |||
1137 | |||
1138 | /** | 1240 | /** |
1139 | * FIXME: | 1241 | * FIXME: |
1140 | * 1. Check if we are maintaining the 64k size of struct PeerTrailSetupMessage. | 1242 | * 1. Check if we are correctly adding peer to our message and sending |
1141 | * when we add ourself to the trail list. | 1243 | * the message correctly to next friend. |
1142 | * 2. Ensure every case is handled for current_destination. | ||
1143 | * Core handler for P2P trail setup message. | ||
1144 | * @param cls closure | 1244 | * @param cls closure |
1145 | * @param message message | 1245 | * @param message message |
1146 | * @param peer peer identity this notification is about | 1246 | * @param peer peer identity this notification is about |
@@ -1151,14 +1251,14 @@ handle_dht_p2p_trail_setup(void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1151 | const struct GNUNET_MessageHeader *message) | 1251 | const struct GNUNET_MessageHeader *message) |
1152 | { | 1252 | { |
1153 | struct PeerTrailSetupMessage *trail_setup; | 1253 | struct PeerTrailSetupMessage *trail_setup; |
1154 | struct GNUNET_PeerIdentity *next_hop; | 1254 | struct GNUNET_PeerIdentity *next_hop; |
1155 | struct GNUNET_PeerIdentity *prev_hop; | 1255 | struct GNUNET_PeerIdentity *peer_identity_trail; |
1156 | struct FriendInfo *friend; | 1256 | struct FriendInfo *target_friend; |
1157 | struct TrailPeerList *peer_entry; | ||
1158 | struct P2PPendingMessage *pending; | 1257 | struct P2PPendingMessage *pending; |
1159 | 1258 | size_t msize; | |
1160 | uint16_t msize; | 1259 | uint32_t trail_length; |
1161 | 1260 | ||
1261 | /* parse and validate message. */ | ||
1162 | msize = ntohs (message->size); | 1262 | msize = ntohs (message->size); |
1163 | if (msize < sizeof (struct PeerTrailSetupMessage)) | 1263 | if (msize < sizeof (struct PeerTrailSetupMessage)) |
1164 | { | 1264 | { |
@@ -1167,7 +1267,18 @@ handle_dht_p2p_trail_setup(void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1167 | } | 1267 | } |
1168 | 1268 | ||
1169 | trail_setup = (struct PeerTrailSetupMessage *) message; | 1269 | trail_setup = (struct PeerTrailSetupMessage *) message; |
1170 | 1270 | trail_length = trail_setup->trail_length; // FIXME: should we use ntohl? | |
1271 | |||
1272 | if ((msize < | ||
1273 | sizeof (struct PeerTrailSetupMessage) + | ||
1274 | trail_length * sizeof (struct GNUNET_PeerIdentity)) || | ||
1275 | (trail_length > | ||
1276 | GNUNET_SERVER_MAX_MESSAGE_SIZE / sizeof (struct GNUNET_PeerIdentity))) | ||
1277 | { | ||
1278 | GNUNET_break_op (0); | ||
1279 | return GNUNET_YES; | ||
1280 | } | ||
1281 | |||
1171 | GNUNET_STATISTICS_update (GDS_stats, | 1282 | GNUNET_STATISTICS_update (GDS_stats, |
1172 | gettext_noop ("# TRAIL SETUP requests received"), 1, | 1283 | gettext_noop ("# TRAIL SETUP requests received"), 1, |
1173 | GNUNET_NO); | 1284 | GNUNET_NO); |
@@ -1175,75 +1286,87 @@ handle_dht_p2p_trail_setup(void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1175 | gettext_noop ("# TRAIL SETUP bytes received"), msize, | 1286 | gettext_noop ("# TRAIL SETUP bytes received"), msize, |
1176 | GNUNET_NO); | 1287 | GNUNET_NO); |
1177 | 1288 | ||
1178 | 1289 | /* FIXME: | |
1179 | /* Check the value of current_destination and handle the respective case. */ | 1290 | * 1. Temporary logic using flag. Think something optmial. |
1180 | if(trail_setup->current_destination == NULL) | 1291 | * 2. Set the value of flag correctly everywhere. */ |
1292 | /* flag == 0, so this packet is for a friend. */ | ||
1293 | if(trail_setup->flag == 0) | ||
1181 | { | 1294 | { |
1182 | /* Find the next peer to pass the trail setup message. */ | 1295 | /* This should always be the case. This packet is sent to me and I have received it. */ |
1183 | next_hop = find_successor(trail_setup->destination_finger,trail_setup->current_destination); | 1296 | if(0 == (GNUNET_CRYPTO_cmp_peer_identity(&(trail_setup->current_destination),&my_identity))) |
1184 | } | 1297 | { |
1185 | else if( 0 == (GNUNET_CRYPTO_cmp_peer_identity(trail_setup->current_destination,&my_identity))) | 1298 | next_hop = find_successor(&(trail_setup->destination_finger),&(trail_setup->current_destination),&(trail_setup->flag)); |
1186 | { | 1299 | } |
1187 | /* I am current destination, find the next peer to pass the trail setup message. */ | 1300 | else |
1188 | next_hop = find_successor(trail_setup->destination_finger,trail_setup->current_destination); | 1301 | return GNUNET_SYSERR; |
1189 | } | 1302 | } |
1190 | else | 1303 | else |
1191 | { | 1304 | { |
1192 | /* I am part of the trail to reach to current_destination. */ | 1305 | /* The value of flag == 1, so this packet is send to an intermediate finger. |
1193 | next_hop = GDS_Routing_search(trail_setup->source_peer, trail_setup->current_destination, trail_setup->tail->peer); | 1306 | So, either I am the finger or I am the part of trail. */ |
1307 | if(0 != (GNUNET_CRYPTO_cmp_peer_identity(&(trail_setup->current_destination),&my_identity))) | ||
1308 | { | ||
1309 | /* I am part of trail. | ||
1310 | * FIXME: Do we need to add a field prev_hop in this function call? For same | ||
1311 | * source and destination can we get different paths from different prev_hop. */ | ||
1312 | next_hop = GDS_ROUTING_search(&(trail_setup->source_peer),&(trail_setup->destination_finger)); | ||
1313 | |||
1314 | /*FIXME: Add logic to call find_successor and compare the two peer ids | ||
1315 | and choose whichever is closest to the destination finger. */ | ||
1316 | } | ||
1317 | else | ||
1318 | { | ||
1319 | /* I am the current_destination finger */ | ||
1320 | next_hop = find_successor(&(trail_setup->destination_finger),&(trail_setup->current_destination),&(trail_setup->flag)); | ||
1321 | } | ||
1194 | } | 1322 | } |
1195 | |||
1196 | 1323 | ||
1324 | |||
1325 | /* At this point, we have found our next hop. */ | ||
1326 | /* Check if your are next hop, if yes then you have reached the final destination. */ | ||
1197 | if(0 == (GNUNET_CRYPTO_cmp_peer_identity(next_hop,&my_identity))) | 1327 | if(0 == (GNUNET_CRYPTO_cmp_peer_identity(next_hop,&my_identity))) |
1198 | { | 1328 | { |
1199 | /* I am the closest successor of the destination finger in the network. */ | 1329 | GDS_NEIGHBOURS_handle_trail_setup_result(trail_setup); |
1200 | /*TODO:: | ||
1201 | 1. Prepare a trail setup result message. | ||
1202 | 2. Add yourself to trail list. | ||
1203 | 3. send packet to last element in the list. | ||
1204 | */ | ||
1205 | return GNUNET_YES; | 1330 | return GNUNET_YES; |
1206 | } | 1331 | } |
1207 | 1332 | ||
1208 | /* FIXME: | 1333 | /* FIXME: Do we need to add an entry if we are just passing the packet to |
1209 | * Do we really need to pass the whole trail_setup? I guess | 1334 | * one of the friend.*/ |
1210 | * we can just pass the double linked list. | 1335 | if(trail_setup->flag == 1) |
1211 | */ | ||
1212 | prev_hop = find_trail_list_prev_hop(trail_setup); | ||
1213 | |||
1214 | GDS_ROUTING_add(trail_setup->source_peer,trail_setup->current_destination,prev_hop,next_hop); | ||
1215 | |||
1216 | peer_entry = GNUNET_malloc (sizeof (struct TrailPeerList)); | ||
1217 | peer_entry->peer = &my_identity; | ||
1218 | peer_entry->next = NULL; | ||
1219 | peer_entry->prev = NULL; | ||
1220 | |||
1221 | /*SUPU what is this stupid code that I have written. */ | ||
1222 | GNUNET_CONTAINER_DLL_insert_tail(trail_setup->head->next,trail_setup->tail->prev,peer_entry); | ||
1223 | |||
1224 | /* Find the struct FriendInfo for next_hop peer id. */ | ||
1225 | friend = GNUNET_CONTAINER_multipeermap_get(friend_peers,next_hop); | ||
1226 | |||
1227 | if (friend->pending_count >= MAXIMUM_PENDING_PER_FRIEND) | ||
1228 | { | 1336 | { |
1229 | GNUNET_STATISTICS_update (GDS_stats, gettext_noop ("# P2P messages dropped due to full queue"), | 1337 | /* This packet is sent to an intermediate finger. Add an entry in routing table. */ |
1230 | 1, GNUNET_NO); | 1338 | GDS_ROUTING_add(&(trail_setup->source_peer),&(trail_setup->current_destination),next_hop); |
1231 | } | 1339 | } |
1232 | 1340 | ||
1233 | /* Send trail setup message to next hop friend. */ | 1341 | /* Add yourself to peer list. */ |
1234 | pending = GNUNET_malloc (sizeof (struct P2PPendingMessage)); | 1342 | peer_identity_trail = (struct GNUNET_PeerIdentity *)&trail_setup[1]; |
1343 | memcpy(peer_identity_trail, next_hop, sizeof(struct GNUNET_PeerIdentity)); | ||
1235 | 1344 | ||
1236 | /* FIXME: Check if we are properly initializing pending. */ | 1345 | /* FIXME: Are we correctly incrementing trail_length and msize. |
1346 | * Construct the new message to send it to next_hop. */ | ||
1347 | trail_setup->trail_length++; | ||
1348 | target_friend = GNUNET_CONTAINER_multipeermap_get (friend_peermap, next_hop); | ||
1349 | |||
1350 | pending = GNUNET_malloc (sizeof (struct P2PPendingMessage) + msize); | ||
1351 | pending->importance = 0; /* FIXME */ | ||
1352 | pending->timeout = GNUNET_TIME_relative_to_absolute (GET_TIMEOUT); | ||
1237 | trail_setup = (struct PeerTrailSetupMessage *) &pending[1]; | 1353 | trail_setup = (struct PeerTrailSetupMessage *) &pending[1]; |
1238 | pending->msg = &trail_setup->header; | 1354 | |
1239 | GNUNET_CONTAINER_DLL_insert_tail (friend->head, friend->tail, pending); | 1355 | GNUNET_CONTAINER_DLL_insert_tail (target_friend->head, target_friend->tail, pending); |
1240 | friend->pending_count++; | 1356 | |
1241 | process_friend_queue(friend); | 1357 | target_friend->pending_count++; |
1358 | process_friend_queue(target_friend); | ||
1242 | return GNUNET_YES; | 1359 | return GNUNET_YES; |
1243 | } | 1360 | } |
1244 | 1361 | ||
1245 | 1362 | ||
1246 | /* Add an entry to finger table. */ | 1363 | /* Add an entry to finger table. |
1364 | FIXME: | ||
1365 | 1.I have not added logic to find out the interval of keys for which | ||
1366 | a finger is responsible. Possible logic | ||
1367 | --> finger[i].interval = [finger[i].start,finger[i+1].start) | ||
1368 | * This logic needs to be implemented as we will need it for PUT/GET. | ||
1369 | * 2. Also, check the logic again when initializing fields of finger. */ | ||
1247 | static | 1370 | static |
1248 | void finger_table_add(struct PeerTrailSetupResultMessage *result) | 1371 | void finger_table_add(struct PeerTrailSetupResultMessage *result) |
1249 | { | 1372 | { |
@@ -1254,16 +1377,6 @@ void finger_table_add(struct PeerTrailSetupResultMessage *result) | |||
1254 | } | 1377 | } |
1255 | 1378 | ||
1256 | 1379 | ||
1257 | /* Traverse the trail list to find the next hop to pass the result message. */ | ||
1258 | static | ||
1259 | struct GNUNET_PeerIdentity * | ||
1260 | find_trail_list_next_hop(struct PeerTrailSetupResultMessage *trail_result) | ||
1261 | { | ||
1262 | /* Setup the current_destination value to new next hop found. */ | ||
1263 | return NULL; | ||
1264 | } | ||
1265 | |||
1266 | |||
1267 | /** | 1380 | /** |
1268 | * Core handle for p2p trail construction result messages. | 1381 | * Core handle for p2p trail construction result messages. |
1269 | * @param cls closure | 1382 | * @param cls closure |
@@ -1276,61 +1389,34 @@ static int | |||
1276 | handle_dht_p2p_trail_setup_result(void *cls, const struct GNUNET_PeerIdentity *peer, | 1389 | handle_dht_p2p_trail_setup_result(void *cls, const struct GNUNET_PeerIdentity *peer, |
1277 | const struct GNUNET_MessageHeader *message) | 1390 | const struct GNUNET_MessageHeader *message) |
1278 | { | 1391 | { |
1279 | /* FIXME: Should it be const? */ | ||
1280 | struct PeerTrailSetupResultMessage *trail_result; | 1392 | struct PeerTrailSetupResultMessage *trail_result; |
1281 | struct GNUNET_PeerIdentity *next_hop; | 1393 | size_t msize; |
1282 | struct FriendInfo *friend; | 1394 | |
1283 | struct P2PPendingMessage *pending; | 1395 | trail_result = (struct PeerTrailSetupResultMessage *)message; |
1284 | trail_result = (struct PeerTrailSetupResultMessage *) message; | 1396 | |
1285 | |||
1286 | uint16_t msize; | ||
1287 | |||
1288 | msize = ntohs (message->size); | 1397 | msize = ntohs (message->size); |
1289 | if (msize < sizeof (struct PeerTrailSetupResultMessage)) | 1398 | if(msize < sizeof (struct PeerTrailSetupResultMessage)) |
1290 | { | 1399 | { |
1291 | GNUNET_break_op (0); | 1400 | GNUNET_break_op(0); |
1292 | return GNUNET_YES; | 1401 | return GNUNET_YES; |
1293 | } | 1402 | } |
1294 | 1403 | ||
1295 | /* This should always be the case. */ | 1404 | /* This should always be the case. */ |
1296 | if( 0 == (GNUNET_CRYPTO_cmp_peer_identity(trail_result->current_destination,&my_identity))) | 1405 | if(0 == (GNUNET_CRYPTO_cmp_peer_identity (&(trail_result->current_destination), &my_identity))) |
1297 | { | 1406 | { |
1298 | /* Am I the destination ? */ | 1407 | /* Am I the destination? */ |
1299 | if( 0 == (GNUNET_CRYPTO_cmp_peer_identity(trail_result->destination_peer,&my_identity))) | 1408 | if( 0 == (GNUNET_CRYPTO_cmp_peer_identity(&(trail_result->destination_peer), &my_identity))) |
1300 | { | 1409 | { |
1301 | /* I am the destination. Add the trail to my finger table. */ | ||
1302 | finger_table_add(trail_result); | 1410 | finger_table_add(trail_result); |
1303 | return GNUNET_YES; | 1411 | return GNUNET_YES; |
1304 | } | 1412 | } |
1305 | else | 1413 | else |
1306 | { | 1414 | { |
1307 | /* Find the next peer in the trail list to pass the message to. */ | 1415 | /* read the trail list, get the next hop to send the packet to.*/ |
1308 | next_hop = find_trail_list_next_hop(trail_result); | 1416 | /* TODO: Use the current index to access the correct element. */ |
1309 | |||
1310 | /* Find the struct FriendInfo for next_hop peer id. */ | ||
1311 | friend = GNUNET_CONTAINER_multipeermap_get(friend_peers,next_hop); | ||
1312 | |||
1313 | if (friend->pending_count >= MAXIMUM_PENDING_PER_FRIEND) | ||
1314 | { | ||
1315 | GNUNET_STATISTICS_update (GDS_stats, gettext_noop ("# P2P messages dropped due to full queue"), | ||
1316 | 1, GNUNET_NO); | ||
1317 | } | ||
1318 | /* Send trail setup result message to next hop friend. */ | ||
1319 | /*FIXME: | ||
1320 | I have not yet written the code to copy struct trail message to | ||
1321 | pending message. Also, before sending the message I need to check | ||
1322 | the MAXIMUM_PENDNIG_PEER limit is not crossed. Modify the same part | ||
1323 | of code for handle_dht_p2p_trail_setup. */ | ||
1324 | pending = GNUNET_malloc (sizeof (struct P2PPendingMessage)); | ||
1325 | trail_result = (struct PeerTrailSetupResultMessage *) &pending[1]; | ||
1326 | pending->msg = &trail_result->header; | ||
1327 | GNUNET_CONTAINER_DLL_insert_tail (friend->head, friend->tail, pending); | ||
1328 | friend->pending_count++; | ||
1329 | process_friend_queue(friend); | ||
1330 | |||
1331 | return GNUNET_YES; | 1417 | return GNUNET_YES; |
1332 | } | 1418 | } |
1333 | } | 1419 | } |
1334 | else | 1420 | else |
1335 | return GNUNET_SYSERR; | 1421 | return GNUNET_SYSERR; |
1336 | } | 1422 | } |
@@ -1361,9 +1447,9 @@ GDS_NEIGHBOURS_init() | |||
1361 | if (core_api == NULL) | 1447 | if (core_api == NULL) |
1362 | return GNUNET_SYSERR; | 1448 | return GNUNET_SYSERR; |
1363 | 1449 | ||
1364 | friend_peers = GNUNET_CONTAINER_multipeermap_create (256, GNUNET_NO); | 1450 | friend_peermap = GNUNET_CONTAINER_multipeermap_create (256, GNUNET_NO); |
1365 | finger_peers = GNUNET_CONTAINER_multipeermap_create (256, GNUNET_NO); | 1451 | finger_peermap = GNUNET_CONTAINER_multipeermap_create (256, GNUNET_NO); |
1366 | 1452 | ||
1367 | return GNUNET_OK; | 1453 | return GNUNET_OK; |
1368 | } | 1454 | } |
1369 | 1455 | ||
@@ -1381,13 +1467,15 @@ GDS_NEIGHBOURS_done () | |||
1381 | GNUNET_ATS_performance_done (atsAPI); | 1467 | GNUNET_ATS_performance_done (atsAPI); |
1382 | atsAPI = NULL; | 1468 | atsAPI = NULL; |
1383 | 1469 | ||
1384 | GNUNET_assert (0 == GNUNET_CONTAINER_multipeermap_size (friend_peers)); | 1470 | /* FIXME: Once handle_core_disconnect is implemented, this assertion should not |
1385 | GNUNET_CONTAINER_multipeermap_destroy (friend_peers); | 1471 | fail. */ |
1386 | friend_peers = NULL; | 1472 | GNUNET_assert (0 == GNUNET_CONTAINER_multipeermap_size (friend_peermap)); |
1473 | GNUNET_CONTAINER_multipeermap_destroy (friend_peermap); | ||
1474 | friend_peermap = NULL; | ||
1387 | 1475 | ||
1388 | GNUNET_assert (0 == GNUNET_CONTAINER_multipeermap_size (finger_peers)); | 1476 | GNUNET_assert (0 == GNUNET_CONTAINER_multipeermap_size (finger_peermap)); |
1389 | GNUNET_CONTAINER_multipeermap_destroy (finger_peers); | 1477 | GNUNET_CONTAINER_multipeermap_destroy (finger_peermap); |
1390 | finger_peers = NULL; | 1478 | finger_peermap = NULL; |
1391 | 1479 | ||
1392 | if (GNUNET_SCHEDULER_NO_TASK != find_finger_trail_task) | 1480 | if (GNUNET_SCHEDULER_NO_TASK != find_finger_trail_task) |
1393 | { | 1481 | { |
diff --git a/src/dht/gnunet-service-xdht_neighbours.h b/src/dht/gnunet-service-xdht_neighbours.h index 50d39ac99..4ee1f4f37 100644 --- a/src/dht/gnunet-service-xdht_neighbours.h +++ b/src/dht/gnunet-service-xdht_neighbours.h | |||
@@ -119,6 +119,7 @@ GDS_NEIGHBOURS_handle_reply (const struct GNUNET_PeerIdentity *target, | |||
119 | const void *data, size_t data_size); | 119 | const void *data, size_t data_size); |
120 | 120 | ||
121 | 121 | ||
122 | |||
122 | /** | 123 | /** |
123 | * Initialize neighbours subsystem. | 124 | * Initialize neighbours subsystem. |
124 | * | 125 | * |
diff --git a/src/dht/gnunet-service-xdht_routing.c b/src/dht/gnunet-service-xdht_routing.c index d81b79f43..13f0d3e77 100644 --- a/src/dht/gnunet-service-xdht_routing.c +++ b/src/dht/gnunet-service-xdht_routing.c | |||
@@ -80,23 +80,21 @@ static struct GNUNET_CONTAINER_MultiPeerMap *routing_table; | |||
80 | /** | 80 | /** |
81 | * FIXME: Change the name of variable. | 81 | * FIXME: Change the name of variable. |
82 | * Ensure that everywhere in this file you are using destination as the key. | 82 | * Ensure that everywhere in this file you are using destination as the key. |
83 | * Do we need prev field in routing table? | ||
83 | * Add a new entry to our routing table. | 84 | * Add a new entry to our routing table. |
84 | * @param source peer | 85 | * @param source peer |
85 | * @param destintation | 86 | * @param destintation |
86 | * @param prev_hop | ||
87 | * @param next_hop | 87 | * @param next_hop |
88 | */ | 88 | */ |
89 | void | 89 | void |
90 | GDS_ROUTING_add (struct GNUNET_PeerIdentity *source, | 90 | GDS_ROUTING_add (struct GNUNET_PeerIdentity *source, |
91 | struct GNUNET_PeerIdentity *dest, | 91 | struct GNUNET_PeerIdentity *dest, |
92 | struct GNUNET_PeerIdentity *prev_hop, | ||
93 | struct GNUNET_PeerIdentity *next_hop) | 92 | struct GNUNET_PeerIdentity *next_hop) |
94 | { | 93 | { |
95 | struct RoutingTrail *new_routing_entry; | 94 | struct RoutingTrail *new_routing_entry; |
96 | 95 | ||
97 | new_routing_entry = GNUNET_malloc (sizeof (struct RoutingTrail)); | 96 | new_routing_entry = GNUNET_malloc (sizeof (struct RoutingTrail)); |
98 | new_routing_entry->source = source; | 97 | new_routing_entry->source = source; |
99 | new_routing_entry->previous_hop = prev_hop; | ||
100 | new_routing_entry->next_hop = next_hop; | 98 | new_routing_entry->next_hop = next_hop; |
101 | new_routing_entry->destination = dest; | 99 | new_routing_entry->destination = dest; |
102 | 100 | ||
@@ -121,9 +119,8 @@ GDS_ROUTING_add (struct GNUNET_PeerIdentity *source, | |||
121 | * @return next hop peer id | 119 | * @return next hop peer id |
122 | */ | 120 | */ |
123 | struct GNUNET_PeerIdentity * | 121 | struct GNUNET_PeerIdentity * |
124 | GDS_Routing_search(struct GNUNET_PeerIdentity *source_peer, | 122 | GDS_ROUTING_search(struct GNUNET_PeerIdentity *source_peer, |
125 | struct GNUNET_PeerIdentity *destination_peer, | 123 | struct GNUNET_PeerIdentity *destination_peer) |
126 | struct GNUNET_PeerIdentity *prev_hop) | ||
127 | { | 124 | { |
128 | struct RoutingTrail *trail; | 125 | struct RoutingTrail *trail; |
129 | trail = (struct RoutingTrail *)(GNUNET_CONTAINER_multipeermap_get(routing_table,destination_peer)); | 126 | trail = (struct RoutingTrail *)(GNUNET_CONTAINER_multipeermap_get(routing_table,destination_peer)); |
diff --git a/src/dht/gnunet-service-xdht_routing.h b/src/dht/gnunet-service-xdht_routing.h index dcb82ef16..44cb07389 100644 --- a/src/dht/gnunet-service-xdht_routing.h +++ b/src/dht/gnunet-service-xdht_routing.h | |||
@@ -37,7 +37,6 @@ | |||
37 | void | 37 | void |
38 | GDS_ROUTING_add (struct GNUNET_PeerIdentity *source, | 38 | GDS_ROUTING_add (struct GNUNET_PeerIdentity *source, |
39 | struct GNUNET_PeerIdentity *destination_peer, | 39 | struct GNUNET_PeerIdentity *destination_peer, |
40 | struct GNUNET_PeerIdentity *prev_hop, | ||
41 | struct GNUNET_PeerIdentity *next_hop); | 40 | struct GNUNET_PeerIdentity *next_hop); |
42 | 41 | ||
43 | 42 | ||
@@ -46,9 +45,8 @@ GDS_ROUTING_add (struct GNUNET_PeerIdentity *source, | |||
46 | * @return next hop peer id | 45 | * @return next hop peer id |
47 | */ | 46 | */ |
48 | struct GNUNET_PeerIdentity * | 47 | struct GNUNET_PeerIdentity * |
49 | GDS_Routing_search(struct GNUNET_PeerIdentity *source_peer, | 48 | GDS_ROUTING_search(struct GNUNET_PeerIdentity *source_peer, |
50 | struct GNUNET_PeerIdentity *destination_peer, | 49 | struct GNUNET_PeerIdentity *destination_peer); |
51 | struct GNUNET_PeerIdentity *prev_hop); | ||
52 | 50 | ||
53 | /** | 51 | /** |
54 | * Handle a reply (route to origin). Only forwards the reply back to | 52 | * Handle a reply (route to origin). Only forwards the reply back to |