adding number of preferences to allow iterating over preferences
[oweals/gnunet.git] / src / include / gnunet_container_lib.h
index 39176e93bcd6fec8b5129bb2d01f97a2a0662baa..125bc81b21bcec5b405e1fbc7677da493507a1f2 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2001-2013 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2001-2013 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
@@ -59,16 +59,19 @@ extern "C"
  */
 struct GNUNET_CONTAINER_BloomFilter;
 
+
 /**
  * @ingroup bloomfilter
- * Iterator over struct GNUNET_HashCodes.
+ * Iterator over `struct GNUNET_HashCode`.
  *
  * @param cls closure
  * @param next set to the next hash code
  * @return #GNUNET_YES if next was updated
  *         #GNUNET_NO if there are no more entries
  */
-typedef int (*GNUNET_HashCodeIterator) (void *cls, struct GNUNET_HashCode * next);
+typedef int
+(*GNUNET_CONTAINER_HashCodeIterator) (void *cls,
+                                      struct GNUNET_HashCode *next);
 
 
 /**
@@ -84,7 +87,8 @@ typedef int (*GNUNET_HashCodeIterator) (void *cls, struct GNUNET_HashCode * next
  * @return the bloomfilter
  */
 struct GNUNET_CONTAINER_BloomFilter *
