GNUnet  0.10.x
Macros | Typedefs | Enumerations | Functions
gnunet_container_lib.h File Reference
#include "gnunet_crypto_lib.h"
Include dependency graph for gnunet_container_lib.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME   180
 
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
 Insert an element at the head of a DLL. More...
 
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
 Insert an element at the tail of a DLL. More...
 
#define GNUNET_CONTAINER_DLL_insert_after(head, tail, other, element)
 Insert an element into a DLL after the given other element. More...
 
#define GNUNET_CONTAINER_DLL_insert_before(head, tail, other, element)
 Insert an element into a DLL before the given other element. More...
 
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
 Remove an element from a DLL. More...
 
#define GNUNET_CONTAINER_MDLL_insert(mdll, head, tail, element)
 Insert an element at the head of a MDLL. More...
 
#define GNUNET_CONTAINER_MDLL_insert_tail(mdll, head, tail, element)
 Insert an element at the tail of a MDLL. More...
 
#define GNUNET_CONTAINER_MDLL_insert_after(mdll, head, tail, other, element)
 Insert an element into a MDLL after the given other element. More...
 
#define GNUNET_CONTAINER_MDLL_insert_before(mdll, head, tail, other, element)
 Insert an element into a MDLL before the given other element. More...
 
#define GNUNET_CONTAINER_MDLL_remove(mdll, head, tail, element)
 Remove an element from a MDLL. More...
 
#define GNUNET_CONTAINER_DLL_insert_sorted(TYPE, comparator, comparator_cls, head, tail, element)
 Insertion sort of element into DLL from head to tail sorted by comparator. More...
 

Typedefs

typedef int(* EXTRACTOR_MetaDataProcessor) (void *cls, const char *plugin_name, enum EXTRACTOR_MetaType type, enum EXTRACTOR_MetaFormat format, const char *data_mime_type, const char *data, size_t data_len)
 Type of a function that libextractor calls for each meta data item found. More...
 
typedef int(* GNUNET_CONTAINER_HashCodeIterator) (void *cls, struct GNUNET_HashCode *next)
 Iterator over struct GNUNET_HashCode. More...
 
typedef int(* GNUNET_CONTAINER_MulitHashMapIteratorCallback) (void *cls, const struct GNUNET_HashCode *key, void *value)
 Iterator over hash map entries. More...
 
typedef int(* GNUNET_CONTAINER_PeerMapIterator) (void *cls, const struct GNUNET_PeerIdentity *key, void *value)
 Iterator over hash map entries. More...
 
typedef int(* GNUNET_CONTAINER_ShortmapIterator) (void *cls, const struct GNUNET_ShortHashCode *key, void *value)
 Iterator over hash map entries. More...
 
typedef int(* GNUNET_CONTAINER_MultiUuidmapIteratorCallback) (void *cls, const struct GNUNET_Uuid *key, void *value)
 Iterator over uuid map entries. More...
 
typedef int(* GNUNET_CONTAINER_MulitHashMapIterator32Callback) (void *cls, uint32_t key, void *value)
 Iterator over hash map entries. More...
 
typedef uint64_t GNUNET_CONTAINER_HeapCostType
 Cost by which elements in a heap can be ordered. More...
 
typedef int(* GNUNET_CONTAINER_HeapIterator) (void *cls, struct GNUNET_CONTAINER_HeapNode *node, void *element, GNUNET_CONTAINER_HeapCostType cost)
 Iterator for heap. More...
 

Enumerations

enum  EXTRACTOR_MetaType {
  EXTRACTOR_METATYPE_RESERVED = 0, EXTRACTOR_METATYPE_MIMETYPE = 1, EXTRACTOR_METATYPE_FILENAME = 2, EXTRACTOR_METATYPE_COMMENT = 3,
  EXTRACTOR_METATYPE_TITLE = 4, EXTRACTOR_METATYPE_BOOK_TITLE = 5, EXTRACTOR_METATYPE_JOURNAL_NAME = 8, EXTRACTOR_METATYPE_AUTHOR_NAME = 13,
  EXTRACTOR_METATYPE_PUBLICATION_DATE = 24, EXTRACTOR_METATYPE_URL = 29, EXTRACTOR_METATYPE_URI = 30, EXTRACTOR_METATYPE_ISRC = 31,
  EXTRACTOR_METATYPE_UNKNOWN = 45, EXTRACTOR_METATYPE_DESCRIPTION = 46, EXTRACTOR_METATYPE_KEYWORDS = 49, EXTRACTOR_METATYPE_SUBJECT = 52,
  EXTRACTOR_METATYPE_PACKAGE_NAME = 69, EXTRACTOR_METATYPE_THUMBNAIL = 114, EXTRACTOR_METATYPE_ALBUM = 129, EXTRACTOR_METATYPE_ARTIST = 130,
  EXTRACTOR_METATYPE_ORIGINAL_TITLE = 162, EXTRACTOR_METATYPE_GNUNET_FULL_DATA = 174, EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME = 180
}
 Enumeration defining various sources of keywords. More...
 
enum  EXTRACTOR_MetaFormat { EXTRACTOR_METAFORMAT_UNKNOWN = 0, EXTRACTOR_METAFORMAT_UTF8 = 1, EXTRACTOR_METAFORMAT_BINARY = 2, EXTRACTOR_METAFORMAT_C_STRING = 3 }
 Format in which the extracted meta data is presented. More...
 
enum  GNUNET_CONTAINER_MetaDataSerializationOptions { GNUNET_CONTAINER_META_DATA_SERIALIZE_FULL = 0, GNUNET_CONTAINER_META_DATA_SERIALIZE_PART = 1, GNUNET_CONTAINER_META_DATA_SERIALIZE_NO_COMPRESS = 2 }
 Options for metadata serialization. More...
 
