-avoid 'hu', as it is unsigned short, not uint16_t
[oweals/gnunet.git] / src / include / gnunet_container_lib.h
index 6e782871a4be83d96eae2d8010718a9c11a21d47..1aa3ad00e16177087a20c75347e4a31793a34276 100644 (file)
@@ -61,14 +61,14 @@ 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,
+typedef int (*GNUNET_CONTAINER_HashCodeIterator) (void *cls,
                                         struct GNUNET_HashCode *next);
 
 
@@ -185,6 +185,15 @@ 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.
@@ -251,7 +260,7 @@ GNUNET_CONTAINER_bloomfilter_or2 (struct GNUNET_CONTAINER_BloomFilter *bf,
  */
 void
 GNUNET_CONTAINER_bloomfilter_resize (struct GNUNET_CONTAINER_BloomFilter *bf,
-                                     GNUNET_HashCodeIterator iterator,
+                                     GNUNET_CONTAINER_HashCodeIterator iterator,
                                      void *iterator_cls, size_t size,
                                      unsigned int k);
 
@@ -728,7 +737,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);
 
@@ -846,6 +856,7 @@ typedef int (*GNUNET_CONTAINER_PeerMapIterator) (void *cls,
                                                  void *value);
 
 
+struct GNUNET_CONTAINER_MultiPeerMap;
 /**
  * @ingroup hashmap
  * Create a multi peer map (hash map for public keys of peers).
@@ -1004,6 +1015,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.
@@ -1658,15 +1670,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
@@ -1814,6 +1841,7 @@ enum GNUNET_CONTAINER_SListDisposition
   GNUNET_CONTAINER_SLIST_DISPOSITION_DYNAMIC = 4
 };
 
+struct GNUNET_CONTAINER_SList_Elem;
 
 
 /**