-GNUNET_CONTAINER_bloomfilter_load (const char *filename, size_t size,
+GNUNET_CONTAINER_bloomfilter_load (const char *filename,
+                                   size_t size,
                                    unsigned int k);
 
 
@@ -103,7 +107,8 @@ GNUNET_CONTAINER_bloomfilter_load (const char *filename, size_t size,
  * @return the bloomfilter
  */
 struct GNUNET_CONTAINER_BloomFilter *
-GNUNET_CONTAINER_bloomfilter_init (const char *data, size_t size,
+GNUNET_CONTAINER_bloomfilter_init (const char *data,
+                                   size_t size,
                                    unsigned int k);
 
 
@@ -117,9 +122,9 @@ GNUNET_CONTAINER_bloomfilter_init (const char *data, size_t size,
  * @return #GNUNET_SYSERR if the data array of the wrong size
  */
 int
-GNUNET_CONTAINER_bloomfilter_get_raw_data (const struct
-                                           GNUNET_CONTAINER_BloomFilter *bf,
-                                           char *data, size_t size);
+GNUNET_CONTAINER_bloomfilter_get_raw_data (const struct GNUNET_CONTAINER_BloomFilter *bf,
+                                           char *data,
+                                           size_t size);
 
 
 /**
@@ -131,8 +136,8 @@ GNUNET_CONTAINER_bloomfilter_get_raw_data (const struct
  * @return #GNUNET_YES if the element is in the filter, #GNUNET_NO if not
  */
 int
-GNUNET_CONTAINER_bloomfilter_test (const struct GNUNET_CONTAINER_BloomFilter
-                                   *bf, const struct GNUNET_HashCode * e);
+GNUNET_CONTAINER_bloomfilter_test (const struct GNUNET_CONTAINER_BloomFilter *bf,
+                                   const struct GNUNET_HashCode *e);
 
 
 /**
@@ -144,7 +149,7 @@ GNUNET_CONTAINER_bloomfilter_test (const struct GNUNET_CONTAINER_BloomFilter
  */
 void
 GNUNET_CONTAINER_bloomfilter_add (struct GNUNET_CONTAINER_BloomFilter *bf,
-                                  const struct GNUNET_HashCode * e);
+                                  const struct GNUNET_HashCode *e);
 
 
 /**
@@ -156,7 +161,7 @@ GNUNET_CONTAINER_bloomfilter_add (struct GNUNET_CONTAINER_BloomFilter *bf,
  */
 void
 GNUNET_CONTAINER_bloomfilter_remove (struct GNUNET_CONTAINER_BloomFilter *bf,
-                                     const struct GNUNET_HashCode * e);
+                                     const struct GNUNET_HashCode *e);
 
 
 /**
@@ -167,8 +172,7 @@ GNUNET_CONTAINER_bloomfilter_remove (struct GNUNET_CONTAINER_BloomFilter *bf,
  * @return copy of bf
  */
 struct GNUNET_CONTAINER_BloomFilter *
-GNUNET_CONTAINER_bloomfilter_copy (const struct GNUNET_CONTAINER_BloomFilter
-                                   *bf);
+GNUNET_CONTAINER_bloomfilter_copy (const struct GNUNET_CONTAINER_BloomFilter *bf);
 
 
 
@@ -184,6 +188,16 @@ void
 GNUNET_CONTAINER_bloomfilter_free (struct GNUNET_CONTAINER_BloomFilter *bf);
 
 
+/**
+ * Get the number of the addresses set per element in the bloom filter.
+ *
+ * @param bf the filter
+ * @return addresses set per element in the bf
+ */
+size_t
+GNUNET_CONTAINER_bloomfilter_get_element_addresses (const struct GNUNET_CONTAINER_BloomFilter *bf);
+
+
 /**
  * @ingroup bloomfilter
  * Get size of the bloom filter.
@@ -192,8 +206,7 @@ GNUNET_CONTAINER_bloomfilter_free (struct GNUNET_CONTAINER_BloomFilter *bf);
  * @return number of bytes used for the data of the bloom filter
  */
 size_t
-GNUNET_CONTAINER_bloomfilter_get_size (const struct GNUNET_CONTAINER_BloomFilter
-                                       *bf);
+GNUNET_CONTAINER_bloomfilter_get_size (const struct GNUNET_CONTAINER_BloomFilter *bf);
 
 
 /**
@@ -235,8 +248,8 @@ GNUNET_CONTAINER_bloomfilter_or (struct GNUNET_CONTAINER_BloomFilter *bf,
  */
 int
 GNUNET_CONTAINER_bloomfilter_or2 (struct GNUNET_CONTAINER_BloomFilter *bf,
-                                  const struct GNUNET_CONTAINER_BloomFilter
-                                  *to_or);
+                                  const struct GNUNET_CONTAINER_BloomFilter *to_or);
+
 
 /**
  * @ingroup bloomfilter
@@ -252,8 +265,9 @@ GNUNET_CONTAINER_bloomfilter_or2 (struct GNUNET_CONTAINER_BloomFilter *bf,
  */
 void
 GNUNET_CONTAINER_bloomfilter_resize (struct GNUNET_CONTAINER_BloomFilter *bf,
-                                     GNUNET_HashCodeIterator iterator,
-                                     void *iterator_cls, size_t size,
+                                     GNUNET_CONTAINER_HashCodeIterator iterator,
+                                     void *iterator_cls,
+                                     size_t size,
                                      unsigned int k);
 
 
@@ -265,6 +279,7 @@ GNUNET_CONTAINER_bloomfilter_resize (struct GNUNET_CONTAINER_BloomFilter *bf,
  */
 struct GNUNET_CONTAINER_MetaData;
 
+
 /**
  * @ingroup metadata
  * Create a fresh meta data container.
@@ -283,8 +298,8 @@ GNUNET_CONTAINER_meta_data_create (void);
  * @return duplicate meta-data container
  */
 struct GNUNET_CONTAINER_MetaData *
-GNUNET_CONTAINER_meta_data_duplicate (const struct GNUNET_CONTAINER_MetaData
-                                      *md);
+GNUNET_CONTAINER_meta_data_duplicate (const struct GNUNET_CONTAINER_MetaData *md);
+
 
 /**
  * @ingroup metadata
@@ -308,10 +323,8 @@ GNUNET_CONTAINER_meta_data_destroy (struct GNUNET_CONTAINER_MetaData *md);
  * @return #GNUNET_YES if they are equal
  */
 int
-GNUNET_CONTAINER_meta_data_test_equal (const struct GNUNET_CONTAINER_MetaData
-                                       *md1,
-                                       const struct GNUNET_CONTAINER_MetaData
-                                       *md2);
+GNUNET_CONTAINER_meta_data_test_equal (const struct GNUNET_CONTAINER_MetaData *md1,
+                                       const struct GNUNET_CONTAINER_MetaData *md2);
 
 
 /**
@@ -337,7 +350,8 @@ GNUNET_CONTAINER_meta_data_insert (struct GNUNET_CONTAINER_MetaData *md,
                                    const char *plugin_name,
                                    enum EXTRACTOR_MetaType type,
                                    enum EXTRACTOR_MetaFormat format,
-                                   const char *data_mime_type, const char *data,
+                                   const char *data_mime_type,
+                                   const char *data,
                                    size_t data_size);
 
 
@@ -368,7 +382,8 @@ GNUNET_CONTAINER_meta_data_merge (struct GNUNET_CONTAINER_MetaData *md,
 int
 GNUNET_CONTAINER_meta_data_delete (struct GNUNET_CONTAINER_MetaData *md,
                                    enum EXTRACTOR_MetaType type,
-                                   const char *data, size_t data_size);
+                                   const char *data,
+                                   size_t data_size);
 
 
 /**
@@ -389,8 +404,7 @@ GNUNET_CONTAINER_meta_data_clear (struct GNUNET_CONTAINER_MetaData *md);
  * @param md metadata to modify
  */
 void
-GNUNET_CONTAINER_meta_data_add_publication_date (struct
-                                                 GNUNET_CONTAINER_MetaData *md);
+GNUNET_CONTAINER_meta_data_add_publication_date (struct GNUNET_CONTAINER_MetaData *md);
 
 
 /**
@@ -421,8 +435,8 @@ GNUNET_CONTAINER_meta_data_iterate (const struct GNUNET_CONTAINER_MetaData *md,
  * @return NULL if no entry was found
  */
 char *
-GNUNET_CONTAINER_meta_data_get_by_type (const struct GNUNET_CONTAINER_MetaData
-                                        *md, enum EXTRACTOR_MetaType type);
+GNUNET_CONTAINER_meta_data_get_by_type (const struct GNUNET_CONTAINER_MetaData *md,
+                                        enum EXTRACTOR_MetaType type);
 
 
 /**
@@ -438,8 +452,7 @@ GNUNET_CONTAINER_meta_data_get_by_type (const struct GNUNET_CONTAINER_MetaData
  *  otherwise client is responsible for freeing the value!
  */
 char *
-GNUNET_CONTAINER_meta_data_get_first_by_types (const struct
-                                               GNUNET_CONTAINER_MetaData *md,
+GNUNET_CONTAINER_meta_data_get_first_by_types (const struct GNUNET_CONTAINER_MetaData *md,
                                                ...);
 
 /**
@@ -453,8 +466,8 @@ GNUNET_CONTAINER_meta_data_get_first_by_types (const struct
  * @return number of bytes in thumbnail, 0 if not available
  */
 size_t
-GNUNET_CONTAINER_meta_data_get_thumbnail (const struct GNUNET_CONTAINER_MetaData
-                                          *md, unsigned char **thumb);
+GNUNET_CONTAINER_meta_data_get_thumbnail (const struct GNUNET_CONTAINER_MetaData *md,
+                                          unsigned char **thumb);
 
 
 
@@ -501,11 +514,10 @@ enum GNUNET_CONTAINER_MetaDataSerializationOptions
  *         space)
  */
 ssize_t
-GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
-                                      *md, char **target, size_t max,
-                                      enum
-                                      GNUNET_CONTAINER_MetaDataSerializationOptions
-                                      opt);
+GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData *md,
+                                      char **target,
+                                      size_t max,
+                                      enum GNUNET_CONTAINER_MetaDataSerializationOptions opt);
 
 
 /**
@@ -516,8 +528,7 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
  * @return number of bytes needed for serialization, -1 on error
  */
 ssize_t