enum  GNUNET_CONTAINER_MultiHashMapOption { GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST }
 Options for storing values in the HashMap. More...
 
enum  GNUNET_CONTAINER_HeapOrder { GNUNET_CONTAINER_HEAP_ORDER_MAX, GNUNET_CONTAINER_HEAP_ORDER_MIN }
 Heap type, either max or min. More...
 

Functions

int GNUNET_try_compression (const char *data, size_t old_size, char **result, size_t *new_size)
 Try to compress the given block of data using libz. More...
 
char * GNUNET_decompress (const char *input, size_t input_size, size_t output_size)
 Decompress input, return the decompressed data as output. More...
 
struct GNUNET_CONTAINER_BloomFilterGNUNET_CONTAINER_bloomfilter_load (const char *filename, size_t size, unsigned int k)
 Load a Bloom filter from a file. More...
 
struct GNUNET_CONTAINER_BloomFilterGNUNET_CONTAINER_bloomfilter_init (const char *data, size_t size, unsigned int k)
 Create a Bloom filter from raw bits. More...
 
int GNUNET_CONTAINER_bloomfilter_get_raw_data (const struct GNUNET_CONTAINER_BloomFilter *bf, char *data, size_t size)
 Copy the raw data of this Bloom filter into the given data array. More...
 
int GNUNET_CONTAINER_bloomfilter_test (const struct GNUNET_CONTAINER_BloomFilter *bf, const struct GNUNET_HashCode *e)
 Test if an element is in the filter. More...
 
void GNUNET_CONTAINER_bloomfilter_add (struct GNUNET_CONTAINER_BloomFilter *bf, const struct GNUNET_HashCode *e)
 Add an element to the filter. More...
 
void GNUNET_CONTAINER_bloomfilter_remove (struct GNUNET_CONTAINER_BloomFilter *bf, const struct GNUNET_HashCode *e)
 Remove an element from the filter. More...
 
struct GNUNET_CONTAINER_BloomFilterGNUNET_CONTAINER_bloomfilter_copy (const struct GNUNET_CONTAINER_BloomFilter *bf)
 Create a copy of a bloomfilter. More...
 
void GNUNET_CONTAINER_bloomfilter_free (struct GNUNET_CONTAINER_BloomFilter *bf)
 Free the space associcated with a filter in memory, flush to drive if needed (do not free the space on the drive). More...
 
size_t GNUNET_CONTAINER_bloomfilter_get_element_addresses (const struct GNUNET_CONTAINER_BloomFilter *bf)
 Get the number of the addresses set per element in the bloom filter. More...
 
size_t GNUNET_CONTAINER_bloomfilter_get_size (const struct GNUNET_CONTAINER_BloomFilter *bf)
 Get size of the bloom filter. More...
 
void GNUNET_CONTAINER_bloomfilter_clear (struct GNUNET_CONTAINER_BloomFilter *bf)
 Reset a Bloom filter to empty. More...
 
int GNUNET_CONTAINER_bloomfilter_or (struct GNUNET_CONTAINER_BloomFilter *bf, const char *data, size_t size)
 "or" the entries of the given raw data array with the data of the given Bloom filter. More...
 
int GNUNET_CONTAINER_bloomfilter_or2 (struct GNUNET_CONTAINER_BloomFilter *bf, const struct GNUNET_CONTAINER_BloomFilter *to_or)
 "or" the entries of the given raw data array with the data of the given Bloom filter. More...
 
void GNUNET_CONTAINER_bloomfilter_resize (struct GNUNET_CONTAINER_BloomFilter *bf, GNUNET_CONTAINER_HashCodeIterator iterator, void *iterator_cls, size_t size, unsigned int k)
 Resize a bloom filter. More...
 
struct GNUNET_CONTAINER_MetaDataGNUNET_CONTAINER_meta_data_create (void)
 Create a fresh meta data container. More...
 
struct GNUNET_CONTAINER_MetaDataGNUNET_CONTAINER_meta_data_duplicate (const struct GNUNET_CONTAINER_MetaData *md)
 Duplicate a MetaData token. More...
 
void GNUNET_CONTAINER_meta_data_destroy (struct GNUNET_CONTAINER_MetaData *md)
 Free meta data. More...
 
int GNUNET_CONTAINER_meta_data_test_equal (const struct GNUNET_CONTAINER_MetaData *md1, const struct GNUNET_CONTAINER_MetaData *md2)
 Test if two MDs are equal. More...
 
int 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, size_t data_size)
 Extend metadata. More...
 
void GNUNET_CONTAINER_meta_data_merge (struct GNUNET_CONTAINER_MetaData *md, const struct GNUNET_CONTAINER_MetaData *in)
 Extend metadata. More...
 
int GNUNET_CONTAINER_meta_data_delete (struct GNUNET_CONTAINER_MetaData *md, enum EXTRACTOR_MetaType type, const char *data, size_t data_size)
 Remove an item. More...
 
void GNUNET_CONTAINER_meta_data_clear (struct GNUNET_CONTAINER_MetaData *md)
 Remove all items in the container. More...
 
void GNUNET_CONTAINER_meta_data_add_publication_date (struct GNUNET_CONTAINER_MetaData *md)
 Add the current time as the publication date to the meta-data. More...
 
int GNUNET_CONTAINER_meta_data_iterate (const struct GNUNET_CONTAINER_MetaData *md, EXTRACTOR_MetaDataProcessor iter, void *iter_cls)
 Iterate over MD entries. More...
 
