aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-04-21 20:19:43 +0000
committerChristian Grothoff <christian@grothoff.org>2010-04-21 20:19:43 +0000
commit84e15afe4933ee2ca62e3e111ca261c3a986c157 (patch)
tree8a9cd9a06b723b940f6d11b0272f5eb395db39c4 /src/include
parenta06d7742d5a48229767c152f9466432d17e162de (diff)
downloadgnunet-84e15afe4933ee2ca62e3e111ca261c3a986c157.tar.gz
gnunet-84e15afe4933ee2ca62e3e111ca261c3a986c157.zip
activating new peerinfo API
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_peerinfo_service.h84
-rw-r--r--src/include/gnunet_protocols.h5
2 files changed, 14 insertions, 75 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 */
59struct GNUNET_PEERINFO_Handle * 59struct GNUNET_PEERINFO_Handle *
60GNUNET_PEERINFO_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, 60GNUNET_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 */
88void 89void
89GNUNET_PEERINFO_add_peer_new (struct GNUNET_PEERINFO_Handle *h, 90GNUNET_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 */
102void
103GNUNET_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 */
151struct GNUNET_PEERINFO_IteratorContext *
152GNUNET_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
161struct 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 */
186struct GNUNET_PEERINFO_NewIteratorContext * 138struct GNUNET_PEERINFO_IteratorContext *
187GNUNET_PEERINFO_iterate_new (struct GNUNET_PEERINFO_Handle *h, 139GNUNET_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 */
201void
202GNUNET_PEERINFO_iterate_cancel_new (struct GNUNET_PEERINFO_NewIteratorContext *ic);
203 146
204 147
205/** 148/**
@@ -211,6 +154,7 @@ void
211GNUNET_PEERINFO_iterate_cancel (struct GNUNET_PEERINFO_IteratorContext *ic); 154GNUNET_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 */
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index d992c9fb7..72fcccf94 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -199,11 +199,6 @@ extern "C"
199#define GNUNET_MESSAGE_TYPE_TRANSPORT_PONG 33 199#define GNUNET_MESSAGE_TYPE_TRANSPORT_PONG 33
200 200
201/** 201/**
202 * Request addition of a HELLO
203 */
204#define GNUNET_MESSAGE_TYPE_PEERINFO_ADD 36
205
206/**
207 * Request update and listing of a peer. 202 * Request update and listing of a peer.
208 */ 203 */
209#define GNUNET_MESSAGE_TYPE_PEERINFO_GET 37 204#define GNUNET_MESSAGE_TYPE_PEERINFO_GET 37