const GNUNET_HashCode * key);
+/**
+ * Check if the map contains the given value under the given
+ * key.
+ *
+ * @param map the map
+ * @param key the key to test if a value exists for it
+ * @param value value to test for
+ * @return GNUNET_YES if such a value exists,
+ * GNUNET_NO if not
+ */
+int GNUNET_CONTAINER_multihashmap_contains_value (const struct
+ GNUNET_CONTAINER_MultiHashMap
+ *map,
+ const GNUNET_HashCode * key,
+ const void *value);
+
+
/**
* Store a key-value pair in the map.
*
* @param element element to insert
*/
#define GNUNET_CONTAINER_DLL_insert(head,tail,element) do { \
+ GNUNET_assert ( ( (element)->prev == NULL) && ((head) != (element))); \
+ GNUNET_assert ( ( (element)->next == NULL) && ((tail) != (element))); \
(element)->next = (head); \
(element)->prev = NULL; \
if ((tail) == NULL) \
(head)->prev = element; \
(head) = (element); } while (0)
+
/**
* Insert an element at the tail of a DLL. Assumes that head, tail and
* element are structs with prev and next fields.
* @param element element to insert
*/
#define GNUNET_CONTAINER_DLL_insert_tail(head,tail,element) do { \
+ GNUNET_assert ( ( (element)->prev == NULL) && ((head) != (element))); \
+ GNUNET_assert ( ( (element)->next == NULL) && ((tail) != (element))); \
(element)->prev = (tail); \
(element)->next = NULL; \
if ((head) == NULL) \
(tail)->next = element; \
(tail) = (element); } while (0)
+
/**
* Insert an element into a DLL after the given other element. Insert
* at the head if the other element is NULL.
* @param element element to insert
*/
#define GNUNET_CONTAINER_DLL_insert_after(head,tail,other,element) do { \
+ GNUNET_assert ( ( (element)->prev == NULL) && ((head) != (element))); \
+ GNUNET_assert ( ( (element)->next == NULL) && ((tail) != (element))); \
(element)->prev = (other); \
if (NULL == other) \
{ \
else \
(element)->next->prev = (element); } while (0)
+
/**
* Insert an element into a DLL before the given other element. Insert
* at the tail if the other element is NULL.
* @param element element to insert
*/
#define GNUNET_CONTAINER_DLL_insert_before(head,tail,other,element) do { \
+ GNUNET_assert ( ( (element)->prev == NULL) && ((head) != (element))); \
+ GNUNET_assert ( ( (element)->next == NULL) && ((tail) != (element))); \
(element)->next = (other); \
if (NULL == other) \
{ \
* @param element element to remove
*/
#define GNUNET_CONTAINER_DLL_remove(head,tail,element) do { \
+ GNUNET_assert ( ( (element)->prev != NULL) || ((head) == (element))); \
+ GNUNET_assert ( ( (element)->next != NULL) || ((tail) == (element))); \
if ((element)->prev == NULL) \
(head) = (element)->next; \
else \