char * GNUNET_CONTAINER_meta_data_get_by_type (const struct GNUNET_CONTAINER_MetaData *md, enum EXTRACTOR_MetaType type)
 Get the first MD entry of the given type. More...
 
char * GNUNET_CONTAINER_meta_data_get_first_by_types (const struct GNUNET_CONTAINER_MetaData *md,...)
 Get the first matching MD entry of the given types. More...
 
size_t GNUNET_CONTAINER_meta_data_get_thumbnail (const struct GNUNET_CONTAINER_MetaData *md, unsigned char **thumb)
 Get a thumbnail from the meta-data (if present). More...
 
ssize_t GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData *md, char **target, size_t max, enum GNUNET_CONTAINER_MetaDataSerializationOptions opt)
 Serialize meta-data to target. More...
 
ssize_t GNUNET_CONTAINER_meta_data_get_serialized_size (const struct GNUNET_CONTAINER_MetaData *md)
 Get the size of the full meta-data in serialized form. More...
 
struct GNUNET_CONTAINER_MetaDataGNUNET_CONTAINER_meta_data_deserialize (const char *input, size_t size)
 Deserialize meta-data. More...
 
struct GNUNET_CONTAINER_MultiHashMapGNUNET_CONTAINER_multihashmap_create (unsigned int len, int do_not_copy_keys)
 Create a multi hash map. More...
 
void GNUNET_CONTAINER_multihashmap_destroy (struct GNUNET_CONTAINER_MultiHashMap *map)
 Destroy a hash map. More...
 
void * GNUNET_CONTAINER_multihashmap_get (const struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key)
 Given a key find a value in the map matching the key. More...
 
int GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, const void *value)
 Remove the given key-value pair from the map. More...
 
int GNUNET_CONTAINER_multihashmap_remove_all (struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key)
 Remove all entries for the given key from the map. More...
 
unsigned int GNUNET_CONTAINER_multihashmap_clear (struct GNUNET_CONTAINER_MultiHashMap *map)
 Remove all entries from the map. More...
 
int GNUNET_CONTAINER_multihashmap_contains (const struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key)
 Check if the map contains any value under the given key (including values that are NULL). More...
 
int GNUNET_CONTAINER_multihashmap_contains_value (const struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, const void *value)
 Check if the map contains the given value under the given key. More...
 
int GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
 Store a key-value pair in the map. More...
 
unsigned int GNUNET_CONTAINER_multihashmap_size (const struct GNUNET_CONTAINER_MultiHashMap *map)
 Get the number of key-value pairs in the map. More...
 
int GNUNET_CONTAINER_multihashmap_iterate (struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MulitHashMapIteratorCallback it, void *it_cls)
 Iterate over all entries in the map. More...
 
struct GNUNET_CONTAINER_MultiHashMapIteratorGNUNET_CONTAINER_multihashmap_iterator_create (const struct GNUNET_CONTAINER_MultiHashMap *map)
 Create an iterator for a multihashmap. More...
 
int GNUNET_CONTAINER_multihashmap_iterator_next (struct GNUNET_CONTAINER_MultiHashMapIterator *iter, struct GNUNET_HashCode *key, const void **value)
 Retrieve the next element from the hash map at the iterator's position. More...
 
void GNUNET_CONTAINER_multihashmap_iterator_destroy (struct GNUNET_CONTAINER_MultiHashMapIterator *iter)
 Destroy a multihashmap iterator. More...
 
int GNUNET_CONTAINER_multihashmap_get_multiple (struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, GNUNET_CONTAINER_MulitHashMapIteratorCallback it, void *it_cls)
 Iterate over all entries in the map that match a particular key. More...
 
unsigned int GNUNET_CONTAINER_multihashmap_get_random (const struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MulitHashMapIteratorCallback it, void *it_cls)
 Call it on a random value from the map, or not at all if the map is empty. More...
 
struct GNUNET_CONTAINER_MultiPeerMapGNUNET_CONTAINER_multipeermap_create (unsigned int len, int do_not_copy_keys)
 Create a multi peer map (hash map for public keys of peers). More...
 
void GNUNET_CONTAINER_multipeermap_destroy (struct GNUNET_CONTAINER_MultiPeerMap *map)
 Destroy a hash map. More...
 
void * GNUNET_CONTAINER_multipeermap_get (const struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key)
 Given a key find a value in the map matching the key. More...
 
int GNUNET_CONTAINER_multipeermap_remove (struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, const void *value)
 Remove the given key-value pair from the map. More...
 
int GNUNET_CONTAINER_multipeermap_remove_all (struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key)
 Remove all entries for the given key from the map. More...
 
int GNUNET_CONTAINER_multipeermap_contains (const struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key)
 Check if the map contains any value under the given key (including values that are NULL). More...
 
int GNUNET_CONTAINER_multipeermap_contains_value (const struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, const void *value)
 Check if the map contains the given value under the given key. More...
 
