aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_peerinfo_service.h
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2011-07-26 18:22:54 +0000
committerNathan S. Evans <evans@in.tum.de>2011-07-26 18:22:54 +0000
commit81eae49a1b5dfeadb9aac5974ec87cd01aed9ffd (patch)
tree35b65462b9209af4bd610552bb485ad22487400e /src/include/gnunet_peerinfo_service.h
parentbf4a9d8364675b34ac18d505e508006e2b773670 (diff)
downloadgnunet-81eae49a1b5dfeadb9aac5974ec87cd01aed9ffd.tar.gz
gnunet-81eae49a1b5dfeadb9aac5974ec87cd01aed9ffd.zip
start service
Diffstat (limited to 'src/include/gnunet_peerinfo_service.h')
-rw-r--r--src/include/gnunet_peerinfo_service.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/include/gnunet_peerinfo_service.h b/src/include/gnunet_peerinfo_service.h
index 1411168c0..ff4d99d95 100644
--- a/src/include/gnunet_peerinfo_service.h
+++ b/src/include/gnunet_peerinfo_service.h
@@ -89,6 +89,45 @@ GNUNET_PEERINFO_add_peer (struct GNUNET_PEERINFO_Handle *h,
89 89
90 90
91/** 91/**
92 * Connect to the peerinfo service.
93 *
94 * @param cfg configuration to use
95 * @return NULL on error (configuration related, actual connection
96 * etablishment may happen asynchronously).
97 */
98struct GNUNET_PEERINFO_Handle *
99GNUNET_PEERINFO_standalone_connect (const struct GNUNET_CONFIGURATION_Handle *cfg);
100
101
102/**
103 * Disconnect from the peerinfo service. Note that all iterators must
104 * have completed or have been cancelled by the time this function is
105 * called (otherwise, calling this function is a serious error).
106 * Furthermore, if 'GNUNET_PEERINFO_add_peer' operations are still
107 * pending, they will be cancelled silently on disconnect.
108 *
109 * @param h handle to disconnect
110 */
111void
112GNUNET_PEERINFO_standalone_disconnect (struct GNUNET_PEERINFO_Handle *h);
113
114
115/**
116 * Add a host to the persistent list. This method operates in
117 * semi-reliable mode: if the transmission is not completed by
118 * the time 'GNUNET_PEERINFO_disconnect' is called, it will be
119 * aborted. Furthermore, if a second HELLO is added for the
120 * same peer before the first one was transmitted, PEERINFO may
121 * merge the two HELLOs prior to transmission to the service.
122 *
123 * @param h handle to the peerinfo service
124 * @param hello the verified (!) HELLO message
125 */
126void
127GNUNET_PEERINFO_standalone_add_peer (struct GNUNET_PEERINFO_Handle *h,
128 const struct GNUNET_HELLO_Message *hello);
129
130/**
92 * Type of an iterator over the hosts. Note that each 131 * Type of an iterator over the hosts. Note that each
93 * host will be called with each available protocol. 132 * host will be called with each available protocol.
94 * 133 *
@@ -144,9 +183,41 @@ GNUNET_PEERINFO_iterate (struct GNUNET_PEERINFO_Handle *h,
144void 183void
145GNUNET_PEERINFO_iterate_cancel (struct GNUNET_PEERINFO_IteratorContext *ic); 184GNUNET_PEERINFO_iterate_cancel (struct GNUNET_PEERINFO_IteratorContext *ic);
146 185
186/**
187 * Call a method for each known matching host and change its trust
188 * value. The callback method will be invoked once for each matching
189 * host and then finally once with a NULL pointer. After that final
190 * invocation, the iterator context must no longer be used.
191 *
192 * Instead of calling this function with 'peer == NULL'
193 * it is often better to use 'GNUNET_PEERINFO_notify'.
194 *
195 * @param h handle to the peerinfo service
196 * @param peer restrict iteration to this peer only (can be NULL)
197 * @param timeout how long to wait until timing out
198 * @param callback the method to call for each peer
199 * @param callback_cls closure for callback
200 * @return NULL on error (in this case, 'callback' is never called!),
201 * otherwise an iterator context
202 */
203struct GNUNET_PEERINFO_IteratorContext *
204GNUNET_PEERINFO_standalone_iterate (struct GNUNET_PEERINFO_Handle *h,
205 const struct GNUNET_PeerIdentity *peer,
206 struct GNUNET_TIME_Relative timeout,
207 GNUNET_PEERINFO_Processor callback,
208 void *callback_cls);
209
147 210
148 211
149/** 212/**
213 * Cancel an iteration over peer information.
214 *
215 * @param ic context of the iterator to cancel
216 */
217void
218GNUNET_PEERINFO_standalone_iterate_cancel (struct GNUNET_PEERINFO_IteratorContext *ic);
219
220/**
150 * Handle for notifications about changes to the set of known peers. 221 * Handle for notifications about changes to the set of known peers.
151 */ 222 */
152struct GNUNET_PEERINFO_NotifyContext; 223struct GNUNET_PEERINFO_NotifyContext;