* @return GNUNET_YES if next was updated
* GNUNET_NO if there are no more entries
*/
-typedef int (*GNUNET_HashCodeIterator) (void *cls, GNUNET_HashCode * next);
+typedef int (*GNUNET_HashCodeIterator) (void *cls, struct GNUNET_HashCode * next);
/**
*
* @param filename the name of the file (or the prefix)
* @param size the size of the bloom-filter (number of
- * bytes of storage space to use)
+ * bytes of storage space to use); will be rounded up
+ * to next power of 2
* @param k the number of GNUNET_CRYPTO_hash-functions to apply per
* element (number of bits set per element in the set)
* @return the bloomfilter
*/
int
GNUNET_CONTAINER_bloomfilter_test (const struct GNUNET_CONTAINER_BloomFilter
- *bf, const GNUNET_HashCode * e);
+ *bf, const struct GNUNET_HashCode * e);
/**
*/
void
GNUNET_CONTAINER_bloomfilter_add (struct GNUNET_CONTAINER_BloomFilter *bf,
- const GNUNET_HashCode * e);
+ const struct GNUNET_HashCode * e);
/**
*/
void
GNUNET_CONTAINER_bloomfilter_remove (struct GNUNET_CONTAINER_BloomFilter *bf,
- const GNUNET_HashCode * e);
+ const struct GNUNET_HashCode * e);
/**
/**
* Create a fresh MetaData token.
- *
+ *
* @return empty meta-data container
*/
struct GNUNET_CONTAINER_MetaData *
/**
* Duplicate a MetaData token.
- *
+ *
* @param md what to duplicate
* @return duplicate meta-data container
*/
* used in the main libextractor library and yielding
* meta data).
* @param type libextractor-type describing the meta data
- * @param format basic format information about data
+ * @param format basic format information about data
* @param data_mime_type mime-type of data (not of the original file);
* can be NULL (if mime-type is not known)
* @param data actual meta-data found
- * @param data_len number of bytes in data
+ * @param data_size number of bytes in data
* @return GNUNET_OK on success, GNUNET_SYSERR if this entry already exists
* data_mime_type and plugin_name are not considered for "exists" checks
*/
enum EXTRACTOR_MetaType type,
enum EXTRACTOR_MetaFormat format,
const char *data_mime_type, const char *data,
- size_t data_len);
+ size_t data_size);
/**
* @param type type of the item to remove
* @param data specific value to remove, NULL to remove all
* entries of the given type
- * @param data_len number of bytes in data
+ * @param data_size number of bytes in data
* @return GNUNET_OK on success, GNUNET_SYSERR if the item does not exist in md
*/
int
GNUNET_CONTAINER_meta_data_delete (struct GNUNET_CONTAINER_MetaData *md,
enum EXTRACTOR_MetaType type,
- const char *data, size_t data_len);
+ const char *data, size_t data_size);
/**
* GNUNET_NO if not.
*/
typedef int (*GNUNET_CONTAINER_HashMapIterator) (void *cls,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
void *value);
*/
void *
GNUNET_CONTAINER_multihashmap_get (const struct GNUNET_CONTAINER_MultiHashMap
- *map, const GNUNET_HashCode * key);
+ *map, const struct GNUNET_HashCode * key);
/**
*/
int
GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap *map,
- const GNUNET_HashCode * key, void *value);
+ const struct GNUNET_HashCode * key, void *value);
/**
* Remove all entries for the given key from the map.
*/
int
GNUNET_CONTAINER_multihashmap_remove_all (struct GNUNET_CONTAINER_MultiHashMap
- *map, const GNUNET_HashCode * key);
+ *map, const struct GNUNET_HashCode * key);
/**
int
GNUNET_CONTAINER_multihashmap_contains (const struct
GNUNET_CONTAINER_MultiHashMap *map,
- const GNUNET_HashCode * key);
+ const struct GNUNET_HashCode * key);
/**
int
GNUNET_CONTAINER_multihashmap_contains_value (const struct
GNUNET_CONTAINER_MultiHashMap
- *map, const GNUNET_HashCode * key,
+ *map, const struct GNUNET_HashCode * key,
const void *value);
*/
int
GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map,
- const GNUNET_HashCode * key, void *value,
+ const struct GNUNET_HashCode * key, void *value,
enum GNUNET_CONTAINER_MultiHashMapOption
opt);
int
GNUNET_CONTAINER_multihashmap_get_multiple (const struct
GNUNET_CONTAINER_MultiHashMap *map,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
GNUNET_CONTAINER_HashMapIterator it,
void *it_cls);
/**
* Removes a node from the heap.
- *
+ *
* @param node node to remove
* @return element data stored at the node, NULL if heap is empty
*/
/**
- * Handle to a singly linked list
+ * Handle to a singly linked list
*/
struct GNUNET_CONTAINER_SList;
/**
- * Handle to a singly linked list iterator
+ * Handle to a singly linked list iterator
*/
-struct GNUNET_CONTAINER_SList_Iterator;
+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;
+};
+
/**
* Return the beginning of a list
*
* @param l list
- * @return iterator pointing to the beginning, free using "GNUNET_free"
+ * @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)
*/
-struct GNUNET_CONTAINER_SList_Iterator *
+struct GNUNET_CONTAINER_SList_Iterator
GNUNET_CONTAINER_slist_begin (struct GNUNET_CONTAINER_SList *l);
* @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
*/
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
+ */
+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