-GNUNET_CONTAINER_meta_data_get_serialized_size (const struct
-                                                GNUNET_CONTAINER_MetaData *md);
+GNUNET_CONTAINER_meta_data_get_serialized_size (const struct GNUNET_CONTAINER_MetaData *md);
 
 
 /**
@@ -530,7 +541,8 @@ GNUNET_CONTAINER_meta_data_get_serialized_size (const struct
  *         bad format)
  */
 struct GNUNET_CONTAINER_MetaData *
-GNUNET_CONTAINER_meta_data_deserialize (const char *input, size_t size);
+GNUNET_CONTAINER_meta_data_deserialize (const char *input,
+                                        size_t size);
 
 
 /* ******************************* HashMap **************************** */
@@ -600,9 +612,10 @@ enum GNUNET_CONTAINER_MultiHashMapOption
  *         iterate,
  *         #GNUNET_NO if not.
  */
-typedef int (*GNUNET_CONTAINER_HashMapIterator) (void *cls,
-                                                 const struct GNUNET_HashCode *key,
-                                                 void *value);
+typedef int
+(*GNUNET_CONTAINER_HashMapIterator) (void *cls,
+                                     const struct GNUNET_HashCode *key,
+                                     void *value);
 
 
 /**
@@ -612,10 +625,10 @@ typedef int (*GNUNET_CONTAINER_HashMapIterator) (void *cls,
  * @param len initial size (map will grow as needed)
  * @param do_not_copy_keys #GNUNET_NO is always safe and should be used by default;
  *                         #GNUNET_YES means that on 'put', the 'key' does not have
- *                         to be copied as the destination of the pointer is 
+ *                         to be copied as the destination of the pointer is
  *                         guaranteed to be life as long as the value is stored in
- *                         the hashmap.  This can significantly reduce memory 
- *                         consumption, but of course is also a recipie for 
+ *                         the hashmap.  This can significantly reduce memory
+ *                         consumption, but of course is also a recipie for
  *                         heap corruption if the assumption is not true.  Only
  *                         use this if (1) memory use is important in this case and
  *                         (2) you have triple-checked that the invariant holds
@@ -649,7 +662,7 @@ GNUNET_CONTAINER_multihashmap_destroy (struct GNUNET_CONTAINER_MultiHashMap *map
  *   key-value pairs with value NULL
  */
 void *
