aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_container_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_container_lib.h')
-rw-r--r--src/include/gnunet_container_lib.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/include/gnunet_container_lib.h b/src/include/gnunet_container_lib.h
index c36190b7a..a6a0e519d 100644
--- a/src/include/gnunet_container_lib.h
+++ b/src/include/gnunet_container_lib.h
@@ -490,6 +490,12 @@ GNUNET_CONTAINER_meta_data_deserialize (const char *input, size_t size);
490struct GNUNET_CONTAINER_MultiHashMap; 490struct GNUNET_CONTAINER_MultiHashMap;
491 491
492/** 492/**
493 * Opaque handle to an iterator over
494 * a multihashmap.
495 */
496struct GNUNET_CONTAINER_MultiHashMapIterator;
497
498/**
493 * Options for storing values in the HashMap. 499 * Options for storing values in the HashMap.
494 */ 500 */
495enum GNUNET_CONTAINER_MultiHashMapOption 501enum GNUNET_CONTAINER_MultiHashMapOption
@@ -691,6 +697,50 @@ GNUNET_CONTAINER_multihashmap_iterate (const struct
691 697
692 698
693/** 699/**
700 * Create an iterator for a multihashmap.
701 * The iterator can be used to retrieve all the elements in the multihashmap
702 * one by one, without having to handle all elements at once (in contrast to
703 * 'GNUNET_CONTAINER_multihashmap_iterate'). Note that the iterator can not be
704 * used anymore if elements have been removed from 'map' after the creation of
705 * the iterator, or 'map' has been destroyed. Adding elements to 'map' may
706 * result in skipped or repeated elements.
707 *
708 * @param map the map to create an iterator for
709 * @return an iterator over the given multihashmap 'map'
710 */
711struct GNUNET_CONTAINER_MultiHashMapIterator *
712GNUNET_CONTAINER_multihashmap_iterator_create (const struct GNUNET_CONTAINER_MultiHashMap *map);
713
714
715/**
716 * Retrieve the next element from the hash map at the iterator's position.
717 * If there are no elements left, GNUNET_NO is returned, and 'key' and 'value'
718 * are not modified.
719 * This operation is only allowed if no elements have been removed from the
720 * multihashmap since the creation of 'iter', and the map has not been destroyed.
721 * Adding elements may result in repeating or skipping elements.
722 *
723 * @param iter the iterator to get the next element from
724 * @param key pointer to store the key in, can be NULL
725 * @param value pointer to store the value in, can be NULL
726 * @return GNUNET_YES we returned an element,
727 * GNUNET_NO if we are out of elements
728 */
729int
730GNUNET_CONTAINER_multihashmap_iterator_next (struct GNUNET_CONTAINER_MultiHashMapIterator *iter,
731 struct GNUNET_HashCode *key, void **value);
732
733
734/**
735 * Destroy a multihashmap iterator.
736 *
737 * @param iter the iterator to destroy
738 */
739void
740GNUNET_CONTAINER_multihashmap_iterator_destroy (struct GNUNET_CONTAINER_MultiHashMapIterator *iter);
741
742
743/**
694 * Iterate over all entries in the map that match a particular key. 744 * Iterate over all entries in the map that match a particular key.
695 * 745 *
696 * @param map the map 746 * @param map the map