aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_container_lib.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-08-16 16:03:20 +0000
committerChristian Grothoff <christian@grothoff.org>2011-08-16 16:03:20 +0000
commit16a6919a9f98ee9fa1fee9dd262906c321004a19 (patch)
treee09d4fe5191dc329b3e1b667f2914f8313bcba59 /src/include/gnunet_container_lib.h
parent4d7904c62bb867c44e90b8e9f7cdbb4b283abc44 (diff)
downloadgnunet-16a6919a9f98ee9fa1fee9dd262906c321004a19.tar.gz
gnunet-16a6919a9f98ee9fa1fee9dd262906c321004a19.zip
even nicer indentation, thanks to LRN's indent patch
Diffstat (limited to 'src/include/gnunet_container_lib.h')
-rw-r--r--src/include/gnunet_container_lib.h386
1 files changed, 202 insertions, 184 deletions
diff --git a/src/include/gnunet_container_lib.h b/src/include/gnunet_container_lib.h
index fde31ed34..cad85d016 100644
--- a/src/include/gnunet_container_lib.h
+++ b/src/include/gnunet_container_lib.h
@@ -75,13 +75,9 @@ typedef int (*GNUNET_HashCodeIterator) (void *cls, GNUNET_HashCode * next);
75 * element (number of bits set per element in the set) 75 * element (number of bits set per element in the set)
76 * @return the bloomfilter 76 * @return the bloomfilter
77 */ 77 */
78struct GNUNET_CONTAINER_BloomFilter *GNUNET_CONTAINER_bloomfilter_load (const 78struct GNUNET_CONTAINER_BloomFilter *
79 char 79GNUNET_CONTAINER_bloomfilter_load (const char *filename, size_t size,
80 *filename, 80 unsigned int k);
81 size_t
82 size,
83 unsigned
84 int k);
85 81
86 82
87/** 83/**
@@ -97,13 +93,9 @@ struct GNUNET_CONTAINER_BloomFilter *GNUNET_CONTAINER_bloomfilter_load (const
97 * element (number of bits set per element in the set) 93 * element (number of bits set per element in the set)
98 * @return the bloomfilter 94 * @return the bloomfilter
99 */ 95 */
100struct GNUNET_CONTAINER_BloomFilter *GNUNET_CONTAINER_bloomfilter_init (const 96struct GNUNET_CONTAINER_BloomFilter *
101 char 97GNUNET_CONTAINER_bloomfilter_init (const char *data, size_t size,
102 *data, 98 unsigned int k);
103 size_t
104 size,
105 unsigned
106 int k);
107 99
108 100
109/** 101/**
@@ -114,9 +106,10 @@ struct GNUNET_CONTAINER_BloomFilter *GNUNET_CONTAINER_bloomfilter_init (const
114 * @param size the size of the given data array 106 * @param size the size of the given data array
115 * @return GNUNET_SYSERR if the data array of the wrong size 107 * @return GNUNET_SYSERR if the data array of the wrong size
116 */ 108 */
117int GNUNET_CONTAINER_bloomfilter_get_raw_data (const struct 109int
118 GNUNET_CONTAINER_BloomFilter *bf, 110GNUNET_CONTAINER_bloomfilter_get_raw_data (const struct
119 char *data, size_t size); 111 GNUNET_CONTAINER_BloomFilter *bf,
112 char *data, size_t size);
120 113
121 114
122/** 115/**
@@ -125,8 +118,9 @@ int GNUNET_CONTAINER_bloomfilter_get_raw_data (const struct
125 * @param bf the filter 118 * @param bf the filter
126 * @return GNUNET_YES if the element is in the filter, GNUNET_NO if not 119 * @return GNUNET_YES if the element is in the filter, GNUNET_NO if not
127 */ 120 */
128int GNUNET_CONTAINER_bloomfilter_test (const struct GNUNET_CONTAINER_BloomFilter 121int
129 *bf, const GNUNET_HashCode * e); 122GNUNET_CONTAINER_bloomfilter_test (const struct GNUNET_CONTAINER_BloomFilter
123 *bf, const GNUNET_HashCode * e);
130 124
131 125
132/** 126/**
@@ -134,8 +128,9 @@ int GNUNET_CONTAINER_bloomfilter_test (const struct GNUNET_CONTAINER_BloomFilter
134 * @param bf the filter 128 * @param bf the filter
135 * @param e the element 129 * @param e the element
136 */ 130 */
137void GNUNET_CONTAINER_bloomfilter_add (struct GNUNET_CONTAINER_BloomFilter *bf, 131void
138 const GNUNET_HashCode * e); 132GNUNET_CONTAINER_bloomfilter_add (struct GNUNET_CONTAINER_BloomFilter *bf,
133 const GNUNET_HashCode * e);
139 134
140 135
141/** 136/**
@@ -143,8 +138,9 @@ void GNUNET_CONTAINER_bloomfilter_add (struct GNUNET_CONTAINER_BloomFilter *bf,
143 * @param bf the filter 138 * @param bf the filter
144 * @param e the element to remove 139 * @param e the element to remove
145 */ 140 */
146void GNUNET_CONTAINER_bloomfilter_remove (struct GNUNET_CONTAINER_BloomFilter 141void
147 *bf, const GNUNET_HashCode * e); 142GNUNET_CONTAINER_bloomfilter_remove (struct GNUNET_CONTAINER_BloomFilter *bf,
143 const GNUNET_HashCode * e);
148 144
149 145
150/** 146/**
@@ -153,10 +149,9 @@ void GNUNET_CONTAINER_bloomfilter_remove (struct GNUNET_CONTAINER_BloomFilter
153 * @param bf the filter 149 * @param bf the filter
154 * @return copy of bf 150 * @return copy of bf
155 */ 151 */
156struct GNUNET_CONTAINER_BloomFilter *GNUNET_CONTAINER_bloomfilter_copy (const 152struct GNUNET_CONTAINER_BloomFilter *
157 struct 153GNUNET_CONTAINER_bloomfilter_copy (const struct GNUNET_CONTAINER_BloomFilter
158 GNUNET_CONTAINER_BloomFilter 154 *bf);
159 *bf);
160 155
161 156
162 157
@@ -166,8 +161,8 @@ struct GNUNET_CONTAINER_BloomFilter *GNUNET_CONTAINER_bloomfilter_copy (const
166 * free the space on the drive) 161 * free the space on the drive)
167 * @param bf the filter 162 * @param bf the filter
168 */ 163 */
169void GNUNET_CONTAINER_bloomfilter_free (struct GNUNET_CONTAINER_BloomFilter 164void
170 *bf); 165GNUNET_CONTAINER_bloomfilter_free (struct GNUNET_CONTAINER_BloomFilter *bf);
171 166
172 167
173/** 168/**
@@ -176,17 +171,17 @@ void GNUNET_CONTAINER_bloomfilter_free (struct GNUNET_CONTAINER_BloomFilter
176 * @param bf the filter 171 * @param bf the filter
177 * @return number of bytes used for the data of the bloom filter 172 * @return number of bytes used for the data of the bloom filter
178 */ 173 */
179size_t GNUNET_CONTAINER_bloomfilter_get_size (const struct 174size_t
180 GNUNET_CONTAINER_BloomFilter 175GNUNET_CONTAINER_bloomfilter_get_size (const struct GNUNET_CONTAINER_BloomFilter
181 *bf); 176 *bf);
182 177
183 178
184/** 179/**
185 * Reset a bloom filter to empty. 180 * Reset a bloom filter to empty.
186 * @param bf the filter 181 * @param bf the filter
187 */ 182 */
188void GNUNET_CONTAINER_bloomfilter_clear (struct GNUNET_CONTAINER_BloomFilter 183void
189 *bf); 184GNUNET_CONTAINER_bloomfilter_clear (struct GNUNET_CONTAINER_BloomFilter *bf);
190 185
191/** 186/**
192 * Or the entries of the given raw data array with the 187 * Or the entries of the given raw data array with the
@@ -199,8 +194,9 @@ void GNUNET_CONTAINER_bloomfilter_clear (struct GNUNET_CONTAINER_BloomFilter
199 * @param size size of data 194 * @param size size of data
200 * @return GNUNET_OK on success 195 * @return GNUNET_OK on success
201 */ 196 */
202int GNUNET_CONTAINER_bloomfilter_or (struct GNUNET_CONTAINER_BloomFilter *bf, 197int
203 const char *data, size_t size); 198GNUNET_CONTAINER_bloomfilter_or (struct GNUNET_CONTAINER_BloomFilter *bf,
199 const char *data, size_t size);
204 200
205/** 201/**
206 * Or the entries of the given raw data array with the 202 * Or the entries of the given raw data array with the
@@ -212,9 +208,10 @@ int GNUNET_CONTAINER_bloomfilter_or (struct GNUNET_CONTAINER_BloomFilter *bf,
212 * @param to_or the bloomfilter to or-in 208 * @param to_or the bloomfilter to or-in
213 * @param size number of bytes in data 209 * @param size number of bytes in data
214 */ 210 */
215int GNUNET_CONTAINER_bloomfilter_or2 (struct GNUNET_CONTAINER_BloomFilter *bf, 211int
216 const struct GNUNET_CONTAINER_BloomFilter 212GNUNET_CONTAINER_bloomfilter_or2 (struct GNUNET_CONTAINER_BloomFilter *bf,
217 *to_or, size_t size); 213 const struct GNUNET_CONTAINER_BloomFilter
214 *to_or, size_t size);
218 215
219/** 216/**
220 * Resize a bloom filter. Note that this operation 217 * Resize a bloom filter. Note that this operation
@@ -227,10 +224,11 @@ int GNUNET_CONTAINER_bloomfilter_or2 (struct GNUNET_CONTAINER_BloomFilter *bf,
227 * @param size the new size for the filter 224 * @param size the new size for the filter
228 * @param k the new number of GNUNET_CRYPTO_hash-function to apply per element 225 * @param k the new number of GNUNET_CRYPTO_hash-function to apply per element
229 */ 226 */
230void GNUNET_CONTAINER_bloomfilter_resize (struct GNUNET_CONTAINER_BloomFilter 227void
231 *bf, GNUNET_HashCodeIterator iterator, 228GNUNET_CONTAINER_bloomfilter_resize (struct GNUNET_CONTAINER_BloomFilter *bf,
232 void *iterator_cls, size_t size, 229 GNUNET_HashCodeIterator iterator,
233 unsigned int k); 230 void *iterator_cls, size_t size,
231 unsigned int k);
234 232
235/* ****************** metadata ******************* */ 233/* ****************** metadata ******************* */
236 234
@@ -244,7 +242,8 @@ struct GNUNET_CONTAINER_MetaData;
244 * 242 *
245 * @return empty meta-data container 243 * @return empty meta-data container
246 */ 244 */
247struct GNUNET_CONTAINER_MetaData *GNUNET_CONTAINER_meta_data_create (void); 245struct GNUNET_CONTAINER_MetaData *
246GNUNET_CONTAINER_meta_data_create (void);
248 247
249/** 248/**
250 * Duplicate a MetaData token. 249 * Duplicate a MetaData token.
@@ -252,17 +251,17 @@ struct GNUNET_CONTAINER_MetaData *GNUNET_CONTAINER_meta_data_create (void);
252 * @param md what to duplicate 251 * @param md what to duplicate
253 * @return duplicate meta-data container 252 * @return duplicate meta-data container
254 */ 253 */
255struct GNUNET_CONTAINER_MetaData *GNUNET_CONTAINER_meta_data_duplicate (const 254struct GNUNET_CONTAINER_MetaData *
256 struct 255GNUNET_CONTAINER_meta_data_duplicate (const struct GNUNET_CONTAINER_MetaData
257 GNUNET_CONTAINER_MetaData 256 *md);
258 *md);
259 257
260/** 258/**
261 * Free meta data. 259 * Free meta data.
262 * 260 *
263 * @param md what to free 261 * @param md what to free
264 */ 262 */
265void GNUNET_CONTAINER_meta_data_destroy (struct GNUNET_CONTAINER_MetaData *md); 263void
264GNUNET_CONTAINER_meta_data_destroy (struct GNUNET_CONTAINER_MetaData *md);
266 265
267/** 266/**
268 * Test if two MDs are equal. We consider them equal if 267 * Test if two MDs are equal. We consider them equal if
@@ -274,10 +273,11 @@ void GNUNET_CONTAINER_meta_data_destroy (struct GNUNET_CONTAINER_MetaData *md);
274 * @param md2 other value to check 273 * @param md2 other value to check
275 * @return GNUNET_YES if they are equal 274 * @return GNUNET_YES if they are equal
276 */ 275 */
277int GNUNET_CONTAINER_meta_data_test_equal (const struct 276int
278 GNUNET_CONTAINER_MetaData *md1, 277GNUNET_CONTAINER_meta_data_test_equal (const struct GNUNET_CONTAINER_MetaData
279 const struct 278 *md1,
280 GNUNET_CONTAINER_MetaData *md2); 279 const struct GNUNET_CONTAINER_MetaData
280 *md2);
281 281
282 282
283/** 283/**
@@ -297,12 +297,13 @@ int GNUNET_CONTAINER_meta_data_test_equal (const struct
297 * @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
298 * 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
299 */ 299 */
300int GNUNET_CONTAINER_meta_data_insert (struct GNUNET_CONTAINER_MetaData *md, 300int
301 const char *plugin_name, 301GNUNET_CONTAINER_meta_data_insert (struct GNUNET_CONTAINER_MetaData *md,
302 enum EXTRACTOR_MetaType type, 302 const char *plugin_name,
303 enum EXTRACTOR_MetaFormat format, 303 enum EXTRACTOR_MetaType type,
304 const char *data_mime_type, 304 enum EXTRACTOR_MetaFormat format,
305 const char *data, size_t data_len); 305 const char *data_mime_type, const char *data,
306 size_t data_len);
306 307
307 308
308/** 309/**
@@ -312,9 +313,9 @@ int GNUNET_CONTAINER_meta_data_insert (struct GNUNET_CONTAINER_MetaData *md,
312 * @param md metadata to extend 313 * @param md metadata to extend
313 * @param in metadata to merge 314 * @param in metadata to merge
314 */ 315 */
315void GNUNET_CONTAINER_meta_data_merge (struct GNUNET_CONTAINER_MetaData *md, 316void
316 const struct GNUNET_CONTAINER_MetaData 317GNUNET_CONTAINER_meta_data_merge (struct GNUNET_CONTAINER_MetaData *md,
317 *in); 318 const struct GNUNET_CONTAINER_MetaData *in);
318 319
319 320
320/** 321/**
@@ -327,9 +328,10 @@ void GNUNET_CONTAINER_meta_data_merge (struct GNUNET_CONTAINER_MetaData *md,
327 * @param data_len number of bytes in data 328 * @param data_len number of bytes in data
328 * @return GNUNET_OK on success, GNUNET_SYSERR if the item does not exist in md 329 * @return GNUNET_OK on success, GNUNET_SYSERR if the item does not exist in md
329 */ 330 */
330int GNUNET_CONTAINER_meta_data_delete (struct GNUNET_CONTAINER_MetaData *md, 331int
331 enum EXTRACTOR_MetaType type, 332GNUNET_CONTAINER_meta_data_delete (struct GNUNET_CONTAINER_MetaData *md,
332 const char *data, size_t data_len); 333 enum EXTRACTOR_MetaType type,
334 const char *data, size_t data_len);
333 335
334 336
335/** 337/**
@@ -337,7 +339,8 @@ int GNUNET_CONTAINER_meta_data_delete (struct GNUNET_CONTAINER_MetaData *md,
337 * 339 *
338 * @param md metadata to manipulate 340 * @param md metadata to manipulate
339 */ 341 */
340void GNUNET_CONTAINER_meta_data_clear (struct GNUNET_CONTAINER_MetaData *md); 342void
343GNUNET_CONTAINER_meta_data_clear (struct GNUNET_CONTAINER_MetaData *md);
341 344
342 345
343/** 346/**
@@ -346,9 +349,9 @@ void GNUNET_CONTAINER_meta_data_clear (struct GNUNET_CONTAINER_MetaData *md);
346 * 349 *
347 * @param md metadata to modify 350 * @param md metadata to modify
348 */ 351 */
349void GNUNET_CONTAINER_meta_data_add_publication_date (struct 352void
350 GNUNET_CONTAINER_MetaData 353GNUNET_CONTAINER_meta_data_add_publication_date (struct
351 *md); 354 GNUNET_CONTAINER_MetaData *md);
352 355
353 356
354/** 357/**
@@ -359,9 +362,10 @@ void GNUNET_CONTAINER_meta_data_add_publication_date (struct
359 * @param iter_cls closure for iterator 362 * @param iter_cls closure for iterator
360 * @return number of entries 363 * @return number of entries
361 */ 364 */
362int GNUNET_CONTAINER_meta_data_iterate (const struct GNUNET_CONTAINER_MetaData 365int
363 *md, EXTRACTOR_MetaDataProcessor iter, 366GNUNET_CONTAINER_meta_data_iterate (const struct GNUNET_CONTAINER_MetaData *md,
364 void *iter_cls); 367 EXTRACTOR_MetaDataProcessor iter,
368 void *iter_cls);
365 369
366/** 370/**
367 * Get the first MD entry of the given type. Caller 371 * Get the first MD entry of the given type. Caller
@@ -373,9 +377,9 @@ int GNUNET_CONTAINER_meta_data_iterate (const struct GNUNET_CONTAINER_MetaData
373 * @param type type to look for 377 * @param type type to look for
374 * @return NULL if no entry was found 378 * @return NULL if no entry was found
375 */ 379 */
376char *GNUNET_CONTAINER_meta_data_get_by_type (const struct 380char *
377 GNUNET_CONTAINER_MetaData *md, 381GNUNET_CONTAINER_meta_data_get_by_type (const struct GNUNET_CONTAINER_MetaData
378 enum EXTRACTOR_MetaType type); 382 *md, enum EXTRACTOR_MetaType type);
379 383
380 384
381/** 385/**
@@ -389,9 +393,10 @@ char *GNUNET_CONTAINER_meta_data_get_by_type (const struct
389 * @return NULL if we do not have any such entry, 393 * @return NULL if we do not have any such entry,
390 * otherwise client is responsible for freeing the value! 394 * otherwise client is responsible for freeing the value!
391 */ 395 */
392char *GNUNET_CONTAINER_meta_data_get_first_by_types (const struct 396char *
393 GNUNET_CONTAINER_MetaData 397GNUNET_CONTAINER_meta_data_get_first_by_types (const struct
394 *md, ...); 398 GNUNET_CONTAINER_MetaData *md,
399 ...);
395 400
396/** 401/**
397 * Get a thumbnail from the meta-data (if present). Only matches meta 402 * Get a thumbnail from the meta-data (if present). Only matches meta
@@ -402,9 +407,9 @@ char *GNUNET_CONTAINER_meta_data_get_first_by_types (const struct
402 * freed by the caller! 407 * freed by the caller!
403 * @return number of bytes in thumbnail, 0 if not available 408 * @return number of bytes in thumbnail, 0 if not available
404 */ 409 */
405size_t GNUNET_CONTAINER_meta_data_get_thumbnail (const struct 410size_t
406 GNUNET_CONTAINER_MetaData *md, 411GNUNET_CONTAINER_meta_data_get_thumbnail (const struct GNUNET_CONTAINER_MetaData
407 unsigned char **thumb); 412 *md, unsigned char **thumb);
408 413
409 414
410 415
@@ -445,7 +450,7 @@ enum GNUNET_CONTAINER_MetaDataSerializationOptions
445 * -1 on error (typically: not enough 450 * -1 on error (typically: not enough
446 * space) 451 * space)
447 */ 452 */
448ssize_t 453ssize_t
449GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData 454GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
450 *md, char **target, size_t max, 455 *md, char **target, size_t max,
451 enum 456 enum
@@ -459,7 +464,7 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
459 * @param md metadata to inspect 464 * @param md metadata to inspect
460 * @return number of bytes needed for serialization, -1 on error 465 * @return number of bytes needed for serialization, -1 on error
461 */ 466 */
462ssize_t 467ssize_t
463GNUNET_CONTAINER_meta_data_get_serialized_size (const struct 468GNUNET_CONTAINER_meta_data_get_serialized_size (const struct
464 GNUNET_CONTAINER_MetaData *md); 469 GNUNET_CONTAINER_MetaData *md);
465 470
@@ -472,11 +477,8 @@ GNUNET_CONTAINER_meta_data_get_serialized_size (const struct
472 * @return MD on success, NULL on error (i.e. 477 * @return MD on success, NULL on error (i.e.
473 * bad format) 478 * bad format)
474 */ 479 */
475struct GNUNET_CONTAINER_MetaData *GNUNET_CONTAINER_meta_data_deserialize (const 480struct GNUNET_CONTAINER_MetaData *
476 char 481GNUNET_CONTAINER_meta_data_deserialize (const char *input, size_t size);
477 *input,
478 size_t
479 size);
480 482
481 483
482/* ******************************* HashMap **************************** */ 484/* ******************************* HashMap **************************** */
@@ -541,8 +543,8 @@ typedef int (*GNUNET_CONTAINER_HashMapIterator) (void *cls,
541 * @param len initial size (map will grow as needed) 543 * @param len initial size (map will grow as needed)
542 * @return NULL on error 544 * @return NULL on error
543 */ 545 */
544struct GNUNET_CONTAINER_MultiHashMap 546struct GNUNET_CONTAINER_MultiHashMap *
545 *GNUNET_CONTAINER_multihashmap_create (unsigned int len); 547GNUNET_CONTAINER_multihashmap_create (unsigned int len);
546 548
547 549
548/** 550/**
@@ -551,8 +553,9 @@ struct GNUNET_CONTAINER_MultiHashMap
551 * 553 *
552 * @param map the map 554 * @param map the map
553 */ 555 */
554void GNUNET_CONTAINER_multihashmap_destroy (struct GNUNET_CONTAINER_MultiHashMap 556void
555 *map); 557GNUNET_CONTAINER_multihashmap_destroy (struct GNUNET_CONTAINER_MultiHashMap
558 *map);
556 559
557 560
558/** 561/**
@@ -565,9 +568,9 @@ void GNUNET_CONTAINER_multihashmap_destroy (struct GNUNET_CONTAINER_MultiHashMap
565 * happen to be NULL; use "contains" to test for 568 * happen to be NULL; use "contains" to test for
566 * key-value pairs with value NULL 569 * key-value pairs with value NULL
567 */ 570 */
568void *GNUNET_CONTAINER_multihashmap_get (const struct 571void *
569 GNUNET_CONTAINER_MultiHashMap *map, 572GNUNET_CONTAINER_multihashmap_get (const struct GNUNET_CONTAINER_MultiHashMap
570 const GNUNET_HashCode * key); 573 *map, const GNUNET_HashCode * key);
571 574
572 575
573/** 576/**
@@ -581,9 +584,9 @@ void *GNUNET_CONTAINER_multihashmap_get (const struct
581 * @return GNUNET_YES on success, GNUNET_NO if the key-value pair 584 * @return GNUNET_YES on success, GNUNET_NO if the key-value pair
582 * is not in the map 585 * is not in the map
583 */ 586 */
584int GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap 587int
585 *map, const GNUNET_HashCode * key, 588GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap *map,
586 void *value); 589 const GNUNET_HashCode * key, void *value);
587 590
588/** 591/**
589 * Remove all entries for the given key from the map. 592 * Remove all entries for the given key from the map.
@@ -593,10 +596,9 @@ int GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap
593 * @param key identifies values to be removed 596 * @param key identifies values to be removed
594 * @return number of values removed 597 * @return number of values removed
595 */ 598 */
596int GNUNET_CONTAINER_multihashmap_remove_all (struct 599int
597 GNUNET_CONTAINER_MultiHashMap 600GNUNET_CONTAINER_multihashmap_remove_all (struct GNUNET_CONTAINER_MultiHashMap
598 *map, 601 *map, const GNUNET_HashCode * key);
599 const GNUNET_HashCode * key);
600 602
601 603
602/** 604/**
@@ -608,9 +610,10 @@ int GNUNET_CONTAINER_multihashmap_remove_all (struct
608 * @return GNUNET_YES if such a value exists, 610 * @return GNUNET_YES if such a value exists,
609 * GNUNET_NO if not 611 * GNUNET_NO if not
610 */ 612 */
611int GNUNET_CONTAINER_multihashmap_contains (const struct 613int
612 GNUNET_CONTAINER_MultiHashMap *map, 614GNUNET_CONTAINER_multihashmap_contains (const struct
613 const GNUNET_HashCode * key); 615 GNUNET_CONTAINER_MultiHashMap *map,
616 const GNUNET_HashCode * key);
614 617
615 618
616/** 619/**
@@ -623,11 +626,11 @@ int GNUNET_CONTAINER_multihashmap_contains (const struct
623 * @return GNUNET_YES if such a value exists, 626 * @return GNUNET_YES if such a value exists,
624 * GNUNET_NO if not 627 * GNUNET_NO if not
625 */ 628 */
626int GNUNET_CONTAINER_multihashmap_contains_value (const struct 629int
627 GNUNET_CONTAINER_MultiHashMap 630GNUNET_CONTAINER_multihashmap_contains_value (const struct
628 *map, 631 GNUNET_CONTAINER_MultiHashMap
629 const GNUNET_HashCode * key, 632 *map, const GNUNET_HashCode * key,
630 const void *value); 633 const void *value);
631 634
632 635
633/** 636/**
@@ -642,11 +645,11 @@ int GNUNET_CONTAINER_multihashmap_contains_value (const struct
642 * GNUNET_SYSERR if UNIQUE_ONLY was the option and the 645 * GNUNET_SYSERR if UNIQUE_ONLY was the option and the
643 * value already exists 646 * value already exists
644 */ 647 */
645int GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap 648int
646 *map, const GNUNET_HashCode * key, 649GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map,
647 void *value, 650 const GNUNET_HashCode * key, void *value,
648 enum GNUNET_CONTAINER_MultiHashMapOption 651 enum GNUNET_CONTAINER_MultiHashMapOption
649 opt); 652 opt);
650 653
651/** 654/**
652 * Get the number of key-value pairs in the map. 655 * Get the number of key-value pairs in the map.
@@ -654,9 +657,9 @@ int GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap
654 * @param map the map 657 * @param map the map
655 * @return the number of key value pairs 658 * @return the number of key value pairs
656 */ 659 */
657unsigned int GNUNET_CONTAINER_multihashmap_size (const struct 660unsigned int
658 GNUNET_CONTAINER_MultiHashMap 661GNUNET_CONTAINER_multihashmap_size (const struct GNUNET_CONTAINER_MultiHashMap
659 *map); 662 *map);
660 663
661 664
662/** 665/**
@@ -668,10 +671,11 @@ unsigned int GNUNET_CONTAINER_multihashmap_size (const struct
668 * @return the number of key value pairs processed, 671 * @return the number of key value pairs processed,
669 * GNUNET_SYSERR if it aborted iteration 672 * GNUNET_SYSERR if it aborted iteration
670 */ 673 */
671int GNUNET_CONTAINER_multihashmap_iterate (const struct 674int
672 GNUNET_CONTAINER_MultiHashMap *map, 675GNUNET_CONTAINER_multihashmap_iterate (const struct
673 GNUNET_CONTAINER_HashMapIterator it, 676 GNUNET_CONTAINER_MultiHashMap *map,
674 void *it_cls); 677 GNUNET_CONTAINER_HashMapIterator it,
678 void *it_cls);
675 679
676 680
677/** 681/**
@@ -684,12 +688,12 @@ int GNUNET_CONTAINER_multihashmap_iterate (const struct
684 * @return the number of key value pairs processed, 688 * @return the number of key value pairs processed,
685 * GNUNET_SYSERR if it aborted iteration 689 * GNUNET_SYSERR if it aborted iteration
686 */ 690 */
687int GNUNET_CONTAINER_multihashmap_get_multiple (const struct 691int
688 GNUNET_CONTAINER_MultiHashMap 692GNUNET_CONTAINER_multihashmap_get_multiple (const struct
689 *map, 693 GNUNET_CONTAINER_MultiHashMap *map,
690 const GNUNET_HashCode * key, 694 const GNUNET_HashCode * key,
691 GNUNET_CONTAINER_HashMapIterator 695 GNUNET_CONTAINER_HashMapIterator it,
692 it, void *it_cls); 696 void *it_cls);
693 697
694 698
695/* ******************** doubly-linked list *************** */ 699/* ******************** doubly-linked list *************** */
@@ -864,9 +868,8 @@ struct GNUNET_CONTAINER_HeapNode;
864 * @param order how should the heap be sorted? 868 * @param order how should the heap be sorted?
865 * @return handle to the heap 869 * @return handle to the heap
866 */ 870 */
867struct GNUNET_CONTAINER_Heap *GNUNET_CONTAINER_heap_create (enum 871struct GNUNET_CONTAINER_Heap *
868 GNUNET_CONTAINER_HeapOrder 872GNUNET_CONTAINER_heap_create (enum GNUNET_CONTAINER_HeapOrder order);
869 order);
870 873
871 874
872/** 875/**
@@ -875,7 +878,8 @@ struct GNUNET_CONTAINER_Heap *GNUNET_CONTAINER_heap_create (enum
875 * 878 *
876 * @param heap heap to destroy 879 * @param heap heap to destroy
877 */ 880 */
878void GNUNET_CONTAINER_heap_destroy (struct GNUNET_CONTAINER_Heap *heap); 881void
882GNUNET_CONTAINER_heap_destroy (struct GNUNET_CONTAINER_Heap *heap);
879 883
880 884
881/** 885/**
@@ -884,7 +888,8 @@ void GNUNET_CONTAINER_heap_destroy (struct GNUNET_CONTAINER_Heap *heap);
884 * @param heap heap to inspect 888 * @param heap heap to inspect
885 * @return NULL if heap is empty 889 * @return NULL if heap is empty
886 */ 890 */
887void *GNUNET_CONTAINER_heap_peek (const struct GNUNET_CONTAINER_Heap *heap); 891void *
892GNUNET_CONTAINER_heap_peek (const struct GNUNET_CONTAINER_Heap *heap);
888 893
889 894
890/** 895/**
@@ -893,8 +898,8 @@ void *GNUNET_CONTAINER_heap_peek (const struct GNUNET_CONTAINER_Heap *heap);
893 * @param heap the heap to get the size of 898 * @param heap the heap to get the size of
894 * @return number of elements stored 899 * @return number of elements stored
895 */ 900 */
896unsigned int GNUNET_CONTAINER_heap_get_size (const struct GNUNET_CONTAINER_Heap 901unsigned int
897 *heap); 902GNUNET_CONTAINER_heap_get_size (const struct GNUNET_CONTAINER_Heap *heap);
898 903
899 904
900/** 905/**
@@ -903,9 +908,9 @@ unsigned int GNUNET_CONTAINER_heap_get_size (const struct GNUNET_CONTAINER_Heap
903 * @param node the node to get the cost of 908 * @param node the node to get the cost of
904 * @return cost of the node 909 * @return cost of the node
905 */ 910 */
906GNUNET_CONTAINER_HeapCostType GNUNET_CONTAINER_heap_node_get_cost (const struct 911GNUNET_CONTAINER_HeapCostType
907 GNUNET_CONTAINER_HeapNode 912GNUNET_CONTAINER_heap_node_get_cost (const struct GNUNET_CONTAINER_HeapNode
908 *node); 913 *node);
909 914
910/** 915/**
911 * Iterator for heap 916 * Iterator for heap
@@ -931,9 +936,10 @@ typedef int (*GNUNET_CONTAINER_HeapIterator) (void *cls,
931 * @param iterator function to call on each entry 936 * @param iterator function to call on each entry
932 * @param iterator_cls closure for iterator 937 * @param iterator_cls closure for iterator
933 */ 938 */
934void GNUNET_CONTAINER_heap_iterate (const struct GNUNET_CONTAINER_Heap *heap, 939void
935 GNUNET_CONTAINER_HeapIterator iterator, 940GNUNET_CONTAINER_heap_iterate (const struct GNUNET_CONTAINER_Heap *heap,
936 void *iterator_cls); 941 GNUNET_CONTAINER_HeapIterator iterator,
942 void *iterator_cls);
937 943
938 944
939/** 945/**
@@ -948,8 +954,9 @@ void GNUNET_CONTAINER_heap_iterate (const struct GNUNET_CONTAINER_Heap *heap,
948 * NULL if the heap is empty. 954 * NULL if the heap is empty.
949 * 955 *
950 */ 956 */
951void *GNUNET_CONTAINER_heap_get_random (struct GNUNET_CONTAINER_Heap *heap, 957void *
952 uint32_t max); 958GNUNET_CONTAINER_heap_get_random (struct GNUNET_CONTAINER_Heap *heap,
959 uint32_t max);
953 960
954 961
955/** 962/**
@@ -963,7 +970,8 @@ void *GNUNET_CONTAINER_heap_get_random (struct GNUNET_CONTAINER_Heap *heap,
963 * @return data stored at the next random node in the walk; 970 * @return data stored at the next random node in the walk;
964 * NULL if the tree is empty. 971 * NULL if the tree is empty.
965 */ 972 */
966void *GNUNET_CONTAINER_heap_walk_get_next (struct GNUNET_CONTAINER_Heap *heap); 973void *
974GNUNET_CONTAINER_heap_walk_get_next (struct GNUNET_CONTAINER_Heap *heap);
967 975
968 976
969/** 977/**
@@ -974,12 +982,9 @@ void *GNUNET_CONTAINER_heap_walk_get_next (struct GNUNET_CONTAINER_Heap *heap);
974 * @param cost cost for the element 982 * @param cost cost for the element
975 * @return node for the new element 983 * @return node for the new element
976 */ 984 */
977struct GNUNET_CONTAINER_HeapNode *GNUNET_CONTAINER_heap_insert (struct 985struct GNUNET_CONTAINER_HeapNode *
978 GNUNET_CONTAINER_Heap 986GNUNET_CONTAINER_heap_insert (struct GNUNET_CONTAINER_Heap *heap, void *element,
979 *heap, 987 GNUNET_CONTAINER_HeapCostType cost);
980 void *element,
981 GNUNET_CONTAINER_HeapCostType
982 cost);
983 988
984 989
985/** 990/**
@@ -988,7 +993,8 @@ struct GNUNET_CONTAINER_HeapNode *GNUNET_CONTAINER_heap_insert (struct
988 * @param heap heap to modify 993 * @param heap heap to modify
989 * @return element data stored at the root node 994 * @return element data stored at the root node
990 */ 995 */
991void *GNUNET_CONTAINER_heap_remove_root (struct GNUNET_CONTAINER_Heap *heap); 996void *
997GNUNET_CONTAINER_heap_remove_root (struct GNUNET_CONTAINER_Heap *heap);
992 998
993 999
994/** 1000/**
@@ -997,8 +1003,8 @@ void *GNUNET_CONTAINER_heap_remove_root (struct GNUNET_CONTAINER_Heap *heap);
997 * @param node node to remove 1003 * @param node node to remove
998 * @return element data stored at the node, NULL if heap is empty 1004 * @return element data stored at the node, NULL if heap is empty
999 */ 1005 */
1000void *GNUNET_CONTAINER_heap_remove_node (struct GNUNET_CONTAINER_HeapNode 1006void *
1001 *node); 1007GNUNET_CONTAINER_heap_remove_node (struct GNUNET_CONTAINER_HeapNode *node);
1002 1008
1003 1009
1004/** 1010/**
@@ -1008,9 +1014,10 @@ void *GNUNET_CONTAINER_heap_remove_node (struct GNUNET_CONTAINER_HeapNode
1008 * @param node node for which the cost is to be changed 1014 * @param node node for which the cost is to be changed
1009 * @param new_cost new cost for the node 1015 * @param new_cost new cost for the node
1010 */ 1016 */
1011void GNUNET_CONTAINER_heap_update_cost (struct GNUNET_CONTAINER_Heap *heap, 1017void
1012 struct GNUNET_CONTAINER_HeapNode *node, 1018GNUNET_CONTAINER_heap_update_cost (struct GNUNET_CONTAINER_Heap *heap,
1013 GNUNET_CONTAINER_HeapCostType new_cost); 1019 struct GNUNET_CONTAINER_HeapNode *node,
1020 GNUNET_CONTAINER_HeapCostType new_cost);
1014 1021
1015 1022
1016/* ******************** Singly linked list *************** */ 1023/* ******************** Singly linked list *************** */
@@ -1057,9 +1064,10 @@ struct GNUNET_CONTAINER_SList_Iterator;
1057 * @param buf payload buffer 1064 * @param buf payload buffer
1058 * @param len length of the buffer 1065 * @param len length of the buffer
1059 */ 1066 */
1060void GNUNET_CONTAINER_slist_add (struct GNUNET_CONTAINER_SList *l, 1067void
1061 enum GNUNET_CONTAINER_SListDisposition disp, 1068GNUNET_CONTAINER_slist_add (struct GNUNET_CONTAINER_SList *l,
1062 const void *buf, size_t len); 1069 enum GNUNET_CONTAINER_SListDisposition disp,
1070 const void *buf, size_t len);
1063 1071
1064 1072
1065/** 1073/**
@@ -1069,9 +1077,10 @@ void GNUNET_CONTAINER_slist_add (struct GNUNET_CONTAINER_SList *l,
1069 * @param buf payload buffer 1077 * @param buf payload buffer
1070 * @param len length of the buffer 1078 * @param len length of the buffer
1071 */ 1079 */
1072void GNUNET_CONTAINER_slist_add_end (struct GNUNET_CONTAINER_SList *l, 1080void
1073 enum GNUNET_CONTAINER_SListDisposition 1081GNUNET_CONTAINER_slist_add_end (struct GNUNET_CONTAINER_SList *l,
1074 disp, const void *buf, size_t len); 1082 enum GNUNET_CONTAINER_SListDisposition disp,
1083 const void *buf, size_t len);
1075 1084
1076 1085
1077/** 1086/**
@@ -1079,22 +1088,25 @@ void GNUNET_CONTAINER_slist_add_end (struct GNUNET_CONTAINER_SList *l,
1079 * @param dst list to append to 1088 * @param dst list to append to
1080 * @param src source 1089 * @param src source
1081 */ 1090 */
1082void GNUNET_CONTAINER_slist_append (struct GNUNET_CONTAINER_SList *dst, 1091void
1083 struct GNUNET_CONTAINER_SList *src); 1092GNUNET_CONTAINER_slist_append (struct GNUNET_CONTAINER_SList *dst,
1093 struct GNUNET_CONTAINER_SList *src);
1084 1094
1085 1095
1086/** 1096/**
1087 * Create a new singly linked list 1097 * Create a new singly linked list
1088 * @return the new list 1098 * @return the new list
1089 */ 1099 */
1090struct GNUNET_CONTAINER_SList *GNUNET_CONTAINER_slist_create (void); 1100struct GNUNET_CONTAINER_SList *
1101GNUNET_CONTAINER_slist_create (void);
1091 1102
1092 1103
1093/** 1104/**
1094 * Destroy a singly linked list 1105 * Destroy a singly linked list
1095 * @param l the list to be destroyed 1106 * @param l the list to be destroyed
1096 */ 1107 */
1097void GNUNET_CONTAINER_slist_destroy (struct GNUNET_CONTAINER_SList *l); 1108void
1109GNUNET_CONTAINER_slist_destroy (struct GNUNET_CONTAINER_SList *l);
1098 1110
1099 1111
1100/** 1112/**
@@ -1103,9 +1115,8 @@ void GNUNET_CONTAINER_slist_destroy (struct GNUNET_CONTAINER_SList *l);
1103 * @param l list 1115 * @param l list
1104 * @return iterator pointing to the beginning, free using "GNUNET_free" 1116 * @return iterator pointing to the beginning, free using "GNUNET_free"
1105 */ 1117 */
1106struct GNUNET_CONTAINER_SList_Iterator *GNUNET_CONTAINER_slist_begin (struct 1118struct GNUNET_CONTAINER_SList_Iterator *
1107 GNUNET_CONTAINER_SList 1119GNUNET_CONTAINER_slist_begin (struct GNUNET_CONTAINER_SList *l);
1108 *l);
1109 1120
1110 1121
1111/** 1122/**
@@ -1113,7 +1124,8 @@ struct GNUNET_CONTAINER_SList_Iterator *GNUNET_CONTAINER_slist_begin (struct
1113 * 1124 *
1114 * @param l list 1125 * @param l list
1115 */ 1126 */
1116void GNUNET_CONTAINER_slist_clear (struct GNUNET_CONTAINER_SList *l); 1127void
1128GNUNET_CONTAINER_slist_clear (struct GNUNET_CONTAINER_SList *l);
1117 1129
1118 1130
1119/** 1131/**
@@ -1122,8 +1134,9 @@ void GNUNET_CONTAINER_slist_clear (struct GNUNET_CONTAINER_SList *l);
1122 * @param buf payload buffer to find 1134 * @param buf payload buffer to find
1123 * @param len length of the payload (number of bytes in buf) 1135 * @param len length of the payload (number of bytes in buf)
1124 */ 1136 */
1125int GNUNET_CONTAINER_slist_contains (const struct GNUNET_CONTAINER_SList *l, 1137int
1126 const void *buf, size_t len); 1138GNUNET_CONTAINER_slist_contains (const struct GNUNET_CONTAINER_SList *l,
1139 const void *buf, size_t len);
1127 1140
1128 1141
1129/** 1142/**
@@ -1131,14 +1144,16 @@ int GNUNET_CONTAINER_slist_contains (const struct GNUNET_CONTAINER_SList *l,
1131 * @param l list 1144 * @param l list
1132 * @return number of elements in the list 1145 * @return number of elements in the list
1133 */ 1146 */
1134int GNUNET_CONTAINER_slist_count (const struct GNUNET_CONTAINER_SList *l); 1147int
1148GNUNET_CONTAINER_slist_count (const struct GNUNET_CONTAINER_SList *l);
1135 1149
1136 1150
1137/** 1151/**
1138 * Remove an element from the list 1152 * Remove an element from the list
1139 * @param i iterator that points to the element to be removed 1153 * @param i iterator that points to the element to be removed
1140 */ 1154 */
1141void GNUNET_CONTAINER_slist_erase (struct GNUNET_CONTAINER_SList_Iterator *i); 1155void
1156GNUNET_CONTAINER_slist_erase (struct GNUNET_CONTAINER_SList_Iterator *i);
1142 1157
1143 1158
1144/** 1159/**
@@ -1148,10 +1163,10 @@ void GNUNET_CONTAINER_slist_erase (struct GNUNET_CONTAINER_SList_Iterator *i);
1148 * @param buf payload buffer 1163 * @param buf payload buffer
1149 * @param len length of the payload 1164 * @param len length of the payload
1150 */ 1165 */
1151void GNUNET_CONTAINER_slist_insert (struct GNUNET_CONTAINER_SList_Iterator 1166void
1152 *before, 1167GNUNET_CONTAINER_slist_insert (struct GNUNET_CONTAINER_SList_Iterator *before,
1153 enum GNUNET_CONTAINER_SListDisposition disp, 1168 enum GNUNET_CONTAINER_SListDisposition disp,
1154 const void *buf, size_t len); 1169 const void *buf, size_t len);
1155 1170
1156 1171
1157/** 1172/**
@@ -1159,7 +1174,8 @@ void GNUNET_CONTAINER_slist_insert (struct GNUNET_CONTAINER_SList_Iterator
1159 * @param i iterator 1174 * @param i iterator
1160 * @return GNUNET_YES on success, GNUNET_NO if the end has been reached 1175 * @return GNUNET_YES on success, GNUNET_NO if the end has been reached
1161 */ 1176 */
1162int GNUNET_CONTAINER_slist_next (struct GNUNET_CONTAINER_SList_Iterator *i); 1177int
1178GNUNET_CONTAINER_slist_next (struct GNUNET_CONTAINER_SList_Iterator *i);
1163 1179
1164 1180
1165/** 1181/**
@@ -1168,7 +1184,8 @@ int GNUNET_CONTAINER_slist_next (struct GNUNET_CONTAINER_SList_Iterator *i);
1168 * @return GNUNET_YES if the end has been reached, GNUNET_NO if the iterator 1184 * @return GNUNET_YES if the end has been reached, GNUNET_NO if the iterator
1169 * points to a valid element 1185 * points to a valid element
1170 */ 1186 */
1171int GNUNET_CONTAINER_slist_end (struct GNUNET_CONTAINER_SList_Iterator *i); 1187int
1188GNUNET_CONTAINER_slist_end (struct GNUNET_CONTAINER_SList_Iterator *i);
1172 1189
1173 1190
1174/** 1191/**
@@ -1178,16 +1195,17 @@ int GNUNET_CONTAINER_slist_end (struct GNUNET_CONTAINER_SList_Iterator *i);
1178 * @param len set to the payload length 1195 * @param len set to the payload length
1179 * @return payload 1196 * @return payload
1180 */ 1197 */
1181void *GNUNET_CONTAINER_slist_get (const struct GNUNET_CONTAINER_SList_Iterator 1198void *
1182 *i, size_t * len); 1199GNUNET_CONTAINER_slist_get (const struct GNUNET_CONTAINER_SList_Iterator *i,
1200 size_t * len);
1183 1201
1184 1202
1185/** 1203/**
1186 * Release an iterator 1204 * Release an iterator
1187 * @param i iterator 1205 * @param i iterator
1188 */ 1206 */
1189void GNUNET_CONTAINER_slist_iter_destroy (struct GNUNET_CONTAINER_SList_Iterator 1207void
1190 *i); 1208GNUNET_CONTAINER_slist_iter_destroy (struct GNUNET_CONTAINER_SList_Iterator *i);
1191 1209
1192 1210
1193#if 0 /* keep Emacsens' auto-indent happy */ 1211#if 0 /* keep Emacsens' auto-indent happy */