/*
This file is part of GNUnet
- (C) 2013, 2014 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2013, 2014 Christian Grothoff (and other contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
enum GNUNET_SET_OperationType
{
/**
- * A purely local set that does not support any
- * operation.
+ * A purely local set that does not support any operation.
*/
GNUNET_SET_OPERATION_NONE,
GNUNET_SET_OPERATION_UNION
};
+
/**
* Status for the result callback
*/
enum GNUNET_SET_Status
{
/**
- * Everything went ok.
+ * Everything went ok, we are transmitting an element of the
+ * result (in set, or to be removed from set, depending on
+ * the `enum GNUNET_SET_ResultMode`).
*/
GNUNET_SET_STATUS_OK,
- /**
- * There was a timeout.
- */
- GNUNET_SET_STATUS_TIMEOUT,
-
/**
* The other peer refused to to the operation with us,
* or something went wrong.
GNUNET_SET_STATUS_FAILURE,
/**
- * Success, all elements have been returned (but the other
- * peer might still be receiving some from us, so we are not done).
+ * Success, all elements have been returned (but the other peer
+ * might still be receiving some from us, so we are not done). Only
+ * used during UNION operation.
*/
GNUNET_SET_STATUS_HALF_DONE,
/**
* Application-specific element type.
*/
- uint16_t type;
+ uint16_t element_type;
/**
* Actual data of the element
/**
* Destroy the set handle, and free all associated resources.
+ * Iterations must have completed (or be explicitly canceled)
+ * before destroying the corresponding set. Operations may
+ * still be pending when a set is destroyed.
+ *
+ * @param set set to destroy
*/
void
GNUNET_SET_destroy (struct GNUNET_SET_Handle *set);
/**
- * Cancel the given listen operation.
- * After calling cancel, the listen callback for this listen handle
- * will not be called again.
+ * Cancel the given listen operation. After calling cancel, the
+ * listen callback for this listen handle will not be called again.
*
* @param lh handle for the listen operation
*/
/**
- * Cancel the given set operation.
- * May not be called after the operation's `GNUNET_SET_ResultIterator` has been
- * called with a status that indicates error, timeout or done.
+ * Cancel the given set operation. May not be called after the
+ * operation's `GNUNET_SET_ResultIterator` has been called with a
+ * status that indicates error, timeout or done.
*
* @param oh set operation to cancel
*/
* @param iter the iterator to call for each element
* @param iter_cls closure for @a iter
* @return #GNUNET_YES if the iteration started successfuly,
- * #GNUNET_SYSERR if the set is invalid (e.g. the server crashed, disconnected)
+ * #GNUNET_NO if another iteration was still active,
+ * #GNUNET_SYSERR if the set is invalid (e.g. the server crashed, disconnected)
*/
int
GNUNET_SET_iterate (struct GNUNET_SET_Handle *set,
GNUNET_SET_ElementIterator iter,
void *iter_cls);
+/**
+ * Stop iteration over all elements in the given set. Can only
+ * be called before the iteration has "naturally" completed its
+ * turn.
+ *
+ * @param set the set to stop iterating over
+ */
+void
+GNUNET_SET_iterate_cancel (struct GNUNET_SET_Handle *set);
+
#if 0 /* keep Emacsens' auto-indent happy */
{