aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_set_service.h
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2013-07-23 16:18:30 +0000
committerFlorian Dold <florian.dold@gmail.com>2013-07-23 16:18:30 +0000
commit8b22d09975edd5b61ec9d11334628d8ab04fcb09 (patch)
tree357a0a2209855a86b2f5afcc2b138fee25137906 /src/include/gnunet_set_service.h
parente5fec3d5e1ef587cb2825a491a0fae646896f808 (diff)
downloadgnunet-8b22d09975edd5b61ec9d11334628d8ab04fcb09.tar.gz
gnunet-8b22d09975edd5b61ec9d11334628d8ab04fcb09.zip
- set iterate declaration
Diffstat (limited to 'src/include/gnunet_set_service.h')
-rw-r--r--src/include/gnunet_set_service.h38
1 files changed, 35 insertions, 3 deletions
diff --git a/src/include/gnunet_set_service.h b/src/include/gnunet_set_service.h
index b434e4474..1e59c02c9 100644
--- a/src/include/gnunet_set_service.h
+++ b/src/include/gnunet_set_service.h
@@ -188,6 +188,16 @@ typedef void (*GNUNET_SET_ResultIterator) (void *cls,
188 const struct GNUNET_SET_Element *element, 188 const struct GNUNET_SET_Element *element,
189 enum GNUNET_SET_Status status); 189 enum GNUNET_SET_Status status);
190 190
191/**
192 * Iterator for set elements.
193 *
194 * @param cls closure
195 * @param element the element
196 * @return GNUNET_YES to continue iterating, GNUNET_NO to stop.
197 */
198typedef int (*GNUNET_SET_ElementIterator) (void *cls,
199 const struct GNUNET_SET_Element *element);
200
191 201
192/** 202/**
193 * Called when another peer wants to do a set operation with the 203 * Called when another peer wants to do a set operation with the
@@ -239,8 +249,10 @@ GNUNET_SET_create (const struct GNUNET_CONFIGURATION_Handle *cfg,
239 * @param element element to add to the set 249 * @param element element to add to the set
240 * @param cont continuation called after the element has been added 250 * @param cont continuation called after the element has been added
241 * @param cont_cls closure for cont 251 * @param cont_cls closure for cont
252 * @return GNUNET_OK on success, GNUNET_SYSERR if the
253 * set is invalid (e.g. the set service crashed)
242 */ 254 */
243void 255int
244GNUNET_SET_add_element (struct GNUNET_SET_Handle *set, 256GNUNET_SET_add_element (struct GNUNET_SET_Handle *set,
245 const struct GNUNET_SET_Element *element, 257 const struct GNUNET_SET_Element *element,
246 GNUNET_SET_Continuation cont, 258 GNUNET_SET_Continuation cont,
@@ -257,8 +269,10 @@ GNUNET_SET_add_element (struct GNUNET_SET_Handle *set,
257 * @param element element to remove from the set 269 * @param element element to remove from the set
258 * @param cont continuation called after the element has been removed 270 * @param cont continuation called after the element has been removed
259 * @param cont_cls closure for cont 271 * @param cont_cls closure for cont
272 * @return GNUNET_OK on success, GNUNET_SYSERR if the
273 * set is invalid (e.g. the set service crashed)
260 */ 274 */
261void 275int
262GNUNET_SET_remove_element (struct GNUNET_SET_Handle *set, 276GNUNET_SET_remove_element (struct GNUNET_SET_Handle *set,
263 const struct GNUNET_SET_Element *element, 277 const struct GNUNET_SET_Element *element,
264 GNUNET_SET_Continuation cont, 278 GNUNET_SET_Continuation cont,
@@ -359,8 +373,10 @@ GNUNET_SET_accept (struct GNUNET_SET_Request *request,
359 * 373 *
360 * @param oh handle to the set operation 374 * @param oh handle to the set operation
361 * @param set the set to use for the operation 375 * @param set the set to use for the operation
376 * @return GNUNET_OK on success, GNUNET_SYSERR if the
377 * set is invalid (e.g. the set service crashed)
362 */ 378 */
363void 379int
364GNUNET_SET_commit (struct GNUNET_SET_OperationHandle *oh, 380GNUNET_SET_commit (struct GNUNET_SET_OperationHandle *oh,
365 struct GNUNET_SET_Handle *set); 381 struct GNUNET_SET_Handle *set);
366 382
@@ -376,6 +392,22 @@ void
376GNUNET_SET_operation_cancel (struct GNUNET_SET_OperationHandle *oh); 392GNUNET_SET_operation_cancel (struct GNUNET_SET_OperationHandle *oh);
377 393
378 394
395/**
396 * Iterate over all elements in the given set.
397 * Note that this operation involves transferring every element of the set
398 * from the service to the client, and is thus costly.
399 *
400 * @param set the set to iterate over
401 * @param iter the iterator to call for each element
402 * @param cls closure for 'iter'
403 * @return GNUNET_YES if every element was iterated over, GNUNET_NO
404 * if the iterator prematurely stopped, GNUNET_SYSERR if the set
405 * is invalid (e.g. the server crashed, disconnected)
406 */
407int
408GNUNET_SET_iterate (struct GNUNET_SET_Handle *set, GNUNET_SET_ElementIterator iter, void *cls);
409
410
379#if 0 /* keep Emacsens' auto-indent happy */ 411#if 0 /* keep Emacsens' auto-indent happy */
380{ 412{
381#endif 413#endif