int GNUNET_CONTAINER_multipeermap_put (struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
 Store a key-value pair in the map. More...
 
unsigned int GNUNET_CONTAINER_multipeermap_size (const struct GNUNET_CONTAINER_MultiPeerMap *map)
 Get the number of key-value pairs in the map. More...
 
int GNUNET_CONTAINER_multipeermap_iterate (struct GNUNET_CONTAINER_MultiPeerMap *map, GNUNET_CONTAINER_PeerMapIterator it, void *it_cls)
 Iterate over all entries in the map. More...
 
struct GNUNET_CONTAINER_MultiPeerMapIteratorGNUNET_CONTAINER_multipeermap_iterator_create (const struct GNUNET_CONTAINER_MultiPeerMap *map)
 Create an iterator for a multihashmap. More...
 
int GNUNET_CONTAINER_multipeermap_iterator_next (struct GNUNET_CONTAINER_MultiPeerMapIterator *iter, struct GNUNET_PeerIdentity *key, const void **value)
 Retrieve the next element from the hash map at the iterator's position. More...
 
void GNUNET_CONTAINER_multipeermap_iterator_destroy (struct GNUNET_CONTAINER_MultiPeerMapIterator *iter)
 Destroy a multipeermap iterator. More...
 
int GNUNET_CONTAINER_multipeermap_get_multiple (struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, GNUNET_CONTAINER_PeerMapIterator it, void *it_cls)
 Iterate over all entries in the map that match a particular key. More...
 
unsigned int GNUNET_CONTAINER_multipeermap_get_random (const struct GNUNET_CONTAINER_MultiPeerMap *map, GNUNET_CONTAINER_PeerMapIterator it, void *it_cls)
 Call it on a random value from the map, or not at all if the map is empty. More...
 
struct GNUNET_CONTAINER_MultiShortmapGNUNET_CONTAINER_multishortmap_create (unsigned int len, int do_not_copy_keys)
 Create a multi peer map (hash map for public keys of peers). More...
 
void GNUNET_CONTAINER_multishortmap_destroy (struct GNUNET_CONTAINER_MultiShortmap *map)
 Destroy a hash map. More...
 
void * GNUNET_CONTAINER_multishortmap_get (const struct GNUNET_CONTAINER_MultiShortmap *map, const struct GNUNET_ShortHashCode *key)
 Given a key find a value in the map matching the key. More...
 
int GNUNET_CONTAINER_multishortmap_remove (struct GNUNET_CONTAINER_MultiShortmap *map, const struct GNUNET_ShortHashCode *key, const void *value)
 Remove the given key-value pair from the map. More...
 
int GNUNET_CONTAINER_multishortmap_remove_all (struct GNUNET_CONTAINER_MultiShortmap *map, const struct GNUNET_ShortHashCode *key)
 Remove all entries for the given key from the map. More...
 
int GNUNET_CONTAINER_multishortmap_contains (const struct GNUNET_CONTAINER_MultiShortmap *map, const struct GNUNET_ShortHashCode *key)
 Check if the map contains any value under the given key (including values that are NULL). More...
 
int GNUNET_CONTAINER_multishortmap_contains_value (const struct GNUNET_CONTAINER_MultiShortmap *map, const struct GNUNET_ShortHashCode *key, const void *value)
 Check if the map contains the given value under the given key. More...
 
int GNUNET_CONTAINER_multishortmap_put (struct GNUNET_CONTAINER_MultiShortmap *map, const struct GNUNET_ShortHashCode *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
 Store a key-value pair in the map. More...
 
unsigned int GNUNET_CONTAINER_multishortmap_size (const struct GNUNET_CONTAINER_MultiShortmap *map)
 Get the number of key-value pairs in the map. More...
 
int GNUNET_CONTAINER_multishortmap_iterate (struct GNUNET_CONTAINER_MultiShortmap *map, GNUNET_CONTAINER_ShortmapIterator it, void *it_cls)
 Iterate over all entries in the map. More...
 
struct GNUNET_CONTAINER_MultiShortmapIteratorGNUNET_CONTAINER_multishortmap_iterator_create (const struct GNUNET_CONTAINER_MultiShortmap *map)
 Create an iterator for a multihashmap. More...
 
int GNUNET_CONTAINER_multishortmap_iterator_next (struct GNUNET_CONTAINER_MultiShortmapIterator *iter, struct GNUNET_ShortHashCode *key, const void **value)
 Retrieve the next element from the hash map at the iterator's position. More...
 
void GNUNET_CONTAINER_multishortmap_iterator_destroy (struct GNUNET_CONTAINER_MultiShortmapIterator *iter)
 Destroy a multishortmap iterator. More...
 
int GNUNET_CONTAINER_multishortmap_get_multiple (struct GNUNET_CONTAINER_MultiShortmap *map, const struct GNUNET_ShortHashCode *key, GNUNET_CONTAINER_ShortmapIterator it, void *it_cls)
 Iterate over all entries in the map that match a particular key. More...
 
unsigned int GNUNET_CONTAINER_multishortmap_get_random (const struct GNUNET_CONTAINER_MultiShortmap *map, GNUNET_CONTAINER_ShortmapIterator it, void *it_cls)
 Call it on a random value from the map, or not at all if the map is empty. More...
 
struct GNUNET_CONTAINER_MultiUuidmapGNUNET_CONTAINER_multiuuidmap_create (unsigned int len, int do_not_copy_keys)
 Create a multi peer map (hash map for public keys of peers). More...
 
void GNUNET_CONTAINER_multiuuidmap_destroy (struct GNUNET_CONTAINER_MultiUuidmap *map)
 Destroy a hash map. More...
 
void * GNUNET_CONTAINER_multiuuidmap_get (const struct GNUNET_CONTAINER_MultiUuidmap *map, const struct GNUNET_Uuid *key)
 Given a key find a value in the map matching the key. More...
 
int GNUNET_CONTAINER_multiuuidmap_remove (struct GNUNET_CONTAINER_MultiUuidmap *map, const struct GNUNET_Uuid *key, const void *value)
 Remove the given key-value pair from the map. More...
 
int GNUNET_CONTAINER_multiuuidmap_remove_all (struct GNUNET_CONTAINER_MultiUuidmap *map, const struct GNUNET_Uuid *key)
 Remove all entries for the given key from the map. More...
 
int GNUNET_CONTAINER_multiuuidmap_contains (const struct GNUNET_CONTAINER_MultiUuidmap *map, const struct GNUNET_Uuid *key)
 Check if the map contains any value under the given key (including values that are NULL). More...
 
int GNUNET_CONTAINER_multiuuidmap_contains_value (const struct GNUNET_CONTAINER_MultiUuidmap *map, const struct GNUNET_Uuid *key, const void *value)
 Check if the map contains the given value under the given key. More...
 
int GNUNET_CONTAINER_multiuuidmap_put (struct GNUNET_CONTAINER_MultiUuidmap *map, const struct GNUNET_Uuid *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
 Store a key-value pair in the map. More...
 
unsigned int GNUNET_CONTAINER_multiuuidmap_size (const struct GNUNET_CONTAINER_MultiUuidmap *map)
 Get the number of key-value pairs in the map. More...
 
int GNUNET_CONTAINER_multiuuidmap_iterate (struct GNUNET_CONTAINER_MultiUuidmap *map, GNUNET_CONTAINER_MultiUuidmapIteratorCallback it, void *it_cls)
 Iterate over all entries in the map. More...
 
struct GNUNET_CONTAINER_MultiUuidmapIteratorGNUNET_CONTAINER_multiuuidmap_iterator_create (const struct GNUNET_CONTAINER_MultiUuidmap *map)
 Create an iterator for a multihashmap. More...
 
int GNUNET_CONTAINER_multiuuidmap_iterator_next (struct GNUNET_CONTAINER_MultiUuidmapIterator *iter, struct GNUNET_Uuid *key, const void **value)
 Retrieve the next element from the hash map at the iterator's position. More...
 
void GNUNET_CONTAINER_multiuuidmap_iterator_destroy (struct GNUNET_CONTAINER_MultiUuidmapIterator *iter)
 Destroy a multiuuidmap iterator. More...
 
int GNUNET_CONTAINER_multiuuidmap_get_multiple (struct GNUNET_CONTAINER_MultiUuidmap *map, const struct GNUNET_Uuid *key, GNUNET_CONTAINER_MultiUuidmapIteratorCallback it, void *it_cls)
 Iterate over all entries in the map that match a particular key. More...
 
unsigned int GNUNET_CONTAINER_multiuuidmap_get_random (const struct GNUNET_CONTAINER_MultiUuidmap *map, GNUNET_CONTAINER_MultiUuidmapIteratorCallback it, void *it_cls)
 Call it on a random value from the map, or not at all if the map is empty. More...
 
struct GNUNET_CONTAINER_MultiHashMap32GNUNET_CONTAINER_multihashmap32_create (unsigned int len)
 Create a 32-bit key multi hash map. More...
 
void GNUNET_CONTAINER_multihashmap32_destroy (struct GNUNET_CONTAINER_MultiHashMap32 *map)
 Destroy a 32-bit key hash map. More...
 
unsigned int GNUNET_CONTAINER_multihashmap32_size (const struct GNUNET_CONTAINER_MultiHashMap32 *map)
 Get the number of key-value pairs in the map. More...
 
void * GNUNET_CONTAINER_multihashmap32_get (const struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key)
 Given a key find a value in the map matching the key. More...
 
int GNUNET_CONTAINER_multihashmap32_iterate (struct GNUNET_CONTAINER_MultiHashMap32 *map, GNUNET_CONTAINER_MulitHashMapIterator32Callback it, void *it_cls)
 Iterate over all entries in the map. More...
 
int GNUNET_CONTAINER_multihashmap32_remove (struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, const void *value)
 Remove the given key-value pair from the map. More...
 
int GNUNET_CONTAINER_multihashmap32_remove_all (struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key)
 Remove all entries for the given key from the map. More...
 
int GNUNET_CONTAINER_multihashmap32_contains (const struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key)
 Check if the map contains any value under the given key (including values that are NULL). More...
 
int GNUNET_CONTAINER_multihashmap32_contains_value (const struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, const void *value)
 Check if the map contains the given value under the given key. More...
 
int GNUNET_CONTAINER_multihashmap32_put (struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
 Store a key-value pair in the map. More...
 
int GNUNET_CONTAINER_multihashmap32_get_multiple (struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, GNUNET_CONTAINER_MulitHashMapIterator32Callback it, void *it_cls)
 Iterate over all entries in the map that match a particular key. More...
 
struct GNUNET_CONTAINER_MultiHashMap32IteratorGNUNET_CONTAINER_multihashmap32_iterator_create (const struct GNUNET_CONTAINER_MultiHashMap32 *map)
 Create an iterator for a 32-bit multihashmap. More...
 
int GNUNET_CONTAINER_multihashmap32_iterator_next (struct GNUNET_CONTAINER_MultiHashMap32Iterator *iter, uint32_t *key, const void **value)
 Retrieve the next element from the hash map at the iterator's position. More...
 
void GNUNET_CONTAINER_multihashmap32_iterator_destroy (struct GNUNET_CONTAINER_MultiHashMapIterator *iter)
 Destroy a 32-bit multihashmap iterator. More...
 
struct GNUNET_CONTAINER_HeapGNUNET_CONTAINER_heap_create (enum GNUNET_CONTAINER_HeapOrder order)
 Create a new heap. More...
 
void GNUNET_CONTAINER_heap_destroy (struct GNUNET_CONTAINER_Heap *heap)
 Destroys the heap. More...
 
void * GNUNET_CONTAINER_heap_peek (const struct GNUNET_CONTAINER_Heap *heap)
 Get element stored at the root of heap. More...
 
int GNUNET_CONTAINER_heap_peek2 (const struct GNUNET_CONTAINER_Heap *heap, void **element, GNUNET_CONTAINER_HeapCostType *cost)
 Get element and cost stored at the root of heap. More...
 
unsigned int GNUNET_CONTAINER_heap_get_size (const struct GNUNET_CONTAINER_Heap *heap)
 Get the current size of the heap. More...
 
GNUNET_CONTAINER_HeapCostType GNUNET_CONTAINER_heap_node_get_cost (const struct GNUNET_CONTAINER_HeapNode *node)
 Get the current cost of the node. More...
 
void GNUNET_CONTAINER_heap_iterate (const struct GNUNET_CONTAINER_Heap *heap, GNUNET_CONTAINER_HeapIterator iterator, void *iterator_cls)
 Iterate over all entries in the heap. More...
 
void * GNUNET_CONTAINER_heap_walk_get_next (struct GNUNET_CONTAINER_Heap *heap)
 Perform a random walk of the tree. More...
 
struct GNUNET_CONTAINER_HeapNodeGNUNET_CONTAINER_heap_insert (struct GNUNET_CONTAINER_Heap *heap, void *element, GNUNET_CONTAINER_HeapCostType cost)
 Inserts a new element into the heap. More...
 
void * GNUNET_CONTAINER_heap_remove_root (struct GNUNET_CONTAINER_Heap *heap)
 Remove root of the heap. More...
 
void * GNUNET_CONTAINER_heap_remove_node (struct GNUNET_CONTAINER_HeapNode *node)
 Removes a node from the heap. More...
 
void GNUNET_CONTAINER_heap_update_cost (struct GNUNET_CONTAINER_HeapNode *node, GNUNET_CONTAINER_HeapCostType new_cost)
 Updates the cost of any node in the tree. More...
 

Detailed Description

Author
Christian Grothoff
Nils Durner

Container classes for GNUnet

Definition in file gnunet_container_lib.h.

Macro Definition Documentation

◆ EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME

#define EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME   180

Definition at line 185 of file gnunet_container_lib.h.

◆ GNUNET_CONTAINER_DLL_insert_sorted

#define GNUNET_CONTAINER_DLL_insert_sorted (   TYPE,
  comparator,
  comparator_cls,
  head,
  tail,
  element 
)
Value:
do \
{ \
if ((NULL == head) || (0 < comparator(comparator_cls, element, head))) \
{ \
/* insert at head, element < head */ \
GNUNET_CONTAINER_DLL_insert(head, tail, element); \
} \
else \
{ \
TYPE *pos; \
\
for (pos = head; NULL != pos; pos = pos->next) \
if (0 < comparator(comparator_cls, element, pos)) \
break; /* element < pos */ \
if (NULL == pos) /* => element > tail */ \
{ \
GNUNET_CONTAINER_DLL_insert_tail(head, tail, element); \
} \
else /* prev < element < pos */ \
{ \
GNUNET_CONTAINER_DLL_insert_after(head, tail, pos->prev, element); \
} \
} \
} while (0)
struct PendingResolutions * prev
Kept in a DLL.
Definition: gnunet-ats.c:163
struct PendingResolutions * next
Kept in a DLL.
Definition: gnunet-ats.c:158
static struct PendingResolutions * head
Head of list of pending resolution requests.
Definition: gnunet-ats.c:228
static struct PendingResolutions * tail
Tail of list of pending resolution requests.
Definition: gnunet-ats.c:233

Insertion sort of element into DLL from head to tail sorted by comparator.

Parameters
TYPEelement type of the elements, i.e. struct ListElement
comparatorfunction like memcmp() to compare elements; takes three arguments, the comparator_cls and two elements, returns an int (-1, 0 or 1)
comparator_clsclosure for comparator
[in,out]headhead of DLL
[in,out]tailtail of DLL
elementelement to insert

Definition at line 2448 of file gnunet_container_lib.h.

Referenced by data_sent_cb(), and GCCH_handle_channel_plaintext_data().

Typedef Documentation

◆ EXTRACTOR_MetaDataProcessor

typedef int(* EXTRACTOR_MetaDataProcessor) (void *cls, const char *plugin_name, enum EXTRACTOR_MetaType type, enum EXTRACTOR_MetaFormat format, const char *data_mime_type, const char *data, size_t data_len)

Type of a function that libextractor calls for each meta data item found.

Parameters
clsclosure (user-defined)
plugin_namename of the plugin that produced this value; special values can be used (i.e. '<zlib>' for zlib being used in the main libextractor library and yielding meta data).
typelibextractor-type describing the meta data
formatbasic format information about data
data_mime_typemime-type of data (not of the original file); can be NULL (if mime-type is not known)
dataactual meta-data found
data_lennumber of bytes in data
Returns
0 to continue extracting, 1 to abort

Definition at line 173 of file gnunet_container_lib.h.

Enumeration Type Documentation

◆ EXTRACTOR_MetaType

Enumeration defining various sources of keywords.

See also http://dublincore.org/documents/1998/09/dces/

Enumerator
EXTRACTOR_METATYPE_RESERVED 
EXTRACTOR_METATYPE_MIMETYPE 
EXTRACTOR_METATYPE_FILENAME 
EXTRACTOR_METATYPE_COMMENT 
EXTRACTOR_METATYPE_TITLE 
EXTRACTOR_METATYPE_BOOK_TITLE 
EXTRACTOR_METATYPE_JOURNAL_NAME 
EXTRACTOR_METATYPE_AUTHOR_NAME 
EXTRACTOR_METATYPE_PUBLICATION_DATE 
EXTRACTOR_METATYPE_URL 
EXTRACTOR_METATYPE_URI 
EXTRACTOR_METATYPE_ISRC 
EXTRACTOR_METATYPE_UNKNOWN 
EXTRACTOR_METATYPE_DESCRIPTION 
EXTRACTOR_METATYPE_KEYWORDS 
EXTRACTOR_METATYPE_SUBJECT 
EXTRACTOR_METATYPE_PACKAGE_NAME 
EXTRACTOR_METATYPE_THUMBNAIL 
EXTRACTOR_METATYPE_ALBUM 
EXTRACTOR_METATYPE_ARTIST 
EXTRACTOR_METATYPE_ORIGINAL_TITLE 
EXTRACTOR_METATYPE_GNUNET_FULL_DATA 
EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME 

Definition at line 102 of file gnunet_container_lib.h.

102  {
126 };
#define EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME

◆ EXTRACTOR_MetaFormat

Format in which the extracted meta data is presented.

Enumerator
EXTRACTOR_METAFORMAT_UNKNOWN 

Format is unknown.

EXTRACTOR_METAFORMAT_UTF8 

0-terminated, UTF-8 encoded string.

"data_len" is strlen(data)+1.

EXTRACTOR_METAFORMAT_BINARY 

Some kind of binary format, see given Mime type.

EXTRACTOR_METAFORMAT_C_STRING 

0-terminated string.

The specific encoding is unknown. "data_len" is strlen (data)+1.

Definition at line 131 of file gnunet_container_lib.h.

131  {
136 
142 
147 
153 };
Some kind of binary format, see given Mime type.
0-terminated, UTF-8 encoded string.

Function Documentation

◆ GNUNET_try_compression()

int GNUNET_try_compression ( const char *  data,
size_t  old_size,
char **  result,
size_t *  new_size 
)

Try to compress the given block of data using libz.

Only returns the compressed block if compression worked and the new block is actually smaller. Decompress using GNUNET_decompress().

Parameters
datablock to compress; if compression resulted in a smaller block, the first bytes of data are updated to the compressed data
old_sizenumber of bytes in data
[out]resultset to the compressed data, if compression worked
[out]new_sizeset to size of result, if compression worked
Returns
GNUNET_YES if compression reduce the size, GNUNET_NO if compression did not help

Definition at line 54 of file container_meta_data.c.

References GNUNET_free, GNUNET_malloc, GNUNET_NO, and GNUNET_YES.

Referenced by GNUNET_CONTAINER_meta_data_serialize(), and strata_estimator_write().

58 {
59  char *tmp;
60  uLongf dlen;
61 
62  *result = NULL;
63  *new_size = 0;
64 #ifdef compressBound
65  dlen = compressBound(old_size);
66 #else
67  dlen = old_size + (old_size / 100) + 20;
68  /* documentation says 100.1% oldSize + 12 bytes, but we
69  * should be able to overshoot by more to be safe */
70 #endif
71  tmp = GNUNET_malloc(dlen);
72  if (Z_OK ==
73  compress2((Bytef *)tmp,
74  &dlen,
75  (const Bytef *)data,
76  old_size, 9))
77  {
78  if (dlen < old_size)
79  {
80  *result = tmp;
81  *new_size = dlen;
82  return GNUNET_YES;
83  }
84  }
85  GNUNET_free(tmp);
86  return GNUNET_NO;
87 }
#define GNUNET_NO
Definition: gnunet_common.h:78
static int result
Global testing status.
#define GNUNET_YES
Definition: gnunet_common.h:77
uint32_t data
The data value.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the caller graph for this function:

◆ GNUNET_decompress()

char* GNUNET_decompress ( const char *  input,
size_t  input_size,
size_t  output_size 
)

Decompress input, return the decompressed data as output.

Dual to GNUNET_try_compression(). Caller must set output_size to the number of bytes that were originally compressed.

Parameters
inputcompressed data
input_sizenumber of bytes in input
output_sizeexpected size of the output
Returns
NULL on error, buffer of output_size decompressed bytes otherwise

Definition at line 101 of file container_meta_data.c.

References GNUNET_free, and GNUNET_malloc.

Referenced by GNUNET_CONTAINER_meta_data_deserialize(), and strata_estimator_read().

104 {
105  char *output;
106  uLongf olen;
107 
108  olen = output_size;
109  output = GNUNET_malloc(olen);
110  if (Z_OK ==
111  uncompress((Bytef *)output,
112  &olen,
113  (const Bytef *)input,
114  input_size))
115  return output;
116  GNUNET_free(output);
117  return NULL;
118 }
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the caller graph for this function:

◆ GNUNET_CONTAINER_bloomfilter_get_element_addresses()

size_t GNUNET_CONTAINER_bloomfilter_get_element_addresses ( const struct GNUNET_CONTAINER_BloomFilter bf)

Get the number of the addresses set per element in the bloom filter.

Parameters
bfthe filter
Returns
addresses set per element in the bf

Definition at line 92 of file container_bloomfilter.c.

References GNUNET_CONTAINER_BloomFilter::addressesPerElement.

94 {
95  if (bf == NULL)
96  return 0;
97  return bf->addressesPerElement;
98 }
unsigned int addressesPerElement
How many bits we set for each stored element.

◆ GNUNET_CONTAINER_multihashmap32_iterator_create()

struct GNUNET_CONTAINER_MultiHashMap32Iterator* GNUNET_CONTAINER_multihashmap32_iterator_create ( const struct GNUNET_CONTAINER_MultiHashMap32 map)

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.

Parameters
mapthe map to create an iterator for
Returns
an iterator over the given multihashmap map

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_multihashmap_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.

Parameters
mapthe map to create an iterator for
Returns
an iterator over the given multihashmap map

Definition at line 605 of file container_multihashmap32.c.

References GNUNET_new, GNUNET_CONTAINER_MultiHashMap32::map, map, GNUNET_CONTAINER_MultiHashMap32Iterator::map, GNUNET_CONTAINER_MultiHashMap32Iterator::me, GNUNET_CONTAINER_MultiHashMap32::modification_counter, and GNUNET_CONTAINER_MultiHashMap32Iterator::modification_counter.

607 {
609 
611  iter->map = map;
613  iter->me = map->map[0];
614  return iter;
615 }
struct MapEntry ** map
All of our buckets.
struct MapEntry * me
Position in the bucket idx.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
unsigned int modification_counter
Modification counter as observed on the map when the iterator was created.
static struct GNUNET_CONTAINER_MultiPeerMap * map
Handle to the map used to store old latency values for peers.
unsigned int modification_counter
Counts the destructive modifications (grow, remove) to the map, so that iterators can check if they a...
const struct GNUNET_CONTAINER_MultiHashMap32 * map
Map that we are iterating over.

◆ GNUNET_CONTAINER_multihashmap32_iterator_next()

int GNUNET_CONTAINER_multihashmap32_iterator_next ( struct GNUNET_CONTAINER_MultiHashMap32Iterator iter,
uint32_t *  key,
const void **  value 
)

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.

Parameters
iterthe iterator to get the next element from
keypointer to store the key in, can be NULL
valuepointer to store the value in, can be NULL
Returns
GNUNET_YES we returned an element, GNUNET_NO if we are out of elements

Definition at line 633 of file container_multihashmap32.c.

References GNUNET_assert, GNUNET_NO, GNUNET_YES, GNUNET_CONTAINER_MultiHashMap32Iterator::idx, MapEntry::key, GNUNET_CONTAINER_MultiHashMap32::map, GNUNET_CONTAINER_MultiHashMap32Iterator::map, GNUNET_CONTAINER_MultiHashMap32::map_length, GNUNET_CONTAINER_MultiHashMap32Iterator::me, GNUNET_CONTAINER_MultiHashMap32::modification_counter, GNUNET_CONTAINER_MultiHashMap32Iterator::modification_counter, MapEntry::next, and MapEntry::value.

637 {
638  /* make sure the map has not been modified */
640 
641  /* look for the next entry, skipping empty buckets */
642  while (1)
643  {
644  if (iter->idx >= iter->map->map_length)
645  return GNUNET_NO;
646  if (NULL != iter->me)
647  {
648  if (NULL != key)
649  *key = iter->me->key;
650  if (NULL != value)
651  *value = iter->me->value;
652  iter->me = iter->me->next;
653  return GNUNET_YES;
654  }
655  iter->idx += 1;
656  if (iter->idx < iter->map->map_length)
657  iter->me = iter->map->map[iter->idx];
658  }
659 }
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
struct MapEntry ** map
All of our buckets.
uint32_t key
Key for the entry.
#define GNUNET_NO
Definition: gnunet_common.h:78
struct MapEntry * me
Position in the bucket idx.
unsigned int modification_counter
Modification counter as observed on the map when the iterator was created.
static char * value
Value of the record to add/remove.
void * value
Value of the entry.
struct GNUNET_HashCode key
The key used in the DHT.
unsigned int map_length
Length of the map array.
unsigned int modification_counter
Counts the destructive modifications (grow, remove) to the map, so that iterators can check if they a...
#define GNUNET_YES
Definition: gnunet_common.h:77
struct MapEntry * next
If there is a hash collision, we create a linked list.
unsigned int idx
Current bucket index.
const struct GNUNET_CONTAINER_MultiHashMap32 * map
Map that we are iterating over.

◆ GNUNET_CONTAINER_multihashmap32_iterator_destroy()

void GNUNET_CONTAINER_multihashmap32_iterator_destroy ( struct GNUNET_CONTAINER_MultiHashMapIterator iter)

Destroy a 32-bit multihashmap iterator.

Parameters
iterthe iterator to destroy

Destroy a 32-bit multihashmap iterator.

Parameters
iterthe iterator to destroy

Definition at line 668 of file container_multihashmap32.c.

References GNUNET_free.

670 {
671  GNUNET_free(iter);
672 }
#define GNUNET_free(ptr)
Wrapper around free.

◆ GNUNET_CONTAINER_heap_peek2()

int GNUNET_CONTAINER_heap_peek2 ( const struct GNUNET_CONTAINER_Heap heap,
void **  element,
GNUNET_CONTAINER_HeapCostType cost 
)

Get element and cost stored at the root of heap.

Parameters
[in]heapHeap to inspect.
[out]elementRoot element is returned here.
[out]costCost of element is returned here.
Returns
GNUNET_YES if an element is returned, GNUNET_NO if the heap is empty.

Definition at line 185 of file container_heap.c.

References GNUNET_CONTAINER_HeapNode::cost, GNUNET_CONTAINER_HeapNode::element, GNUNET_NO, GNUNET_YES, and GNUNET_CONTAINER_Heap::root.

Referenced by GCP_attach_path().

188 {
189  if (NULL == heap->root)
190  return GNUNET_NO;
191  if (NULL != element)
192  *element = heap->root->element;
193  if (NULL != cost)
194  *cost = heap->root->cost;
195  return GNUNET_YES;
196 }
GNUNET_CONTAINER_HeapCostType cost
Cost for this element.
#define GNUNET_NO
Definition: gnunet_common.h:78
void * element
Our element.
#define GNUNET_YES
Definition: gnunet_common.h:77
struct GNUNET_CONTAINER_HeapNode * root
Root of the heap.
Here is the caller graph for this function: