diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-04-21 20:19:43 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-04-21 20:19:43 +0000 |
commit | 84e15afe4933ee2ca62e3e111ca261c3a986c157 (patch) | |
tree | 8a9cd9a06b723b940f6d11b0272f5eb395db39c4 /src/include/gnunet_peerinfo_service.h | |
parent | a06d7742d5a48229767c152f9466432d17e162de (diff) | |
download | gnunet-84e15afe4933ee2ca62e3e111ca261c3a986c157.tar.gz gnunet-84e15afe4933ee2ca62e3e111ca261c3a986c157.zip |
activating new peerinfo API
Diffstat (limited to 'src/include/gnunet_peerinfo_service.h')
-rw-r--r-- | src/include/gnunet_peerinfo_service.h | 84 |
1 files changed, 14 insertions, 70 deletions
diff --git a/src/include/gnunet_peerinfo_service.h b/src/include/gnunet_peerinfo_service.h index ac88df201..4f689e504 100644 --- a/src/include/gnunet_peerinfo_service.h +++ b/src/include/gnunet_peerinfo_service.h | |||
@@ -51,14 +51,15 @@ struct GNUNET_PEERINFO_Handle; | |||
51 | /** | 51 | /** |
52 | * Connect to the peerinfo service. | 52 | * Connect to the peerinfo service. |
53 | * | 53 | * |
54 | * @param cfg configuration to use | ||
55 | * @param sched scheduler to use | 54 | * @param sched scheduler to use |
55 | * @param cfg configuration to use | ||
56 | * @return NULL on error (configuration related, actual connection | 56 | * @return NULL on error (configuration related, actual connection |
57 | * etablishment may happen asynchronously). | 57 | * etablishment may happen asynchronously). |
58 | */ | 58 | */ |
59 | struct GNUNET_PEERINFO_Handle * | 59 | struct GNUNET_PEERINFO_Handle * |
60 | GNUNET_PEERINFO_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | 60 | GNUNET_PEERINFO_connect (struct GNUNET_SCHEDULER_Handle *sched, |
61 | struct GNUNET_SCHEDULER_Handle *sched); | 61 | const struct GNUNET_CONFIGURATION_Handle *cfg); |
62 | |||
62 | 63 | ||
63 | 64 | ||
64 | /** | 65 | /** |
@@ -86,26 +87,11 @@ GNUNET_PEERINFO_disconnect (struct GNUNET_PEERINFO_Handle *h); | |||
86 | * @param hello the verified (!) HELLO message | 87 | * @param hello the verified (!) HELLO message |
87 | */ | 88 | */ |
88 | void | 89 | void |
89 | GNUNET_PEERINFO_add_peer_new (struct GNUNET_PEERINFO_Handle *h, | 90 | GNUNET_PEERINFO_add_peer (struct GNUNET_PEERINFO_Handle *h, |
90 | const struct GNUNET_HELLO_Message *hello); | 91 | const struct GNUNET_HELLO_Message *hello); |
91 | |||
92 | 92 | ||
93 | 93 | ||
94 | /** | 94 | /** |
95 | * Add a host to the persistent list. | ||
96 | * | ||
97 | * @param cfg configuration to use | ||
98 | * @param sched scheduler to use | ||
99 | * @param peer identity of the peer | ||
100 | * @param hello the verified (!) HELLO message | ||
101 | */ | ||
102 | void | ||
103 | GNUNET_PEERINFO_add_peer (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
104 | struct GNUNET_SCHEDULER_Handle *sched, | ||
105 | const struct GNUNET_PeerIdentity *peer, | ||
106 | const struct GNUNET_HELLO_Message *hello); | ||
107 | |||
108 | /** | ||
109 | * Type of an iterator over the hosts. Note that each | 95 | * Type of an iterator over the hosts. Note that each |
110 | * host will be called with each available protocol. | 96 | * host will be called with each available protocol. |
111 | * | 97 | * |
@@ -128,40 +114,6 @@ struct GNUNET_PEERINFO_IteratorContext; | |||
128 | 114 | ||
129 | 115 | ||
130 | /** | 116 | /** |
131 | * Call a method for each known matching host and change | ||
132 | * its trust value. The method will be invoked once for | ||
133 | * each host and then finally once with a NULL pointer. After | ||
134 | * that final invocation, the iterator context must no longer | ||
135 | * be used. | ||
136 | * | ||
137 | * Note that the last call can be triggered by timeout or by simply | ||
138 | * being done; however, the trust argument will be set to zero if we | ||
139 | * are done, 1 if we timed out and 2 for fatal error. | ||
140 | * | ||
141 | * @param cfg configuration to use | ||
142 | * @param sched scheduler to use | ||
143 | * @param peer restrict iteration to this peer only (can be NULL) | ||
144 | * @param trust_delta how much to change the trust in all matching peers | ||
145 | * @param timeout how long to wait until timing out | ||
146 | * @param callback the method to call for each peer | ||
147 | * @param callback_cls closure for callback | ||
148 | * @return NULL on error (in this case, 'callback' is never called!), | ||
149 | * otherwise an iterator context | ||
150 | */ | ||
151 | struct GNUNET_PEERINFO_IteratorContext * | ||
152 | GNUNET_PEERINFO_iterate (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
153 | struct GNUNET_SCHEDULER_Handle *sched, | ||
154 | const struct GNUNET_PeerIdentity *peer, | ||
155 | int trust_delta, | ||
156 | struct GNUNET_TIME_Relative timeout, | ||
157 | GNUNET_PEERINFO_Processor callback, | ||
158 | void *callback_cls); | ||
159 | |||
160 | |||
161 | struct GNUNET_PEERINFO_NewIteratorContext; | ||
162 | |||
163 | |||
164 | /** | ||
165 | * Call a method for each known matching host and change its trust | 117 | * Call a method for each known matching host and change its trust |
166 | * value. The callback method will be invoked once for each matching | 118 | * value. The callback method will be invoked once for each matching |
167 | * host and then finally once with a NULL pointer. After that final | 119 | * host and then finally once with a NULL pointer. After that final |
@@ -183,23 +135,14 @@ struct GNUNET_PEERINFO_NewIteratorContext; | |||
183 | * @return NULL on error (in this case, 'callback' is never called!), | 135 | * @return NULL on error (in this case, 'callback' is never called!), |
184 | * otherwise an iterator context | 136 | * otherwise an iterator context |
185 | */ | 137 | */ |
186 | struct GNUNET_PEERINFO_NewIteratorContext * | 138 | struct GNUNET_PEERINFO_IteratorContext * |
187 | GNUNET_PEERINFO_iterate_new (struct GNUNET_PEERINFO_Handle *h, | 139 | GNUNET_PEERINFO_iterate (struct GNUNET_PEERINFO_Handle *h, |
188 | const struct GNUNET_PeerIdentity *peer, | 140 | const struct GNUNET_PeerIdentity *peer, |
189 | int trust_delta, | 141 | int trust_delta, |
190 | struct GNUNET_TIME_Relative timeout, | 142 | struct GNUNET_TIME_Relative timeout, |
191 | GNUNET_PEERINFO_Processor callback, | 143 | GNUNET_PEERINFO_Processor callback, |
192 | void *callback_cls); | 144 | void *callback_cls); |
193 | |||
194 | |||
195 | 145 | ||
196 | /** | ||
197 | * Cancel an iteration over peer information. | ||
198 | * | ||
199 | * @param ic context of the iterator to cancel | ||
200 | */ | ||
201 | void | ||
202 | GNUNET_PEERINFO_iterate_cancel_new (struct GNUNET_PEERINFO_NewIteratorContext *ic); | ||
203 | 146 | ||
204 | 147 | ||
205 | /** | 148 | /** |
@@ -211,6 +154,7 @@ void | |||
211 | GNUNET_PEERINFO_iterate_cancel (struct GNUNET_PEERINFO_IteratorContext *ic); | 154 | GNUNET_PEERINFO_iterate_cancel (struct GNUNET_PEERINFO_IteratorContext *ic); |
212 | 155 | ||
213 | 156 | ||
157 | |||
214 | /** | 158 | /** |
215 | * Handle for notifications about changes to the set of known peers. | 159 | * Handle for notifications about changes to the set of known peers. |
216 | */ | 160 | */ |