+typedef int (*Comparator)(const void *, size_t, const void *, size_t);
+
+/**
+ * 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)
+ * @param compare comparison function, should return 0 if compared elements match
+ *
+ * @return NULL if the 'buf' could not be found, pointer to the
+ * list element, if found
+ */
+void *
+GNUNET_CONTAINER_slist_contains2 (const struct GNUNET_CONTAINER_SList *l,
+ const void *buf, size_t len,
+ Comparator compare)
+{
+ struct GNUNET_CONTAINER_SList_Elem *e;
+
+ for (e = l->head; e != NULL; e = e->next)
+ if ((e->len == len) && (*compare)(buf, len, e->elem, e->len) == 0)
+ return e->elem;
+ return NULL;
+}
+