diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-01-15 10:07:33 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-01-15 10:07:33 +0000 |
commit | 2e482e23a8d51f58e6ff80782e360cf9f47e174c (patch) | |
tree | 856066bdd39afffcbb42ec315fed8cfc64541028 /src/include | |
parent | 697aa41b1e22503e2eb2d8802bdaf627b3931997 (diff) | |
download | gnunet-2e482e23a8d51f58e6ff80782e360cf9f47e174c.tar.gz gnunet-2e482e23a8d51f58e6ff80782e360cf9f47e174c.zip |
allow cancellation of peerinfo iterations
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_peerinfo_service.h | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/src/include/gnunet_peerinfo_service.h b/src/include/gnunet_peerinfo_service.h index 463131e6a..6deed04d9 100644 --- a/src/include/gnunet_peerinfo_service.h +++ b/src/include/gnunet_peerinfo_service.h | |||
@@ -73,13 +73,21 @@ typedef void | |||
73 | 73 | ||
74 | 74 | ||
75 | /** | 75 | /** |
76 | * Handle for cancellation of iteration over peers. | ||
77 | */ | ||
78 | struct GNUNET_PEERINFO_IteratorContext; | ||
79 | |||
80 | |||
81 | /** | ||
76 | * Call a method for each known matching host and change | 82 | * Call a method for each known matching host and change |
77 | * its trust value. The method will be invoked once for | 83 | * its trust value. The method will be invoked once for |
78 | * each host and then finally once with a NULL pointer. | 84 | * each host and then finally once with a NULL pointer. After |
79 | * Note that the last call can be triggered by timeout or | 85 | * that final invocation, the iterator context must no longer |
80 | * by simply being done; however, the trust argument will | 86 | * be used. |
81 | * be set to zero if we are done, 1 if we timed out and | 87 | * |
82 | * 2 for fatal error. | 88 | * Note that the last call can be triggered by timeout or by simply |
89 | * being done; however, the trust argument will be set to zero if we | ||
90 | * are done, 1 if we timed out and 2 for fatal error. | ||
83 | * | 91 | * |
84 | * @param cfg configuration to use | 92 | * @param cfg configuration to use |
85 | * @param sched scheduler to use | 93 | * @param sched scheduler to use |
@@ -88,9 +96,11 @@ typedef void | |||
88 | * @param timeout how long to wait until timing out | 96 | * @param timeout how long to wait until timing out |
89 | * @param callback the method to call for each peer | 97 | * @param callback the method to call for each peer |
90 | * @param callback_cls closure for callback | 98 | * @param callback_cls closure for callback |
99 | * @return NULL on error (in this case, 'callback' is never called!), | ||
100 | * otherwise an iterator context | ||
91 | */ | 101 | */ |
92 | void | 102 | struct GNUNET_PEERINFO_IteratorContext * |
93 | GNUNET_PEERINFO_for_all (const struct GNUNET_CONFIGURATION_Handle *cfg, | 103 | GNUNET_PEERINFO_iterate (const struct GNUNET_CONFIGURATION_Handle *cfg, |
94 | struct GNUNET_SCHEDULER_Handle *sched, | 104 | struct GNUNET_SCHEDULER_Handle *sched, |
95 | const struct GNUNET_PeerIdentity *peer, | 105 | const struct GNUNET_PeerIdentity *peer, |
96 | int trust_delta, | 106 | int trust_delta, |
@@ -100,6 +110,15 @@ GNUNET_PEERINFO_for_all (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
100 | 110 | ||
101 | 111 | ||
102 | /** | 112 | /** |
113 | * Cancel an iteration over peer information. | ||
114 | * | ||
115 | * @param ic context of the iterator to cancel | ||
116 | */ | ||
117 | void | ||
118 | GNUNET_PEERINFO_iterate_cancel (struct GNUNET_PEERINFO_IteratorContext *ic); | ||
119 | |||
120 | |||
121 | /** | ||
103 | * Handle for notifications about changes to the set of known peers. | 122 | * Handle for notifications about changes to the set of known peers. |
104 | */ | 123 | */ |
105 | struct GNUNET_PEERINFO_NotifyContext; | 124 | struct GNUNET_PEERINFO_NotifyContext; |