-GNUNET_CONTAINER_multihashmap_get (const struct GNUNET_CONTAINER_MultiHashMap *map, 
+GNUNET_CONTAINER_multihashmap_get (const struct GNUNET_CONTAINER_MultiHashMap *map,
                                    const struct GNUNET_HashCode *key);
 
 
@@ -667,7 +680,7 @@ GNUNET_CONTAINER_multihashmap_get (const struct GNUNET_CONTAINER_MultiHashMap *m
  */
 int
 GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap *map,
-                                      const struct GNUNET_HashCode *key, 
+                                      const struct GNUNET_HashCode *key,
                                      const void *value);
 
 /**
@@ -680,10 +693,22 @@ GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap *map,
  * @return number of values removed
  */
 int
-GNUNET_CONTAINER_multihashmap_remove_all (struct GNUNET_CONTAINER_MultiHashMap *map, 
+GNUNET_CONTAINER_multihashmap_remove_all (struct GNUNET_CONTAINER_MultiHashMap *map,
                                           const struct GNUNET_HashCode *key);
 
 
+/**
+ * @ingroup hashmap
+ * Remove all entries from the map.
+ * Note that the values would not be "freed".
+ *
+ * @param map the map
+ * @return number of values removed
+ */
+unsigned int
+GNUNET_CONTAINER_multihashmap_clear (struct GNUNET_CONTAINER_MultiHashMap *map);
+
+
 /**
  * @ingroup hashmap
  * Check if the map contains any value under the given
@@ -711,7 +736,7 @@ GNUNET_CONTAINER_multihashmap_contains (const struct GNUNET_CONTAINER_MultiHashM
  *         #GNUNET_NO if not
  */
 int
-GNUNET_CONTAINER_multihashmap_contains_value (const struct GNUNET_CONTAINER_MultiHashMap *map, 
+GNUNET_CONTAINER_multihashmap_contains_value (const struct GNUNET_CONTAINER_MultiHashMap *map,
                                               const struct GNUNET_HashCode *key,
                                               const void *value);
 
@@ -731,7 +756,8 @@ GNUNET_CONTAINER_multihashmap_contains_value (const struct GNUNET_CONTAINER_Mult
  */
 int
 GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map,
-                                   const struct GNUNET_HashCode * key, void *value,
+                                   const struct GNUNET_HashCode *key,
+                                   void *value,
                                    enum GNUNET_CONTAINER_MultiHashMapOption
                                    opt);
 
@@ -743,8 +769,7 @@ GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map,
  * @return the number of key value pairs
  */
 unsigned int
-GNUNET_CONTAINER_multihashmap_size (const struct GNUNET_CONTAINER_MultiHashMap
-                                    *map);
+GNUNET_CONTAINER_multihashmap_size (const struct GNUNET_CONTAINER_MultiHashMap *map);
 
 
 /**
@@ -758,8 +783,7 @@ GNUNET_CONTAINER_multihashmap_size (const struct GNUNET_CONTAINER_MultiHashMap
  *         #GNUNET_SYSERR if it aborted iteration
  */
 int
-GNUNET_CONTAINER_multihashmap_iterate (const struct
-                                       GNUNET_CONTAINER_MultiHashMap *map,
+GNUNET_CONTAINER_multihashmap_iterate (const struct GNUNET_CONTAINER_MultiHashMap *map,
                                        GNUNET_CONTAINER_HashMapIterator it,
                                        void *it_cls);
 
@@ -782,7 +806,7 @@ GNUNET_CONTAINER_multihashmap_iterator_create (const struct GNUNET_CONTAINER_Mul
 
 
 /**
- * @ingroup hashmap 
+ * @ingroup hashmap
  * Retrieve the next element from the hash map at the iterator's
  * position.  If there are no elements left, #GNUNET_NO is returned,
  * and @a key and @a value are not modified.  This operation is only
@@ -798,12 +822,12 @@ GNUNET_CONTAINER_multihashmap_iterator_create (const struct GNUNET_CONTAINER_Mul
  */
 int
 GNUNET_CONTAINER_multihashmap_iterator_next (struct GNUNET_CONTAINER_MultiHashMapIterator *iter,
-                                             struct GNUNET_HashCode *key, 
+                                             struct GNUNET_HashCode *key,
                                              const void **value);
 
 
 /**
- * @ingroup hashmap 
+ * @ingroup hashmap
  * Destroy a multihashmap iterator.
  *
  * @param iter the iterator to destroy
@@ -813,7 +837,7 @@ GNUNET_CONTAINER_multihashmap_iterator_destroy (struct GNUNET_CONTAINER_MultiHas
 
 
 /**
- * @ingroup hashmap 
+ * @ingroup hashmap
  * Iterate over all entries in the map that match a particular key.
  *
  * @param map the map
@@ -824,9 +848,8 @@ GNUNET_CONTAINER_multihashmap_iterator_destroy (struct GNUNET_CONTAINER_MultiHas
  *         #GNUNET_SYSERR if it aborted iteration
  */
 int
-GNUNET_CONTAINER_multihashmap_get_multiple (const struct
-                                            GNUNET_CONTAINER_MultiHashMap *map,
-                                            const struct GNUNET_HashCode * key,
+GNUNET_CONTAINER_multihashmap_get_multiple (const struct GNUNET_CONTAINER_MultiHashMap *map,
+                                            const struct GNUNET_HashCode *key,
                                             GNUNET_CONTAINER_HashMapIterator it,
                                             void *it_cls);
 
@@ -844,11 +867,13 @@ GNUNET_CONTAINER_multihashmap_get_multiple (const struct
  *         iterate,
  *         #GNUNET_NO if not.
  */
-typedef int (*GNUNET_CONTAINER_PeerMapIterator) (void *cls,
-                                                 const struct GNUNET_PeerIdentity *key,
-                                                 void *value);
+typedef int
+(*GNUNET_CONTAINER_PeerMapIterator) (void *cls,
+                                     const struct GNUNET_PeerIdentity *key,
+                                     void *value);
 
 
+struct GNUNET_CONTAINER_MultiPeerMap;
 /**
  * @ingroup hashmap
  * Create a multi peer map (hash map for public keys of peers).
@@ -856,10 +881,10 @@ typedef int (*GNUNET_CONTAINER_PeerMapIterator) (void *cls,
  * @param len initial size (map will grow as needed)
  * @param do_not_copy_keys #GNUNET_NO is always safe and should be used by default;
  *                         #GNUNET_YES means that on 'put', the 'key' does not have
- *                         to be copied as the destination of the pointer is 
+ *                         to be copied as the destination of the pointer is
  *                         guaranteed to be life as long as the value is stored in
- *                         the hashmap.  This can significantly reduce memory 
- *                         consumption, but of course is also a recipie for 
+ *                         the hashmap.  This can significantly reduce memory
+ *                         consumption, but of course is also a recipie for
  *                         heap corruption if the assumption is not true.  Only
  *                         use this if (1) memory use is important in this case and
  *                         (2) you have triple-checked that the invariant holds
@@ -893,7 +918,7 @@ GNUNET_CONTAINER_multipeermap_destroy (struct GNUNET_CONTAINER_MultiPeerMap *map
  *   key-value pairs with value NULL
  */
 void *
-GNUNET_CONTAINER_multipeermap_get (const struct GNUNET_CONTAINER_MultiPeerMap *map, 
+GNUNET_CONTAINER_multipeermap_get (const struct GNUNET_CONTAINER_MultiPeerMap *map,
                                    const struct GNUNET_PeerIdentity *key);
 
 
@@ -911,7 +936,7 @@ GNUNET_CONTAINER_multipeermap_get (const struct GNUNET_CONTAINER_MultiPeerMap *m
  */
 int
 GNUNET_CONTAINER_multipeermap_remove (struct GNUNET_CONTAINER_MultiPeerMap *map,
-                                      const struct GNUNET_PeerIdentity * key, 
+                                      const struct GNUNET_PeerIdentity * key,
                                      const void *value);
 
 /**
@@ -924,7 +949,7 @@ GNUNET_CONTAINER_multipeermap_remove (struct GNUNET_CONTAINER_MultiPeerMap *map,
  * @return number of values removed
  */
 int
-GNUNET_CONTAINER_multipeermap_remove_all (struct GNUNET_CONTAINER_MultiPeerMap *map, 
+GNUNET_CONTAINER_multipeermap_remove_all (struct GNUNET_CONTAINER_MultiPeerMap *map,
                                           const struct GNUNET_PeerIdentity *key);
 
 
@@ -955,7 +980,7 @@ GNUNET_CONTAINER_multipeermap_contains (const struct GNUNET_CONTAINER_MultiPeerM
  *         #GNUNET_NO if not
  */
 int
-GNUNET_CONTAINER_multipeermap_contains_value (const struct GNUNET_CONTAINER_MultiPeerMap *map, 
+GNUNET_CONTAINER_multipeermap_contains_value (const struct GNUNET_CONTAINER_MultiPeerMap *map,
                                               const struct GNUNET_PeerIdentity * key,
                                               const void *value);
 
@@ -975,7 +1000,7 @@ GNUNET_CONTAINER_multipeermap_contains_value (const struct GNUNET_CONTAINER_Mult
  */
 int
 GNUNET_CONTAINER_multipeermap_put (struct GNUNET_CONTAINER_MultiPeerMap *map,
-                                   const struct GNUNET_PeerIdentity *key, 
+                                   const struct GNUNET_PeerIdentity *key,
                                    void *value,
                                    enum GNUNET_CONTAINER_MultiHashMapOption opt);
 
@@ -1007,6 +1032,7 @@ GNUNET_CONTAINER_multipeermap_iterate (const struct GNUNET_CONTAINER_MultiPeerMa
                                        void *it_cls);
 
 
+struct GNUNET_CONTAINER_MultiPeerMapIterator;
 /**
  * @ingroup hashmap
  * Create an iterator for a multihashmap.
@@ -1025,7 +1051,7 @@ GNUNET_CONTAINER_multipeermap_iterator_create (const struct GNUNET_CONTAINER_Mul
 
 
 /**
- * @ingroup hashmap 
+ * @ingroup hashmap
  * Retrieve the next element from the hash map at the iterator's
  * position.  If there are no elements left, #GNUNET_NO is returned,
  * and @a key and @a value are not modified.  This operation is only
@@ -1041,12 +1067,12 @@ GNUNET_CONTAINER_multipeermap_iterator_create (const struct GNUNET_CONTAINER_Mul
  */
 int
 GNUNET_CONTAINER_multipeermap_iterator_next (struct GNUNET_CONTAINER_MultiPeerMapIterator *iter,
-                                             struct GNUNET_PeerIdentity *key, 
+                                             struct GNUNET_PeerIdentity *key,
                                              const void **value);
 
 
 /**
- * @ingroup hashmap 
+ * @ingroup hashmap
  * Destroy a multipeermap iterator.
  *
  * @param iter the iterator to destroy
@@ -1056,7 +1082,7 @@ GNUNET_CONTAINER_multipeermap_iterator_destroy (struct GNUNET_CONTAINER_MultiPee
 
 
 /**
- * @ingroup hashmap 
+ * @ingroup hashmap
  * Iterate over all entries in the map that match a particular key.
  *
  * @param map the map
@@ -1077,14 +1103,22 @@ GNUNET_CONTAINER_multipeermap_get_multiple (const struct GNUNET_CONTAINER_MultiP
 /* Version of multihashmap with 32 bit keys */
 
 /**
- * @ingroup hashmap 
+ * @ingroup hashmap
  * Opaque handle for the 32-bit key HashMap.
  */
 struct GNUNET_CONTAINER_MultiHashMap32;
 
 
 /**
- * @ingroup hashmap 
+ * @ingroup hashmap
+ * Opaque handle to an iterator over
+ * a 32-bit key multihashmap.
+ */
+struct GNUNET_CONTAINER_MultiHashMap32Iterator;
+
+
+/**
+ * @ingroup hashmap
  * Iterator over hash map entries.
  *
  * @param cls closure
@@ -1100,7 +1134,7 @@ typedef int (*GNUNET_CONTAINER_HashMapIterator32) (void *cls,
 
 
 /**
- * @ingroup hashmap 
+ * @ingroup hashmap
  * Create a 32-bit key multi hash map.
  *
  * @param len initial size (map will grow as needed)
@@ -1111,7 +1145,7 @@ GNUNET_CONTAINER_multihashmap32_create (unsigned int len);
 
 
 /**
- * @ingroup hashmap 
+ * @ingroup hashmap
  * Destroy a 32-bit key hash map.  Will not free any values
  * stored in the hash map!
  *
@@ -1123,7 +1157,7 @@ GNUNET_CONTAINER_multihashmap32_destroy (struct GNUNET_CONTAINER_MultiHashMap32
 
 
 /**
- * @ingroup hashmap 
+ * @ingroup hashmap
  * Get the number of key-value pairs in the map.
  *
  * @param map the map
@@ -1135,7 +1169,7 @@ GNUNET_CONTAINER_multihashmap32_size (const struct
 
 
 /**
- * @ingroup hashmap 
+ * @ingroup hashmap
  * Given a key find a value in the map matching the key.
  *
  * @param map the map
@@ -1146,13 +1180,13 @@ GNUNET_CONTAINER_multihashmap32_size (const struct
  *   key-value pairs with value NULL
  */
 void *
-GNUNET_CONTAINER_multihashmap32_get (const struct 
+GNUNET_CONTAINER_multihashmap32_get (const struct
                                      GNUNET_CONTAINER_MultiHashMap32 *map,
                                      uint32_t key);
 
 
 /**
- * @ingroup hashmap 
+ * @ingroup hashmap
  * Iterate over all entries in the map.
  *
  * @param map the map
@@ -1169,7 +1203,7 @@ GNUNET_CONTAINER_multihashmap32_iterate (const struct
 
 
 /**
- * @ingroup hashmap 
+ * @ingroup hashmap
  * Remove the given key-value pair from the map.  Note that if the
  * key-value pair is in the map multiple times, only one of the pairs
  * will be removed.
@@ -1182,12 +1216,12 @@ GNUNET_CONTAINER_multihashmap32_iterate (const struct
  */
 int
 GNUNET_CONTAINER_multihashmap32_remove (struct GNUNET_CONTAINER_MultiHashMap32 *map,
-                                        uint32_t key, 
+                                        uint32_t key,
                                        const void *value);
 
 
 /**
- * @ingroup hashmap 
+ * @ingroup hashmap
  * Remove all entries for the given key from the map.
  * Note that the values would not be "freed".
  *
@@ -1201,7 +1235,7 @@ GNUNET_CONTAINER_multihashmap32_remove_all (struct GNUNET_CONTAINER_MultiHashMap
 
 
 /**
- * @ingroup hashmap 
+ * @ingroup hashmap
  * Check if the map contains any value under the given
  * key (including values that are NULL).
  *
@@ -1216,7 +1250,7 @@ GNUNET_CONTAINER_multihashmap32_contains (const struct GNUNET_CONTAINER_MultiHas
 
 
 /**
- * @ingroup hashmap 
+ * @ingroup hashmap
  * Check if the map contains the given value under the given
  * key.
  *
@@ -1227,13 +1261,13 @@ GNUNET_CONTAINER_multihashmap32_contains (const struct GNUNET_CONTAINER_MultiHas
  *         #GNUNET_NO if not
  */
 int
-GNUNET_CONTAINER_multihashmap32_contains_value (const struct GNUNET_CONTAINER_MultiHashMap32 *map, 
+GNUNET_CONTAINER_multihashmap32_contains_value (const struct GNUNET_CONTAINER_MultiHashMap32 *map,
                                                 uint32_t key,
                                                 const void *value);
 
 
 /**
- * @ingroup hashmap 
+ * @ingroup hashmap
  * Store a key-value pair in the map.
  *
  * @param map the map
@@ -1246,14 +1280,14 @@ GNUNET_CONTAINER_multihashmap32_contains_value (const struct GNUNET_CONTAINER_Mu
  *                       value already exists
  */
 int
-GNUNET_CONTAINER_multihashmap32_put (struct GNUNET_CONTAINER_MultiHashMap32 *map, 
-                                     uint32_t key, 
+GNUNET_CONTAINER_multihashmap32_put (struct GNUNET_CONTAINER_MultiHashMap32 *map,
+                                     uint32_t key,
                                      void *value,
                                      enum GNUNET_CONTAINER_MultiHashMapOption opt);
 
 
 /**
- * @ingroup hashmap 
+ * @ingroup hashmap
  * Iterate over all entries in the map that match a particular key.
  *
  * @param map the map
@@ -1264,19 +1298,62 @@ GNUNET_CONTAINER_multihashmap32_put (struct GNUNET_CONTAINER_MultiHashMap32 *map
  *         #GNUNET_SYSERR if it aborted iteration
  */
 int
-GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_MultiHashMap32 *map, 
+GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_MultiHashMap32 *map,
                                               uint32_t key,
                                               GNUNET_CONTAINER_HashMapIterator32 it,
                                               void *it_cls);
 
 
+/**
+ * Create an iterator for a 32-bit multihashmap.
+ * The iterator can be used to retrieve all the elements in the multihashmap
+ * one by one, without having to handle all elements at once (in contrast to
+ * #GNUNET_CONTAINER_multihashmap32_iterate).  Note that the iterator can not be
+ * used anymore if elements have been removed from 'map' after the creation of
+ * the iterator, or 'map' has been destroyed.  Adding elements to 'map' may
+ * result in skipped or repeated elements.
+ *
+ * @param map the map to create an iterator for
+ * @return an iterator over the given multihashmap map
+ */
+struct GNUNET_CONTAINER_MultiHashMap32Iterator *
+GNUNET_CONTAINER_multihashmap32_iterator_create (const struct GNUNET_CONTAINER_MultiHashMap32 *map);
+
+
+/**
+ * Retrieve the next element from the hash map at the iterator's position.
+ * If there are no elements left, GNUNET_NO is returned, and 'key' and 'value'
+ * are not modified.
+ * This operation is only allowed if no elements have been removed from the
+ * multihashmap since the creation of 'iter', and the map has not been destroyed.
+ * Adding elements may result in repeating or skipping elements.
+ *
+ * @param iter the iterator to get the next element from
+ * @param key pointer to store the key in, can be NULL
+ * @param value pointer to store the value in, can be NULL
+ * @return #GNUNET_YES we returned an element,
+ *         #GNUNET_NO if we are out of elements
+ */
+int
+GNUNET_CONTAINER_multihashmap32_iterator_next (struct GNUNET_CONTAINER_MultiHashMap32Iterator *iter,
+                                               uint32_t *key,
+                                               const void **value);
+
+
+/**
+ * Destroy a 32-bit multihashmap iterator.
+ *
+ * @param iter the iterator to destroy
+ */
+void
+GNUNET_CONTAINER_multihashmap32_iterator_destroy (struct GNUNET_CONTAINER_MultiHashMapIterator *iter);
 
 
 /* ******************** doubly-linked list *************** */
 /* To avoid mistakes: head->prev == tail->next == NULL     */
 
 /**
- * @ingroup dll 
+ * @ingroup dll
  * Insert an element at the head of a DLL. Assumes that head, tail and
  * element are structs with prev and next fields.
  *
@@ -1297,7 +1374,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_Mult
 
 
 /**
- * @ingroup dll 
+ * @ingroup dll
  * Insert an element at the tail of a DLL. Assumes that head, tail and
  * element are structs with prev and next fields.
  *
@@ -1318,7 +1395,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_Mult
 
 
 /**
- * @ingroup dll 
+ * @ingroup dll
  * Insert an element into a DLL after the given other element.  Insert
  * at the head if the other element is NULL.
  *
@@ -1348,7 +1425,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_Mult
 
 
 /**
- * @ingroup dll 
+ * @ingroup dll
  * Insert an element into a DLL before the given other element.  Insert
  * at the tail if the other element is NULL.
  *
@@ -1378,7 +1455,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_Mult
 
 
 /**
- * @ingroup dll 
+ * @ingroup dll
  * Remove an element from a DLL. Assumes that head, tail and
  * element point to structs with prev and next fields.
  *
@@ -1410,7 +1487,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_Mult
    in multiple lists at the same time *********************** */
 
 /**
- * @ingroup dll 
+ * @ingroup dll
  * Insert an element at the head of a MDLL. Assumes that head, tail and
  * element are structs with prev and next fields.
  *
@@ -1432,7 +1509,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_Mult
 
 
 /**
- * @ingroup dll 
+ * @ingroup dll
  * Insert an element at the tail of a MDLL. Assumes that head, tail and
  * element are structs with prev and next fields.
  *
@@ -1454,7 +1531,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_Mult
 
 
 /**
- * @ingroup dll 
+ * @ingroup dll
  * Insert an element into a MDLL after the given other element.  Insert
  * at the head if the other element is NULL.
  *
@@ -1485,7 +1562,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_Mult
 
 
 /**
- * @ingroup dll 
+ * @ingroup dll
  * Insert an element into a MDLL before the given other element.  Insert
  * at the tail if the other element is NULL.
  *
@@ -1516,7 +1593,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct GNUNET_CONTAINER_Mult
 
 
 /**
- * @ingroup dll 
+ * @ingroup dll
  * Remove an element from a MDLL. Assumes
  * that head, tail and element are structs
  * with prev and next fields.
@@ -1610,15 +1687,30 @@ GNUNET_CONTAINER_heap_destroy (struct GNUNET_CONTAINER_Heap *heap);
 
 /**
  * @ingroup heap
- * Get element stored at root of heap.
+ * Get element stored at the root of @a heap.
  *
- * @param heap heap to inspect
- * @return NULL if heap is empty
+ * @param heap  Heap to inspect.
+ * @return Element at the root, or NULL if heap is empty.
  */
 void *
 GNUNET_CONTAINER_heap_peek (const struct GNUNET_CONTAINER_Heap *heap);
 
 
+/**
+ * Get @a element and @a cost stored at the root of @a heap.
+ *
+ * @param[in]  heap     Heap to inspect.
+ * @param[out] element  Root element is returned here.
+ * @param[out] cost     Cost of @a element is returned here.
+ * @return #GNUNET_YES if an element is returned,
+ *         #GNUNET_NO  if the heap is empty.
+ */
+int
+GNUNET_CONTAINER_heap_peek2 (const struct GNUNET_CONTAINER_Heap *heap,
+                             void **element,
+                             GNUNET_CONTAINER_HeapCostType *cost);
+
+
 /**
  * @ingroup heap
  * Get the current size of the heap
@@ -1738,250 +1830,6 @@ GNUNET_CONTAINER_heap_update_cost (struct GNUNET_CONTAINER_Heap *heap,
                                    GNUNET_CONTAINER_HeapCostType new_cost);
 
 
-/* ******************** Singly linked list *************** */
-
-/**
- * Possible ways for how data stored in the linked list
- * might be allocated.
- * @deprecated use DLL macros
- */
-enum GNUNET_CONTAINER_SListDisposition
-{
-  /**
-   * Single-linked list must copy the buffer.
-   * @deprecated use DLL macros
-   */
-  GNUNET_CONTAINER_SLIST_DISPOSITION_TRANSIENT = 0,
-
-  /**
-   * Data is static, no need to copy or free.
-   * @deprecated use DLL macros
-   */
-  GNUNET_CONTAINER_SLIST_DISPOSITION_STATIC = 2,
-
-  /**
-   * Data is dynamic, do not copy but free when done.
-   * @deprecated use DLL macros
-   */
-  GNUNET_CONTAINER_SLIST_DISPOSITION_DYNAMIC = 4
-};
-
-
-
-/**
- * Handle to a singly linked list
- * @deprecated use DLL macros
- */
-struct GNUNET_CONTAINER_SList;
-
-/**
- * Handle to a singly linked list iterator
- * @deprecated use DLL macros
- */
-struct GNUNET_CONTAINER_SList_Iterator
-{
-  /**
-   * Linked list that we are iterating over.
-   */
-  struct GNUNET_CONTAINER_SList *list;
-
-  /**
-   * Last element accessed.
-   */
-  struct GNUNET_CONTAINER_SList_Elem *last;
-
-  /**
-   * Current list element.
-   */
-  struct GNUNET_CONTAINER_SList_Elem *elem;
-};
-
-
-
-/**
- * Add a new element to the list
- * @param l list
- * @param disp memory disposition
- * @param buf payload buffer
- * @param len length of the buffer
- * @deprecated use DLL macros
- */
-void
-GNUNET_CONTAINER_slist_add (struct GNUNET_CONTAINER_SList *l,
-                            enum GNUNET_CONTAINER_SListDisposition disp,
-                            const void *buf, size_t len);
-
-
-/**
- * Add a new element to the end of the list
- * @param l list
- * @param disp memory disposition
- * @param buf payload buffer
- * @param len length of the buffer
- * @deprecated use DLL macros
- */
-void
-GNUNET_CONTAINER_slist_add_end (struct GNUNET_CONTAINER_SList *l,
-                                enum GNUNET_CONTAINER_SListDisposition disp,
-                                const void *buf, size_t len);
-
-
-/**
- * Append a singly linked list to another
- * @param dst list to append to
- * @param src source
- * @deprecated use DLL macros
- */
-void
-GNUNET_CONTAINER_slist_append (struct GNUNET_CONTAINER_SList *dst,
-                               struct GNUNET_CONTAINER_SList *src);
-
-
-/**
- * Create a new singly linked list
- * @return the new list
- * @deprecated use DLL macros
- */
-struct GNUNET_CONTAINER_SList *
-GNUNET_CONTAINER_slist_create (void);
-
-
-/**
- * Destroy a singly linked list
- * @param l the list to be destroyed
- * @deprecated use DLL macros
- */
-void
-GNUNET_CONTAINER_slist_destroy (struct GNUNET_CONTAINER_SList *l);
-
-
-/**
- * Return the beginning of a list
- *
- * @param l list
- * @return iterator pointing to the beginning (by value! Either allocate the
- *   structure on the stack, or use GNUNET_malloc() yourself! All other
- *   functions do take pointer to this struct though)
- * @deprecated use DLL macros
- */
-struct GNUNET_CONTAINER_SList_Iterator
-GNUNET_CONTAINER_slist_begin (struct GNUNET_CONTAINER_SList *l);
-
-
-/**
- * Clear a list
- *
- * @param l list
- * @deprecated use DLL macros
- */
-void
-GNUNET_CONTAINER_slist_clear (struct GNUNET_CONTAINER_SList *l);
-
-
-/**
- * Check if a list contains a certain element
- * @param l list
- * @param buf payload buffer to find
- * @param len length of the payload (number of bytes in buf)
- * @return GNUNET_YES if found, GNUNET_NO otherwise
- * @deprecated use DLL macros
- */
-int
-GNUNET_CONTAINER_slist_contains (const struct GNUNET_CONTAINER_SList *l,
-                                 const void *buf, size_t len);
-
-/**
- * Check if a list contains a certain element using 'compare' function
- *
- * @param l list
- * @param buf payload buffer to find
- * @param len length of the payload (number of bytes in buf)
- * @param compare comparison function
- *
- * @return NULL if the 'buf' could not be found, pointer to the
- *         list element, if found
- * @deprecated use DLL macros
- */
-void *
-GNUNET_CONTAINER_slist_contains2 (const struct GNUNET_CONTAINER_SList *l,
-                                  const void *buf, size_t len,
-                                  int (*compare)(const void *, const size_t, const void *, const size_t));
-/**
- * Count the elements of a list
- * @param l list
- * @return number of elements in the list
- * @deprecated use DLL macros
- */
-int
-GNUNET_CONTAINER_slist_count (const struct GNUNET_CONTAINER_SList *l);
-
-
-/**
- * Remove an element from the list
- * @param i iterator that points to the element to be removed
- * @deprecated use DLL macros
- */
-void
-GNUNET_CONTAINER_slist_erase (struct GNUNET_CONTAINER_SList_Iterator *i);
-
-
-/**
- * Insert an element into a list at a specific position
- * @param before where to insert the new element
- * @param disp memory disposition
- * @param buf payload buffer
- * @param len length of the payload
- * @deprecated use DLL macros
- */
-void
-GNUNET_CONTAINER_slist_insert (struct GNUNET_CONTAINER_SList_Iterator *before,
-                               enum GNUNET_CONTAINER_SListDisposition disp,
-                               const void *buf, size_t len);
-
-
-/**
- * Advance an iterator to the next element
- * @param i iterator
- * @return GNUNET_YES on success, GNUNET_NO if the end has been reached
- * @deprecated use DLL macros
- */
-int
-GNUNET_CONTAINER_slist_next (struct GNUNET_CONTAINER_SList_Iterator *i);
-
-
-/**
- * Check if an iterator points beyond the end of a list
- * @param i iterator
- * @return GNUNET_YES if the end has been reached, GNUNET_NO if the iterator
- *         points to a valid element
- * @deprecated use DLL macros
- */
-int
-GNUNET_CONTAINER_slist_end (struct GNUNET_CONTAINER_SList_Iterator *i);
-
-
-/**
- * Retrieve the element at a specific position in a list
- *
- * @param i iterator
- * @param len set to the payload length
- * @return payload
- * @deprecated use DLL macros
- */
-void *
-GNUNET_CONTAINER_slist_get (const struct GNUNET_CONTAINER_SList_Iterator *i,
-                            size_t *len);
-
-
-/**
- * Release an iterator
- * @param i iterator
- * @deprecated use DLL macros
- */
-void
-GNUNET_CONTAINER_slist_iter_destroy (struct GNUNET_CONTAINER_SList_Iterator *i);
-
-
 #if 0                           /* keep Emacsens' auto-indent happy */
 {
 #endif