+ struct PeerVerifySuccessorMessage *vsm;
+ size_t msize;
+ unsigned int trail_length;
+
+ /* Uncomment after initialization
+ struct GNUNET_PeerIdentity *trail_peer_list;
+ unsigned int current_trail_index;
+ struct GNUNET_PeerIdentity *next_peer;
+ struct FriendInfo *target_friend;
+ */
+ msize = ntohs (message->size);
+ if (msize < sizeof (struct PeerVerifySuccessorMessage))
+ {
+ GNUNET_break_op (0);
+ return GNUNET_YES;
+ }
+
+ vsm = (struct PeerVerifySuccessorMessage *) message;
+ trail_length = ntohl (vsm->trail_length);
+ //current_trail_index = ntohl (vsm->current_index);
+
+ //trail_peer_list = (struct GNUNET_PeerIdentity *) &vsm[1];
+ if ((msize <
+ sizeof (struct PeerVerifySuccessorMessage) +
+ trail_length * sizeof (struct GNUNET_PeerIdentity)) ||
+ (trail_length >
+ GNUNET_SERVER_MAX_MESSAGE_SIZE / sizeof (struct GNUNET_PeerIdentity)))
+ {
+ GNUNET_break_op (0);
+ return GNUNET_YES;
+ }
+
+ if(0 == (GNUNET_CRYPTO_cmp_peer_identity (&(vsm->successor),
+ &my_identity)))
+ {
+ /* You are the successor for which this message has been sent. */
+ /* Search over your finger peer map to find the predecessor and then call
+ GDS_NEIGHBOURS_handle_verify_successor_result with correct parameters. */
+ struct GNUNET_CONTAINER_MultiPeerMapIterator *finger_iter;
+ struct GNUNET_PeerIdentity key_ret;
+ unsigned int finger_index;
+ struct FingerInfo *finger;
+ struct GNUNET_PeerIdentity *destination_peer;
+
+ finger_iter = GNUNET_CONTAINER_multipeermap_iterator_create (finger_peermap);
+ for (finger_index = 0; finger_index < GNUNET_CONTAINER_multipeermap_size (finger_peermap); finger_index++)
+ {
+ /* FIXME: I don't think we are actually iterating.
+ Read about how to iterate over the multi peer map. */
+ if(GNUNET_YES == GNUNET_CONTAINER_multipeermap_iterator_next(finger_iter,&key_ret,(const void **)&finger))
+ {
+ if(1 == finger->predecessor)
+ break; /* FIXME: Do I come out of inner if or outer for */
+ }
+ }
+
+ destination_peer = GNUNET_malloc (sizeof (struct GNUNET_PeerIdentity));
+ memcpy (destination_peer, &(vsm->source_peer), sizeof (struct GNUNET_PeerIdentity));
+
+ /*SUPU: Initialize all the fields. */
+ /* FIXME: Initialize all the parameters of this function.
+ Also, target_friend in this case is the peer id which is last in the trail.
+ check if destination peer is in peer list or not. To check you will have to
+ check the trail_setup and how we are adding the peer in there. */
+ /* FIXME: Uncomment after initializing the fields
+ * GDS_NEIGHBOURS_handle_verify_successor_result (destination_peer,
+ &(my_identity),
+ &(finger->finger_identity),
+ target_friend,
+ trail_peer_list,
+ trail_length,
+ current_trail_index); */
+ }
+ else
+ {
+ /* FIXME: Initialize all the parameters to
+ * this function. Read the element at current_trail_index + 1
+ and call GDS_NEIGHBOURS_handle_verify_successor with correct parameters. */
+ /* FIXME: Uncomment after initializing the fields.
+ * GDS_NEIGUBOURS_handle_verify_successor(&(vsm->source_peer),
+ &(vsm->successor),
+ target_friend,
+ trail_peer_list,
+ trail_length,
+ current_trail_index); */
+ }