aboutsummaryrefslogtreecommitdiff
path: root/src/peerinfo/peerinfo_api.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-04-04 12:02:43 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-04-04 12:02:43 +0000
commit425e9cdea733ca7be9a901abff7a070c460fa84d (patch)
treec4e2919e2f4183a324801c061fb2d57a3b232ddc /src/peerinfo/peerinfo_api.c
parent6713f0ce7d70cdb5cb0172157e647b8dfb6852ff (diff)
downloadgnunet-425e9cdea733ca7be9a901abff7a070c460fa84d.tar.gz
gnunet-425e9cdea733ca7be9a901abff7a070c460fa84d.zip
peerinfo API change + changes in code using api
Diffstat (limited to 'src/peerinfo/peerinfo_api.c')
-rw-r--r--src/peerinfo/peerinfo_api.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/peerinfo/peerinfo_api.c b/src/peerinfo/peerinfo_api.c
index 175397c78..faa56e908 100644
--- a/src/peerinfo/peerinfo_api.c
+++ b/src/peerinfo/peerinfo_api.c
@@ -692,6 +692,7 @@ signal_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
692 * better to use 'GNUNET_PEERINFO_notify'. 692 * better to use 'GNUNET_PEERINFO_notify'.
693 * 693 *
694 * @param h handle to the peerinfo service 694 * @param h handle to the peerinfo service
695 * @param include_friend_only include HELLO messages for friends only
695 * @param peer restrict iteration to this peer only (can be NULL) 696 * @param peer restrict iteration to this peer only (can be NULL)
696 * @param timeout how long to wait until timing out 697 * @param timeout how long to wait until timing out
697 * @param callback the method to call for each peer 698 * @param callback the method to call for each peer
@@ -700,11 +701,12 @@ signal_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
700 */ 701 */
701struct GNUNET_PEERINFO_IteratorContext * 702struct GNUNET_PEERINFO_IteratorContext *
702GNUNET_PEERINFO_iterate (struct GNUNET_PEERINFO_Handle *h, 703GNUNET_PEERINFO_iterate (struct GNUNET_PEERINFO_Handle *h,
704 int include_friend_only,
703 const struct GNUNET_PeerIdentity *peer, 705 const struct GNUNET_PeerIdentity *peer,
704 struct GNUNET_TIME_Relative timeout, 706 struct GNUNET_TIME_Relative timeout,
705 GNUNET_PEERINFO_Processor callback, void *callback_cls) 707 GNUNET_PEERINFO_Processor callback, void *callback_cls)
706{ 708{
707 struct GNUNET_MessageHeader *lapm; 709 struct ListAllPeersMessage *lapm;
708 struct ListPeerMessage *lpm; 710 struct ListPeerMessage *lpm;
709 struct GNUNET_PEERINFO_IteratorContext *ic; 711 struct GNUNET_PEERINFO_IteratorContext *ic;
710 struct GNUNET_PEERINFO_AddContext *ac; 712 struct GNUNET_PEERINFO_AddContext *ac;
@@ -716,11 +718,12 @@ GNUNET_PEERINFO_iterate (struct GNUNET_PEERINFO_Handle *h,
716 "Requesting list of peers from PEERINFO service\n"); 718 "Requesting list of peers from PEERINFO service\n");
717 ac = 719 ac =
718 GNUNET_malloc (sizeof (struct GNUNET_PEERINFO_AddContext) + 720 GNUNET_malloc (sizeof (struct GNUNET_PEERINFO_AddContext) +
719 sizeof (struct GNUNET_MessageHeader)); 721 sizeof (struct ListAllPeersMessage));
720 ac->size = sizeof (struct GNUNET_MessageHeader); 722 ac->size = sizeof (struct ListAllPeersMessage);
721 lapm = (struct GNUNET_MessageHeader *) &ac[1]; 723 lapm = (struct ListAllPeersMessage *) &ac[1];
722 lapm->size = htons (sizeof (struct GNUNET_MessageHeader)); 724 lapm->header.size = htons (sizeof (struct ListAllPeersMessage));
723 lapm->type = htons (GNUNET_MESSAGE_TYPE_PEERINFO_GET_ALL); 725 lapm->header.type = htons (GNUNET_MESSAGE_TYPE_PEERINFO_GET_ALL);
726 lapm->include_friend_only = htonl (include_friend_only);
724 } 727 }
725 else 728 else
726 { 729 {
@@ -734,6 +737,7 @@ GNUNET_PEERINFO_iterate (struct GNUNET_PEERINFO_Handle *h,
734 lpm = (struct ListPeerMessage *) &ac[1]; 737 lpm = (struct ListPeerMessage *) &ac[1];
735 lpm->header.size = htons (sizeof (struct ListPeerMessage)); 738 lpm->header.size = htons (sizeof (struct ListPeerMessage));
736 lpm->header.type = htons (GNUNET_MESSAGE_TYPE_PEERINFO_GET); 739 lpm->header.type = htons (GNUNET_MESSAGE_TYPE_PEERINFO_GET);
740 lpm->include_friend_only = htonl (include_friend_only);
737 memcpy (&lpm->peer, peer, sizeof (struct GNUNET_PeerIdentity)); 741 memcpy (&lpm->peer, peer, sizeof (struct GNUNET_PeerIdentity));
738 ic->have_peer = GNUNET_YES; 742 ic->have_peer = GNUNET_YES;
739 ic->peer = *peer; 743 ic->peer = *peer;