aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_container_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_container_lib.h')
-rw-r--r--src/include/gnunet_container_lib.h187
1 files changed, 63 insertions, 124 deletions
diff --git a/src/include/gnunet_container_lib.h b/src/include/gnunet_container_lib.h
index cfc7e0842..fde31ed34 100644
--- a/src/include/gnunet_container_lib.h
+++ b/src/include/gnunet_container_lib.h
@@ -115,8 +115,8 @@ struct GNUNET_CONTAINER_BloomFilter *GNUNET_CONTAINER_bloomfilter_init (const
115 * @return GNUNET_SYSERR if the data array of the wrong size 115 * @return GNUNET_SYSERR if the data array of the wrong size
116 */ 116 */
117int GNUNET_CONTAINER_bloomfilter_get_raw_data (const struct 117int GNUNET_CONTAINER_bloomfilter_get_raw_data (const struct
118 GNUNET_CONTAINER_BloomFilter 118 GNUNET_CONTAINER_BloomFilter *bf,
119 *bf, char *data, size_t size); 119 char *data, size_t size);
120 120
121 121
122/** 122/**
@@ -134,8 +134,8 @@ int GNUNET_CONTAINER_bloomfilter_test (const struct GNUNET_CONTAINER_BloomFilter
134 * @param bf the filter 134 * @param bf the filter
135 * @param e the element 135 * @param e the element
136 */ 136 */
137void GNUNET_CONTAINER_bloomfilter_add (struct GNUNET_CONTAINER_BloomFilter 137void GNUNET_CONTAINER_bloomfilter_add (struct GNUNET_CONTAINER_BloomFilter *bf,
138 *bf, const GNUNET_HashCode * e); 138 const GNUNET_HashCode * e);
139 139
140 140
141/** 141/**
@@ -176,20 +176,9 @@ void GNUNET_CONTAINER_bloomfilter_free (struct GNUNET_CONTAINER_BloomFilter
176 * @param bf the filter 176 * @param bf the filter
177 * @return number of bytes used for the data of the bloom filter 177 * @return number of bytes used for the data of the bloom filter
178 */ 178 */
179size_t 179size_t GNUNET_CONTAINER_bloomfilter_get_size (const struct
180 180 GNUNET_CONTAINER_BloomFilter
181 181 *bf);
182
183
184
185
186
187
188
189
190
191GNUNET_CONTAINER_bloomfilter_get_size (const struct GNUNET_CONTAINER_BloomFilter
192 *bf);
193 182
194 183
195/** 184/**
@@ -223,10 +212,9 @@ int GNUNET_CONTAINER_bloomfilter_or (struct GNUNET_CONTAINER_BloomFilter *bf,
223 * @param to_or the bloomfilter to or-in 212 * @param to_or the bloomfilter to or-in
224 * @param size number of bytes in data 213 * @param size number of bytes in data
225 */ 214 */
226int 215int GNUNET_CONTAINER_bloomfilter_or2 (struct GNUNET_CONTAINER_BloomFilter *bf,
227GNUNET_CONTAINER_bloomfilter_or2 (struct GNUNET_CONTAINER_BloomFilter *bf, 216 const struct GNUNET_CONTAINER_BloomFilter
228 const struct GNUNET_CONTAINER_BloomFilter 217 *to_or, size_t size);
229 *to_or, size_t size);
230 218
231/** 219/**
232 * Resize a bloom filter. Note that this operation 220 * Resize a bloom filter. Note that this operation
@@ -240,10 +228,9 @@ GNUNET_CONTAINER_bloomfilter_or2 (struct GNUNET_CONTAINER_BloomFilter *bf,
240 * @param k the new number of GNUNET_CRYPTO_hash-function to apply per element 228 * @param k the new number of GNUNET_CRYPTO_hash-function to apply per element
241 */ 229 */
242void GNUNET_CONTAINER_bloomfilter_resize (struct GNUNET_CONTAINER_BloomFilter 230void GNUNET_CONTAINER_bloomfilter_resize (struct GNUNET_CONTAINER_BloomFilter
243 *bf, 231 *bf, GNUNET_HashCodeIterator iterator,
244 GNUNET_HashCodeIterator iterator, 232 void *iterator_cls, size_t size,
245 void *iterator_cls, 233 unsigned int k);
246 size_t size, unsigned int k);
247 234
248/* ****************** metadata ******************* */ 235/* ****************** metadata ******************* */
249 236
@@ -287,11 +274,10 @@ void GNUNET_CONTAINER_meta_data_destroy (struct GNUNET_CONTAINER_MetaData *md);
287 * @param md2 other value to check 274 * @param md2 other value to check
288 * @return GNUNET_YES if they are equal 275 * @return GNUNET_YES if they are equal
289 */ 276 */
290int 277int GNUNET_CONTAINER_meta_data_test_equal (const struct
291GNUNET_CONTAINER_meta_data_test_equal (const struct 278 GNUNET_CONTAINER_MetaData *md1,
292 GNUNET_CONTAINER_MetaData *md1, 279 const struct
293 const struct 280 GNUNET_CONTAINER_MetaData *md2);
294 GNUNET_CONTAINER_MetaData *md2);
295 281
296 282
297/** 283/**
@@ -311,13 +297,12 @@ GNUNET_CONTAINER_meta_data_test_equal (const struct
311 * @return GNUNET_OK on success, GNUNET_SYSERR if this entry already exists 297 * @return GNUNET_OK on success, GNUNET_SYSERR if this entry already exists
312 * data_mime_type and plugin_name are not considered for "exists" checks 298 * data_mime_type and plugin_name are not considered for "exists" checks
313 */ 299 */
314int 300int GNUNET_CONTAINER_meta_data_insert (struct GNUNET_CONTAINER_MetaData *md,
315GNUNET_CONTAINER_meta_data_insert (struct GNUNET_CONTAINER_MetaData *md, 301 const char *plugin_name,
316 const char *plugin_name, 302 enum EXTRACTOR_MetaType type,
317 enum EXTRACTOR_MetaType type, 303 enum EXTRACTOR_MetaFormat format,
318 enum EXTRACTOR_MetaFormat format, 304 const char *data_mime_type,
319 const char *data_mime_type, 305 const char *data, size_t data_len);
320 const char *data, size_t data_len);
321 306
322 307
323/** 308/**
@@ -327,9 +312,9 @@ GNUNET_CONTAINER_meta_data_insert (struct GNUNET_CONTAINER_MetaData *md,
327 * @param md metadata to extend 312 * @param md metadata to extend
328 * @param in metadata to merge 313 * @param in metadata to merge
329 */ 314 */
330void 315void GNUNET_CONTAINER_meta_data_merge (struct GNUNET_CONTAINER_MetaData *md,
331GNUNET_CONTAINER_meta_data_merge (struct GNUNET_CONTAINER_MetaData *md, 316 const struct GNUNET_CONTAINER_MetaData
332 const struct GNUNET_CONTAINER_MetaData *in); 317 *in);
333 318
334 319
335/** 320/**
@@ -342,10 +327,9 @@ GNUNET_CONTAINER_meta_data_merge (struct GNUNET_CONTAINER_MetaData *md,
342 * @param data_len number of bytes in data 327 * @param data_len number of bytes in data
343 * @return GNUNET_OK on success, GNUNET_SYSERR if the item does not exist in md 328 * @return GNUNET_OK on success, GNUNET_SYSERR if the item does not exist in md
344 */ 329 */
345int 330int GNUNET_CONTAINER_meta_data_delete (struct GNUNET_CONTAINER_MetaData *md,
346GNUNET_CONTAINER_meta_data_delete (struct GNUNET_CONTAINER_MetaData *md, 331 enum EXTRACTOR_MetaType type,
347 enum EXTRACTOR_MetaType type, 332 const char *data, size_t data_len);
348 const char *data, size_t data_len);
349 333
350 334
351/** 335/**
@@ -362,9 +346,9 @@ void GNUNET_CONTAINER_meta_data_clear (struct GNUNET_CONTAINER_MetaData *md);
362 * 346 *
363 * @param md metadata to modify 347 * @param md metadata to modify
364 */ 348 */
365void 349void GNUNET_CONTAINER_meta_data_add_publication_date (struct
366GNUNET_CONTAINER_meta_data_add_publication_date (struct 350 GNUNET_CONTAINER_MetaData
367 GNUNET_CONTAINER_MetaData *md); 351 *md);
368 352
369 353
370/** 354/**
@@ -375,10 +359,9 @@ GNUNET_CONTAINER_meta_data_add_publication_date (struct
375 * @param iter_cls closure for iterator 359 * @param iter_cls closure for iterator
376 * @return number of entries 360 * @return number of entries
377 */ 361 */
378int GNUNET_CONTAINER_meta_data_iterate (const struct 362int GNUNET_CONTAINER_meta_data_iterate (const struct GNUNET_CONTAINER_MetaData
379 GNUNET_CONTAINER_MetaData *md, 363 *md, EXTRACTOR_MetaDataProcessor iter,
380 EXTRACTOR_MetaDataProcessor 364 void *iter_cls);
381 iter, void *iter_cls);
382 365
383/** 366/**
384 * Get the first MD entry of the given type. Caller 367 * Get the first MD entry of the given type. Caller
@@ -419,10 +402,9 @@ char *GNUNET_CONTAINER_meta_data_get_first_by_types (const struct
419 * freed by the caller! 402 * freed by the caller!
420 * @return number of bytes in thumbnail, 0 if not available 403 * @return number of bytes in thumbnail, 0 if not available
421 */ 404 */
422size_t 405size_t GNUNET_CONTAINER_meta_data_get_thumbnail (const struct
423GNUNET_CONTAINER_meta_data_get_thumbnail (const struct 406 GNUNET_CONTAINER_MetaData *md,
424 GNUNET_CONTAINER_MetaData 407 unsigned char **thumb);
425 *md, unsigned char **thumb);
426 408
427 409
428 410
@@ -463,30 +445,9 @@ enum GNUNET_CONTAINER_MetaDataSerializationOptions
463 * -1 on error (typically: not enough 445 * -1 on error (typically: not enough
464 * space) 446 * space)
465 */ 447 */
466ssize_t 448ssize_t
467 449GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
468 450 *md, char **target, size_t max,
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486GNUNET_CONTAINER_meta_data_serialize (const struct
487 GNUNET_CONTAINER_MetaData *md,
488 char **target,
489 size_t max,
490 enum 451 enum
491 GNUNET_CONTAINER_MetaDataSerializationOptions 452 GNUNET_CONTAINER_MetaDataSerializationOptions
492 opt); 453 opt);
@@ -498,26 +459,7 @@ GNUNET_CONTAINER_meta_data_serialize (const struct
498 * @param md metadata to inspect 459 * @param md metadata to inspect
499 * @return number of bytes needed for serialization, -1 on error 460 * @return number of bytes needed for serialization, -1 on error
500 */ 461 */
501ssize_t 462ssize_t
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521GNUNET_CONTAINER_meta_data_get_serialized_size (const struct 463GNUNET_CONTAINER_meta_data_get_serialized_size (const struct
522 GNUNET_CONTAINER_MetaData *md); 464 GNUNET_CONTAINER_MetaData *md);
523 465
@@ -609,8 +551,8 @@ struct GNUNET_CONTAINER_MultiHashMap
609 * 551 *
610 * @param map the map 552 * @param map the map
611 */ 553 */
612void GNUNET_CONTAINER_multihashmap_destroy (struct 554void GNUNET_CONTAINER_multihashmap_destroy (struct GNUNET_CONTAINER_MultiHashMap
613 GNUNET_CONTAINER_MultiHashMap *map); 555 *map);
614 556
615 557
616/** 558/**
@@ -667,8 +609,8 @@ int GNUNET_CONTAINER_multihashmap_remove_all (struct
667 * GNUNET_NO if not 609 * GNUNET_NO if not
668 */ 610 */
669int GNUNET_CONTAINER_multihashmap_contains (const struct 611int GNUNET_CONTAINER_multihashmap_contains (const struct
670 GNUNET_CONTAINER_MultiHashMap 612 GNUNET_CONTAINER_MultiHashMap *map,
671 *map, const GNUNET_HashCode * key); 613 const GNUNET_HashCode * key);
672 614
673 615
674/** 616/**
@@ -703,8 +645,8 @@ int GNUNET_CONTAINER_multihashmap_contains_value (const struct
703int GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap 645int GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap
704 *map, const GNUNET_HashCode * key, 646 *map, const GNUNET_HashCode * key,
705 void *value, 647 void *value,
706 enum 648 enum GNUNET_CONTAINER_MultiHashMapOption
707 GNUNET_CONTAINER_MultiHashMapOption opt); 649 opt);
708 650
709/** 651/**
710 * Get the number of key-value pairs in the map. 652 * Get the number of key-value pairs in the map.
@@ -728,8 +670,8 @@ unsigned int GNUNET_CONTAINER_multihashmap_size (const struct
728 */ 670 */
729int GNUNET_CONTAINER_multihashmap_iterate (const struct 671int GNUNET_CONTAINER_multihashmap_iterate (const struct
730 GNUNET_CONTAINER_MultiHashMap *map, 672 GNUNET_CONTAINER_MultiHashMap *map,
731 GNUNET_CONTAINER_HashMapIterator 673 GNUNET_CONTAINER_HashMapIterator it,
732 it, void *it_cls); 674 void *it_cls);
733 675
734 676
735/** 677/**
@@ -951,8 +893,8 @@ void *GNUNET_CONTAINER_heap_peek (const struct GNUNET_CONTAINER_Heap *heap);
951 * @param heap the heap to get the size of 893 * @param heap the heap to get the size of
952 * @return number of elements stored 894 * @return number of elements stored
953 */ 895 */
954unsigned int 896unsigned int GNUNET_CONTAINER_heap_get_size (const struct GNUNET_CONTAINER_Heap
955GNUNET_CONTAINER_heap_get_size (const struct GNUNET_CONTAINER_Heap *heap); 897 *heap);
956 898
957 899
958/** 900/**
@@ -961,9 +903,9 @@ GNUNET_CONTAINER_heap_get_size (const struct GNUNET_CONTAINER_Heap *heap);
961 * @param node the node to get the cost of 903 * @param node the node to get the cost of
962 * @return cost of the node 904 * @return cost of the node
963 */ 905 */
964GNUNET_CONTAINER_HeapCostType 906GNUNET_CONTAINER_HeapCostType GNUNET_CONTAINER_heap_node_get_cost (const struct
965GNUNET_CONTAINER_heap_node_get_cost (const struct GNUNET_CONTAINER_HeapNode 907 GNUNET_CONTAINER_HeapNode
966 *node); 908 *node);
967 909
968/** 910/**
969 * Iterator for heap 911 * Iterator for heap
@@ -989,10 +931,9 @@ typedef int (*GNUNET_CONTAINER_HeapIterator) (void *cls,
989 * @param iterator function to call on each entry 931 * @param iterator function to call on each entry
990 * @param iterator_cls closure for iterator 932 * @param iterator_cls closure for iterator
991 */ 933 */
992void 934void GNUNET_CONTAINER_heap_iterate (const struct GNUNET_CONTAINER_Heap *heap,
993GNUNET_CONTAINER_heap_iterate (const struct GNUNET_CONTAINER_Heap *heap, 935 GNUNET_CONTAINER_HeapIterator iterator,
994 GNUNET_CONTAINER_HeapIterator iterator, 936 void *iterator_cls);
995 void *iterator_cls);
996 937
997 938
998/** 939/**
@@ -1067,10 +1008,9 @@ void *GNUNET_CONTAINER_heap_remove_node (struct GNUNET_CONTAINER_HeapNode
1067 * @param node node for which the cost is to be changed 1008 * @param node node for which the cost is to be changed
1068 * @param new_cost new cost for the node 1009 * @param new_cost new cost for the node
1069 */ 1010 */
1070void 1011void GNUNET_CONTAINER_heap_update_cost (struct GNUNET_CONTAINER_Heap *heap,
1071GNUNET_CONTAINER_heap_update_cost (struct GNUNET_CONTAINER_Heap *heap, 1012 struct GNUNET_CONTAINER_HeapNode *node,
1072 struct GNUNET_CONTAINER_HeapNode *node, 1013 GNUNET_CONTAINER_HeapCostType new_cost);
1073 GNUNET_CONTAINER_HeapCostType new_cost);
1074 1014
1075 1015
1076/* ******************** Singly linked list *************** */ 1016/* ******************** Singly linked list *************** */
@@ -1139,9 +1079,8 @@ void GNUNET_CONTAINER_slist_add_end (struct GNUNET_CONTAINER_SList *l,
1139 * @param dst list to append to 1079 * @param dst list to append to
1140 * @param src source 1080 * @param src source
1141 */ 1081 */
1142void 1082void GNUNET_CONTAINER_slist_append (struct GNUNET_CONTAINER_SList *dst,
1143GNUNET_CONTAINER_slist_append (struct GNUNET_CONTAINER_SList *dst, 1083 struct GNUNET_CONTAINER_SList *src);
1144 struct GNUNET_CONTAINER_SList *src);
1145 1084
1146 1085
1147/** 1086/**