aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_container_lib.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-08-21 15:16:58 +0000
committerChristian Grothoff <christian@grothoff.org>2013-08-21 15:16:58 +0000
commit5a38c8f0d1826ea964e3e3452e1a3a2a24d7d35b (patch)
tree7ba261fc1882bcfa6dc0da916272a0ed0d17468e /src/include/gnunet_container_lib.h
parent1fca0c918c8468ba16666e8a1c41526cacdc6df2 (diff)
downloadgnunet-5a38c8f0d1826ea964e3e3452e1a3a2a24d7d35b.tar.gz
gnunet-5a38c8f0d1826ea964e3e3452e1a3a2a24d7d35b.zip
-misc doxygen fixes
Diffstat (limited to 'src/include/gnunet_container_lib.h')
-rw-r--r--src/include/gnunet_container_lib.h284
1 files changed, 198 insertions, 86 deletions
diff --git a/src/include/gnunet_container_lib.h b/src/include/gnunet_container_lib.h
index c0aa176c5..a808c52a6 100644
--- a/src/include/gnunet_container_lib.h
+++ b/src/include/gnunet_container_lib.h
@@ -1,10 +1,10 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010 Christian Grothoff (and other contributing authors) 3 (C) 2001-2013 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 2, or (at your 7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version. 8 option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
@@ -21,9 +21,13 @@
21/** 21/**
22 * @file include/gnunet_container_lib.h 22 * @file include/gnunet_container_lib.h
23 * @brief container classes for GNUnet 23 * @brief container classes for GNUnet
24 *
25 * @author Christian Grothoff 24 * @author Christian Grothoff
26 * @author Nils Durner 25 * @author Nils Durner
26 * @defgroup hashmap multi hash-map
27 * @defgroup heap min- or max-heap with arbitrary element removal
28 * @defgroup bloomfilter Bloom filter (probabilistic set tests)
29 * @defgroup dll Doubly-linked list
30 * @defgroup metadata Meta data (GNU libextractor key-value pairs)
27 */ 31 */
28 32
29#ifndef GNUNET_CONTAINER_LIB_H 33#ifndef GNUNET_CONTAINER_LIB_H
@@ -51,28 +55,31 @@ extern "C"
51 55
52/** 56/**
53 * @brief bloomfilter representation (opaque) 57 * @brief bloomfilter representation (opaque)
58 * @ingroup bloomfilter
54 */ 59 */
55struct GNUNET_CONTAINER_BloomFilter; 60struct GNUNET_CONTAINER_BloomFilter;
56 61
57/** 62/**
58 * Iterator over HashCodes. 63 * @ingroup bloomfilter
64 * Iterator over struct GNUNET_HashCodes.
59 * 65 *
60 * @param cls closure 66 * @param cls closure
61 * @param next set to the next hash code 67 * @param next set to the next hash code
62 * @return GNUNET_YES if next was updated 68 * @return #GNUNET_YES if next was updated
63 * GNUNET_NO if there are no more entries 69 * #GNUNET_NO if there are no more entries
64 */ 70 */
65typedef int (*GNUNET_HashCodeIterator) (void *cls, struct GNUNET_HashCode * next); 71typedef int (*GNUNET_HashCodeIterator) (void *cls, struct GNUNET_HashCode * next);
66 72
67 73
68/** 74/**
69 * Load a bloom-filter from a file. 75 * @ingroup bloomfilter
76 * Load a Bloom filter from a file.
70 * 77 *
71 * @param filename the name of the file (or the prefix) 78 * @param filename the name of the file (or the prefix)
72 * @param size the size of the bloom-filter (number of 79 * @param size the size of the bloom-filter (number of
73 * bytes of storage space to use); will be rounded up 80 * bytes of storage space to use); will be rounded up
74 * to next power of 2 81 * to next power of 2
75 * @param k the number of GNUNET_CRYPTO_hash-functions to apply per 82 * @param k the number of #GNUNET_CRYPTO_hash-functions to apply per
76 * element (number of bits set per element in the set) 83 * element (number of bits set per element in the set)
77 * @return the bloomfilter 84 * @return the bloomfilter
78 */ 85 */
@@ -82,15 +89,16 @@ GNUNET_CONTAINER_bloomfilter_load (const char *filename, size_t size,
82 89
83 90
84/** 91/**
85 * Create a bloom filter from raw bits. 92 * @ingroup bloomfilter
93 * Create a Bloom filter from raw bits.
86 * 94 *
87 * @param data the raw bits in memory (maybe NULL, 95 * @param data the raw bits in memory (maybe NULL,
88 * in which case all bits should be considered 96 * in which case all bits should be considered
89 * to be zero). 97 * to be zero).
90 * @param size the size of the bloom-filter (number of 98 * @param size the size of the bloom-filter (number of
91 * bytes of storage space to use); also size of data 99 * bytes of storage space to use); also size of @a data
92 * -- unless data is NULL. Must be a power of 2. 100 * -- unless data is NULL. Must be a power of 2.
93 * @param k the number of GNUNET_CRYPTO_hash-functions to apply per 101 * @param k the number of #GNUNET_CRYPTO_hash-functions to apply per
94 * element (number of bits set per element in the set) 102 * element (number of bits set per element in the set)
95 * @return the bloomfilter 103 * @return the bloomfilter
96 */ 104 */
@@ -100,12 +108,13 @@ GNUNET_CONTAINER_bloomfilter_init (const char *data, size_t size,
100 108
101 109
102/** 110/**
103 * Copy the raw data of this bloomfilter into 111 * @ingroup bloomfilter
112 * Copy the raw data of this Bloom filter into
104 * the given data array. 113 * the given data array.
105 * 114 *
106 * @param data where to write the data 115 * @param data where to write the data
107 * @param size the size of the given data array 116 * @param size the size of the given @a data array
108 * @return GNUNET_SYSERR if the data array of the wrong size 117 * @return #GNUNET_SYSERR if the data array of the wrong size
109 */ 118 */
110int 119int
111GNUNET_CONTAINER_bloomfilter_get_raw_data (const struct 120GNUNET_CONTAINER_bloomfilter_get_raw_data (const struct
@@ -114,10 +123,12 @@ GNUNET_CONTAINER_bloomfilter_get_raw_data (const struct
114 123
115 124
116/** 125/**
126 * @ingroup bloomfilter
117 * Test if an element is in the filter. 127 * Test if an element is in the filter.
128 *
118 * @param e the element 129 * @param e the element
119 * @param bf the filter 130 * @param bf the filter
120 * @return GNUNET_YES if the element is in the filter, GNUNET_NO if not 131 * @return #GNUNET_YES if the element is in the filter, #GNUNET_NO if not
121 */ 132 */
122int 133int
123GNUNET_CONTAINER_bloomfilter_test (const struct GNUNET_CONTAINER_BloomFilter 134GNUNET_CONTAINER_bloomfilter_test (const struct GNUNET_CONTAINER_BloomFilter
@@ -125,7 +136,9 @@ GNUNET_CONTAINER_bloomfilter_test (const struct GNUNET_CONTAINER_BloomFilter
125 136
126 137
127/** 138/**
128 * Add an element to the filter 139 * @ingroup bloomfilter
140 * Add an element to the filter.
141 *
129 * @param bf the filter 142 * @param bf the filter
130 * @param e the element 143 * @param e the element
131 */ 144 */
@@ -135,7 +148,9 @@ GNUNET_CONTAINER_bloomfilter_add (struct GNUNET_CONTAINER_BloomFilter *bf,
135 148
136 149
137/** 150/**
151 * @ingroup bloomfilter
138 * Remove an element from the filter. 152 * Remove an element from the filter.
153 *
139 * @param bf the filter 154 * @param bf the filter
140 * @param e the element to remove 155 * @param e the element to remove
141 */ 156 */
@@ -145,6 +160,7 @@ GNUNET_CONTAINER_bloomfilter_remove (struct GNUNET_CONTAINER_BloomFilter *bf,
145 160
146 161
147/** 162/**
163 * @ingroup bloomfilter
148 * Create a copy of a bloomfilter. 164 * Create a copy of a bloomfilter.
149 * 165 *
150 * @param bf the filter 166 * @param bf the filter
@@ -157,9 +173,11 @@ GNUNET_CONTAINER_bloomfilter_copy (const struct GNUNET_CONTAINER_BloomFilter
157 173
158 174
159/** 175/**
176 * @ingroup bloomfilter
160 * Free the space associcated with a filter 177 * Free the space associcated with a filter
161 * in memory, flush to drive if needed (do not 178 * in memory, flush to drive if needed (do not
162 * free the space on the drive) 179 * free the space on the drive).
180 *
163 * @param bf the filter 181 * @param bf the filter
164 */ 182 */
165void 183void
@@ -167,6 +185,7 @@ GNUNET_CONTAINER_bloomfilter_free (struct GNUNET_CONTAINER_BloomFilter *bf);
167 185
168 186
169/** 187/**
188 * @ingroup bloomfilter
170 * Get size of the bloom filter. 189 * Get size of the bloom filter.
171 * 190 *
172 * @param bf the filter 191 * @param bf the filter
@@ -178,52 +197,58 @@ GNUNET_CONTAINER_bloomfilter_get_size (const struct GNUNET_CONTAINER_BloomFilter
178 197
179 198
180/** 199/**
181 * Reset a bloom filter to empty. 200 * @ingroup bloomfilter
201 * Reset a Bloom filter to empty.
202 *
182 * @param bf the filter 203 * @param bf the filter
183 */ 204 */
184void 205void
185GNUNET_CONTAINER_bloomfilter_clear (struct GNUNET_CONTAINER_BloomFilter *bf); 206GNUNET_CONTAINER_bloomfilter_clear (struct GNUNET_CONTAINER_BloomFilter *bf);
186 207
208
187/** 209/**
188 * Or the entries of the given raw data array with the 210 * @ingroup bloomfilter
189 * data of the given bloom filter. Assumes that 211 * "or" the entries of the given raw data array with the
190 * the size of the data array and the current filter 212 * data of the given Bloom filter. Assumes that
213 * the @a size of the @a data array and the current filter
191 * match. 214 * match.
192 * 215 *
193 * @param bf the filter 216 * @param bf the filter
194 * @param data data to OR-in 217 * @param data data to OR-in
195 * @param size size of data 218 * @param size size of @a data
196 * @return GNUNET_OK on success 219 * @return #GNUNET_OK on success
197 */ 220 */
198int 221int
199GNUNET_CONTAINER_bloomfilter_or (struct GNUNET_CONTAINER_BloomFilter *bf, 222GNUNET_CONTAINER_bloomfilter_or (struct GNUNET_CONTAINER_BloomFilter *bf,
200 const char *data, size_t size); 223 const char *data, size_t size);
201 224
225
202/** 226/**
203 * Or the entries of the given raw data array with the 227 * @ingroup bloomfilter
204 * data of the given bloom filter. Assumes that 228 * "or" the entries of the given raw data array with the
205 * the size of the data array and the current filter 229 * data of the given Bloom filter. Assumes that
206 * match. 230 * the size of the two filters matches.
207 * 231 *
208 * @param bf the filter 232 * @param bf the filter
209 * @param to_or the bloomfilter to or-in 233 * @param to_or the bloomfilter to or-in
210 * @param size number of bytes in data 234 * @return #GNUNET_OK on success
211 */ 235 */
212int 236int
213GNUNET_CONTAINER_bloomfilter_or2 (struct GNUNET_CONTAINER_BloomFilter *bf, 237GNUNET_CONTAINER_bloomfilter_or2 (struct GNUNET_CONTAINER_BloomFilter *bf,
214 const struct GNUNET_CONTAINER_BloomFilter 238 const struct GNUNET_CONTAINER_BloomFilter
215 *to_or, size_t size); 239 *to_or);
216 240
217/** 241/**
242 * @ingroup bloomfilter
218 * Resize a bloom filter. Note that this operation 243 * Resize a bloom filter. Note that this operation
219 * is pretty costly. Essentially, the bloom filter 244 * is pretty costly. Essentially, the Bloom filter
220 * needs to be completely re-build. 245 * needs to be completely re-build.
221 * 246 *
222 * @param bf the filter 247 * @param bf the filter
223 * @param iterator an iterator over all elements stored in the BF 248 * @param iterator an iterator over all elements stored in the BF
224 * @param iterator_cls closure for iterator 249 * @param iterator_cls closure for @a iterator
225 * @param size the new size for the filter 250 * @param size the new size for the filter
226 * @param k the new number of GNUNET_CRYPTO_hash-function to apply per element 251 * @param k the new number of #GNUNET_CRYPTO_hash-function to apply per element
227 */ 252 */
228void 253void
229GNUNET_CONTAINER_bloomfilter_resize (struct GNUNET_CONTAINER_BloomFilter *bf, 254GNUNET_CONTAINER_bloomfilter_resize (struct GNUNET_CONTAINER_BloomFilter *bf,
@@ -231,22 +256,27 @@ GNUNET_CONTAINER_bloomfilter_resize (struct GNUNET_CONTAINER_BloomFilter *bf,
231 void *iterator_cls, size_t size, 256 void *iterator_cls, size_t size,
232 unsigned int k); 257 unsigned int k);
233 258
259
234/* ****************** metadata ******************* */ 260/* ****************** metadata ******************* */
235 261
236/** 262/**
263 * @ingroup metadata
237 * Meta data to associate with a file, directory or namespace. 264 * Meta data to associate with a file, directory or namespace.
238 */ 265 */
239struct GNUNET_CONTAINER_MetaData; 266struct GNUNET_CONTAINER_MetaData;
240 267
241/** 268/**
242 * Create a fresh MetaData token. 269 * @ingroup metadata
270 * Create a fresh meta data container.
243 * 271 *
244 * @return empty meta-data container 272 * @return empty meta-data container
245 */ 273 */
246struct GNUNET_CONTAINER_MetaData * 274struct GNUNET_CONTAINER_MetaData *
247GNUNET_CONTAINER_meta_data_create (void); 275GNUNET_CONTAINER_meta_data_create (void);
248 276
277
249/** 278/**
279 * @ingroup metadata
250 * Duplicate a MetaData token. 280 * Duplicate a MetaData token.
251 * 281 *
252 * @param md what to duplicate 282 * @param md what to duplicate
@@ -257,6 +287,7 @@ GNUNET_CONTAINER_meta_data_duplicate (const struct GNUNET_CONTAINER_MetaData
257 *md); 287 *md);
258 288
259/** 289/**
290 * @ingroup metadata
260 * Free meta data. 291 * Free meta data.
261 * 292 *
262 * @param md what to free 293 * @param md what to free
@@ -264,7 +295,9 @@ GNUNET_CONTAINER_meta_data_duplicate (const struct GNUNET_CONTAINER_MetaData
264void 295void
265GNUNET_CONTAINER_meta_data_destroy (struct GNUNET_CONTAINER_MetaData *md); 296GNUNET_CONTAINER_meta_data_destroy (struct GNUNET_CONTAINER_MetaData *md);
266 297
298
267/** 299/**
300 * @ingroup metadata
268 * Test if two MDs are equal. We consider them equal if 301 * Test if two MDs are equal. We consider them equal if
269 * the meta types, formats and content match (we do not 302 * the meta types, formats and content match (we do not
270 * include the mime types and plugins names in this 303 * include the mime types and plugins names in this
@@ -272,7 +305,7 @@ GNUNET_CONTAINER_meta_data_destroy (struct GNUNET_CONTAINER_MetaData *md);
272 * 305 *
273 * @param md1 first value to check 306 * @param md1 first value to check
274 * @param md2 other value to check 307 * @param md2 other value to check
275 * @return GNUNET_YES if they are equal 308 * @return #GNUNET_YES if they are equal
276 */ 309 */
277int 310int
278GNUNET_CONTAINER_meta_data_test_equal (const struct GNUNET_CONTAINER_MetaData 311GNUNET_CONTAINER_meta_data_test_equal (const struct GNUNET_CONTAINER_MetaData
@@ -282,6 +315,7 @@ GNUNET_CONTAINER_meta_data_test_equal (const struct GNUNET_CONTAINER_MetaData
282 315
283 316
284/** 317/**
318 * @ingroup metadata
285 * Extend metadata. 319 * Extend metadata.
286 * 320 *
287 * @param md metadata to extend 321 * @param md metadata to extend
@@ -295,7 +329,7 @@ GNUNET_CONTAINER_meta_data_test_equal (const struct GNUNET_CONTAINER_MetaData
295 * can be NULL (if mime-type is not known) 329 * can be NULL (if mime-type is not known)
296 * @param data actual meta-data found 330 * @param data actual meta-data found
297 * @param data_size number of bytes in data 331 * @param data_size number of bytes in data
298 * @return GNUNET_OK on success, GNUNET_SYSERR if this entry already exists 332 * @return #GNUNET_OK on success, #GNUNET_SYSERR if this entry already exists
299 * data_mime_type and plugin_name are not considered for "exists" checks 333 * data_mime_type and plugin_name are not considered for "exists" checks
300 */ 334 */
301int 335int
@@ -308,6 +342,7 @@ GNUNET_CONTAINER_meta_data_insert (struct GNUNET_CONTAINER_MetaData *md,
308 342
309 343
310/** 344/**
345 * @ingroup metadata
311 * Extend metadata. Merges the meta data from the second argument 346 * Extend metadata. Merges the meta data from the second argument
312 * into the first, discarding duplicate key-value pairs. 347 * into the first, discarding duplicate key-value pairs.
313 * 348 *
@@ -320,6 +355,7 @@ GNUNET_CONTAINER_meta_data_merge (struct GNUNET_CONTAINER_MetaData *md,
320 355
321 356
322/** 357/**
358 * @ingroup metadata
323 * Remove an item. 359 * Remove an item.
324 * 360 *
325 * @param md metadata to manipulate 361 * @param md metadata to manipulate
@@ -327,7 +363,7 @@ GNUNET_CONTAINER_meta_data_merge (struct GNUNET_CONTAINER_MetaData *md,
327 * @param data specific value to remove, NULL to remove all 363 * @param data specific value to remove, NULL to remove all
328 * entries of the given type 364 * entries of the given type
329 * @param data_size number of bytes in data 365 * @param data_size number of bytes in data
330 * @return GNUNET_OK on success, GNUNET_SYSERR if the item does not exist in md 366 * @return #GNUNET_OK on success, #GNUNET_SYSERR if the item does not exist in md
331 */ 367 */
332int 368int
333GNUNET_CONTAINER_meta_data_delete (struct GNUNET_CONTAINER_MetaData *md, 369GNUNET_CONTAINER_meta_data_delete (struct GNUNET_CONTAINER_MetaData *md,
@@ -336,6 +372,7 @@ GNUNET_CONTAINER_meta_data_delete (struct GNUNET_CONTAINER_MetaData *md,
336 372
337 373
338/** 374/**
375 * @ingroup metadata
339 * Remove all items in the container. 376 * Remove all items in the container.
340 * 377 *
341 * @param md metadata to manipulate 378 * @param md metadata to manipulate
@@ -345,6 +382,7 @@ GNUNET_CONTAINER_meta_data_clear (struct GNUNET_CONTAINER_MetaData *md);
345 382
346 383
347/** 384/**
385 * @ingroup metadata
348 * Add the current time as the publication date 386 * Add the current time as the publication date
349 * to the meta-data. 387 * to the meta-data.
350 * 388 *
@@ -356,11 +394,12 @@ GNUNET_CONTAINER_meta_data_add_publication_date (struct
356 394
357 395
358/** 396/**
397 * @ingroup metadata
359 * Iterate over MD entries. 398 * Iterate over MD entries.
360 * 399 *
361 * @param md metadata to inspect 400 * @param md metadata to inspect
362 * @param iter function to call on each entry 401 * @param iter function to call on each entry
363 * @param iter_cls closure for iterator 402 * @param iter_cls closure for @a iter
364 * @return number of entries 403 * @return number of entries
365 */ 404 */
366int 405int
@@ -369,6 +408,7 @@ GNUNET_CONTAINER_meta_data_iterate (const struct GNUNET_CONTAINER_MetaData *md,
369 void *iter_cls); 408 void *iter_cls);
370 409
371/** 410/**
411 * @ingroup metadata
372 * Get the first MD entry of the given type. Caller 412 * Get the first MD entry of the given type. Caller
373 * is responsible for freeing the return value. 413 * is responsible for freeing the return value.
374 * Also, only meta data items that are strings (0-terminated) 414 * Also, only meta data items that are strings (0-terminated)
@@ -384,6 +424,7 @@ GNUNET_CONTAINER_meta_data_get_by_type (const struct GNUNET_CONTAINER_MetaData
384 424
385 425
386/** 426/**
427 * @ingroup metadata
387 * Get the first matching MD entry of the given types. Caller is 428 * Get the first matching MD entry of the given types. Caller is
388 * responsible for freeing the return value. Also, only meta data 429 * responsible for freeing the return value. Also, only meta data
389 * items that are strings (0-terminated) are returned by this 430 * items that are strings (0-terminated) are returned by this
@@ -400,6 +441,7 @@ GNUNET_CONTAINER_meta_data_get_first_by_types (const struct
400 ...); 441 ...);
401 442
402/** 443/**
444 * @ingroup metadata
403 * Get a thumbnail from the meta-data (if present). Only matches meta 445 * Get a thumbnail from the meta-data (if present). Only matches meta
404 * data with mime type "image" and binary format. 446 * data with mime type "image" and binary format.
405 * 447 *
@@ -415,22 +457,26 @@ GNUNET_CONTAINER_meta_data_get_thumbnail (const struct GNUNET_CONTAINER_MetaData
415 457
416 458
417/** 459/**
460 * @ingroup metadata
418 * Options for metadata serialization. 461 * Options for metadata serialization.
419 */ 462 */
420enum GNUNET_CONTAINER_MetaDataSerializationOptions 463enum GNUNET_CONTAINER_MetaDataSerializationOptions
421{ 464{
422 /** 465 /**
466 * @ingroup metadata
423 * Serialize all of the data. 467 * Serialize all of the data.
424 */ 468 */
425 GNUNET_CONTAINER_META_DATA_SERIALIZE_FULL = 0, 469 GNUNET_CONTAINER_META_DATA_SERIALIZE_FULL = 0,
426 470
427 /** 471 /**
472 * @ingroup metadata
428 * If not enough space is available, it is acceptable 473 * If not enough space is available, it is acceptable
429 * to only serialize some of the metadata. 474 * to only serialize some of the metadata.
430 */ 475 */
431 GNUNET_CONTAINER_META_DATA_SERIALIZE_PART = 1, 476 GNUNET_CONTAINER_META_DATA_SERIALIZE_PART = 1,
432 477
433 /** 478 /**
479 * @ingroup metadata
434 * Speed is of the essence, do not allow compression. 480 * Speed is of the essence, do not allow compression.
435 */ 481 */
436 GNUNET_CONTAINER_META_DATA_SERIALIZE_NO_COMPRESS = 2 482 GNUNET_CONTAINER_META_DATA_SERIALIZE_NO_COMPRESS = 2
@@ -438,6 +484,7 @@ enum GNUNET_CONTAINER_MetaDataSerializationOptions
438 484
439 485
440/** 486/**
487 * @ingroup metadata
441 * Serialize meta-data to target. 488 * Serialize meta-data to target.
442 * 489 *
443 * @param md metadata to serialize 490 * @param md metadata to serialize
@@ -460,6 +507,7 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
460 507
461 508
462/** 509/**
510 * @ingroup metadata
463 * Get the size of the full meta-data in serialized form. 511 * Get the size of the full meta-data in serialized form.
464 * 512 *
465 * @param md metadata to inspect 513 * @param md metadata to inspect
@@ -471,6 +519,7 @@ GNUNET_CONTAINER_meta_data_get_serialized_size (const struct
471 519
472 520
473/** 521/**
522 * @ingroup metadata
474 * Deserialize meta-data. Initializes md. 523 * Deserialize meta-data. Initializes md.
475 * 524 *
476 * @param input serialized meta-data. 525 * @param input serialized meta-data.
@@ -485,23 +534,27 @@ GNUNET_CONTAINER_meta_data_deserialize (const char *input, size_t size);
485/* ******************************* HashMap **************************** */ 534/* ******************************* HashMap **************************** */
486 535
487/** 536/**
537 * @ingroup hashmap
488 * Opaque handle for a HashMap. 538 * Opaque handle for a HashMap.
489 */ 539 */
490struct GNUNET_CONTAINER_MultiHashMap; 540struct GNUNET_CONTAINER_MultiHashMap;
491 541
492/** 542/**
543 * @ingroup hashmap
493 * Opaque handle to an iterator over 544 * Opaque handle to an iterator over
494 * a multihashmap. 545 * a multihashmap.
495 */ 546 */
496struct GNUNET_CONTAINER_MultiHashMapIterator; 547struct GNUNET_CONTAINER_MultiHashMapIterator;
497 548
498/** 549/**
550 * @ingroup hashmap
499 * Options for storing values in the HashMap. 551 * Options for storing values in the HashMap.
500 */ 552 */
501enum GNUNET_CONTAINER_MultiHashMapOption 553enum GNUNET_CONTAINER_MultiHashMapOption
502{ 554{
503 555
504 /** 556 /**
557 * @ingroup hashmap
505 * If a value with the given key exists, replace it. Note that the 558 * If a value with the given key exists, replace it. Note that the
506 * old value would NOT be freed by replace (the application has to 559 * old value would NOT be freed by replace (the application has to
507 * make sure that this happens if required). 560 * make sure that this happens if required).
@@ -509,35 +562,41 @@ enum GNUNET_CONTAINER_MultiHashMapOption
509 GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE, 562 GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE,
510 563
511 /** 564 /**
565 * @ingroup hashmap
512 * Allow multiple values with the same key. 566 * Allow multiple values with the same key.
513 */ 567 */
514 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, 568 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE,
515 569
516 /** 570 /**
571 * @ingroup hashmap
517 * There must only be one value per key; storing a value should fail 572 * There must only be one value per key; storing a value should fail
518 * if a value under the same key already exists. 573 * if a value under the same key already exists.
519 */ 574 */
520 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY, 575 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY,
521 576
522 /** 577 /**
523 * There must only be one value per key, but don't bother checking 578 * @ingroup hashmap There must only be one value per key, but don't
524 * if a value already exists (faster than UNIQUE_ONLY; implemented 579 * bother checking if a value already exists (faster than
525 * just like MULTIPLE but this option documents better what is 580 * #GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY; implemented
526 * intended if UNIQUE is what is desired). 581 * just like #GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE but this
582 * option documents better what is intended if
583 * #GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY is what is
584 * desired).
527 */ 585 */
528 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST 586 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST
529}; 587};
530 588
531 589
532/** 590/**
591 * @ingroup hashmap
533 * Iterator over hash map entries. 592 * Iterator over hash map entries.
534 * 593 *
535 * @param cls closure 594 * @param cls closure
536 * @param key current key code 595 * @param key current key code
537 * @param value value in the hash map 596 * @param value value in the hash map
538 * @return GNUNET_YES if we should continue to 597 * @return #GNUNET_YES if we should continue to
539 * iterate, 598 * iterate,
540 * GNUNET_NO if not. 599 * #GNUNET_NO if not.
541 */ 600 */
542typedef int (*GNUNET_CONTAINER_HashMapIterator) (void *cls, 601typedef int (*GNUNET_CONTAINER_HashMapIterator) (void *cls,
543 const struct GNUNET_HashCode *key, 602 const struct GNUNET_HashCode *key,
@@ -545,11 +604,12 @@ typedef int (*GNUNET_CONTAINER_HashMapIterator) (void *cls,
545 604
546 605
547/** 606/**
607 * @ingroup hashmap
548 * Create a multi hash map. 608 * Create a multi hash map.
549 * 609 *
550 * @param len initial size (map will grow as needed) 610 * @param len initial size (map will grow as needed)
551 * @param do_not_copy_keys GNUNET_NO is always safe and should be used by default; 611 * @param do_not_copy_keys #GNUNET_NO is always safe and should be used by default;
552 * GNUNET_YES means that on 'put', the 'key' does not have 612 * #GNUNET_YES means that on 'put', the 'key' does not have
553 * to be copied as the destination of the pointer is 613 * to be copied as the destination of the pointer is
554 * guaranteed to be life as long as the value is stored in 614 * guaranteed to be life as long as the value is stored in
555 * the hashmap. This can significantly reduce memory 615 * the hashmap. This can significantly reduce memory
@@ -565,6 +625,7 @@ GNUNET_CONTAINER_multihashmap_create (unsigned int len,
565 625
566 626
567/** 627/**
628 * @ingroup hashmap
568 * Destroy a hash map. Will not free any values 629 * Destroy a hash map. Will not free any values
569 * stored in the hash map! 630 * stored in the hash map!
570 * 631 *
@@ -576,6 +637,7 @@ GNUNET_CONTAINER_multihashmap_destroy (struct GNUNET_CONTAINER_MultiHashMap
576 637
577 638
578/** 639/**
640 * @ingroup hashmap
579 * Given a key find a value in the map matching the key. 641 * Given a key find a value in the map matching the key.
580 * 642 *
581 * @param map the map 643 * @param map the map
@@ -591,6 +653,7 @@ GNUNET_CONTAINER_multihashmap_get (const struct GNUNET_CONTAINER_MultiHashMap
591 653
592 654
593/** 655/**
656 * @ingroup hashmap
594 * Remove the given key-value pair from the map. Note that if the 657 * Remove the given key-value pair from the map. Note that if the
595 * key-value pair is in the map multiple times, only one of the pairs 658 * key-value pair is in the map multiple times, only one of the pairs
596 * will be removed. 659 * will be removed.
@@ -598,7 +661,7 @@ GNUNET_CONTAINER_multihashmap_get (const struct GNUNET_CONTAINER_MultiHashMap
598 * @param map the map 661 * @param map the map
599 * @param key key of the key-value pair 662 * @param key key of the key-value pair
600 * @param value value of the key-value pair 663 * @param value value of the key-value pair
601 * @return GNUNET_YES on success, GNUNET_NO if the key-value pair 664 * @return #GNUNET_YES on success, #GNUNET_NO if the key-value pair
602 * is not in the map 665 * is not in the map
603 */ 666 */
604int 667int
@@ -607,6 +670,7 @@ GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap *map,
607 const void *value); 670 const void *value);
608 671
609/** 672/**
673 * @ingroup hashmap
610 * Remove all entries for the given key from the map. 674 * Remove all entries for the given key from the map.
611 * Note that the values would not be "freed". 675 * Note that the values would not be "freed".
612 * 676 *
@@ -620,13 +684,14 @@ GNUNET_CONTAINER_multihashmap_remove_all (struct GNUNET_CONTAINER_MultiHashMap
620 684
621 685
622/** 686/**
687 * @ingroup hashmap
623 * Check if the map contains any value under the given 688 * Check if the map contains any value under the given
624 * key (including values that are NULL). 689 * key (including values that are NULL).
625 * 690 *
626 * @param map the map 691 * @param map the map
627 * @param key the key to test if a value exists for it 692 * @param key the key to test if a value exists for it
628 * @return GNUNET_YES if such a value exists, 693 * @return #GNUNET_YES if such a value exists,
629 * GNUNET_NO if not 694 * #GNUNET_NO if not
630 */ 695 */
631int 696int
632GNUNET_CONTAINER_multihashmap_contains (const struct 697GNUNET_CONTAINER_multihashmap_contains (const struct
@@ -635,14 +700,15 @@ GNUNET_CONTAINER_multihashmap_contains (const struct
635 700
636 701
637/** 702/**
703 * @ingroup hashmap
638 * Check if the map contains the given value under the given 704 * Check if the map contains the given value under the given
639 * key. 705 * key.
640 * 706 *
641 * @param map the map 707 * @param map the map
642 * @param key the key to test if a value exists for it 708 * @param key the key to test if a value exists for it
643 * @param value value to test for 709 * @param value value to test for
644 * @return GNUNET_YES if such a value exists, 710 * @return #GNUNET_YES if such a value exists,
645 * GNUNET_NO if not 711 * #GNUNET_NO if not
646 */ 712 */
647int 713int
648GNUNET_CONTAINER_multihashmap_contains_value (const struct 714GNUNET_CONTAINER_multihashmap_contains_value (const struct
@@ -652,15 +718,16 @@ GNUNET_CONTAINER_multihashmap_contains_value (const struct
652 718
653 719
654/** 720/**
721 * @ingroup hashmap
655 * Store a key-value pair in the map. 722 * Store a key-value pair in the map.
656 * 723 *
657 * @param map the map 724 * @param map the map
658 * @param key key to use 725 * @param key key to use
659 * @param value value to use 726 * @param value value to use
660 * @param opt options for put 727 * @param opt options for put
661 * @return GNUNET_OK on success, 728 * @return #GNUNET_OK on success,
662 * GNUNET_NO if a value was replaced (with REPLACE) 729 * #GNUNET_NO if a value was replaced (with REPLACE)
663 * GNUNET_SYSERR if UNIQUE_ONLY was the option and the 730 * #GNUNET_SYSERR if UNIQUE_ONLY was the option and the
664 * value already exists 731 * value already exists
665 */ 732 */
666int 733int
@@ -670,6 +737,7 @@ GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map,
670 opt); 737 opt);
671 738
672/** 739/**
740 * @ingroup hashmap
673 * Get the number of key-value pairs in the map. 741 * Get the number of key-value pairs in the map.
674 * 742 *
675 * @param map the map 743 * @param map the map
@@ -681,13 +749,14 @@ GNUNET_CONTAINER_multihashmap_size (const struct GNUNET_CONTAINER_MultiHashMap
681 749
682 750
683/** 751/**
752 * @ingroup hashmap
684 * Iterate over all entries in the map. 753 * Iterate over all entries in the map.
685 * 754 *
686 * @param map the map 755 * @param map the map
687 * @param it function to call on each entry 756 * @param it function to call on each entry
688 * @param it_cls extra argument to it 757 * @param it_cls extra argument to @a it
689 * @return the number of key value pairs processed, 758 * @return the number of key value pairs processed,
690 * GNUNET_SYSERR if it aborted iteration 759 * #GNUNET_SYSERR if it aborted iteration
691 */ 760 */
692int 761int
693GNUNET_CONTAINER_multihashmap_iterate (const struct 762GNUNET_CONTAINER_multihashmap_iterate (const struct
@@ -697,6 +766,7 @@ GNUNET_CONTAINER_multihashmap_iterate (const struct
697 766
698 767
699/** 768/**
769 * @ingroup hashmap
700 * Create an iterator for a multihashmap. 770 * Create an iterator for a multihashmap.
701 * The iterator can be used to retrieve all the elements in the multihashmap 771 * The iterator can be used to retrieve all the elements in the multihashmap
702 * one by one, without having to handle all elements at once (in contrast to 772 * one by one, without having to handle all elements at once (in contrast to
@@ -706,25 +776,26 @@ GNUNET_CONTAINER_multihashmap_iterate (const struct
706 * result in skipped or repeated elements. 776 * result in skipped or repeated elements.
707 * 777 *
708 * @param map the map to create an iterator for 778 * @param map the map to create an iterator for
709 * @return an iterator over the given multihashmap 'map' 779 * @return an iterator over the given multihashmap @a map
710 */ 780 */
711struct GNUNET_CONTAINER_MultiHashMapIterator * 781struct GNUNET_CONTAINER_MultiHashMapIterator *
712GNUNET_CONTAINER_multihashmap_iterator_create (const struct GNUNET_CONTAINER_MultiHashMap *map); 782GNUNET_CONTAINER_multihashmap_iterator_create (const struct GNUNET_CONTAINER_MultiHashMap *map);
713 783
714 784
715/** 785/**
716 * Retrieve the next element from the hash map at the iterator's position. 786 * @ingroup hashmap
717 * If there are no elements left, GNUNET_NO is returned, and 'key' and 'value' 787 * Retrieve the next element from the hash map at the iterator's
718 * are not modified. 788 * position. If there are no elements left, #GNUNET_NO is returned,
719 * This operation is only allowed if no elements have been removed from the 789 * and @a key and @a value are not modified. This operation is only
720 * multihashmap since the creation of 'iter', and the map has not been destroyed. 790 * allowed if no elements have been removed from the multihashmap
791 * since the creation of @a iter, and the map has not been destroyed.
721 * Adding elements may result in repeating or skipping elements. 792 * Adding elements may result in repeating or skipping elements.
722 * 793 *
723 * @param iter the iterator to get the next element from 794 * @param iter the iterator to get the next element from
724 * @param key pointer to store the key in, can be NULL 795 * @param key pointer to store the key in, can be NULL
725 * @param value pointer to store the value in, can be NULL 796 * @param value pointer to store the value in, can be NULL
726 * @return GNUNET_YES we returned an element, 797 * @return #GNUNET_YES we returned an element,
727 * GNUNET_NO if we are out of elements 798 * #GNUNET_NO if we are out of elements
728 */ 799 */
729int 800int
730GNUNET_CONTAINER_multihashmap_iterator_next (struct GNUNET_CONTAINER_MultiHashMapIterator *iter, 801GNUNET_CONTAINER_multihashmap_iterator_next (struct GNUNET_CONTAINER_MultiHashMapIterator *iter,
@@ -732,6 +803,7 @@ GNUNET_CONTAINER_multihashmap_iterator_next (struct GNUNET_CONTAINER_MultiHashMa
732 803
733 804
734/** 805/**
806 * @ingroup hashmap
735 * Destroy a multihashmap iterator. 807 * Destroy a multihashmap iterator.
736 * 808 *
737 * @param iter the iterator to destroy 809 * @param iter the iterator to destroy
@@ -741,14 +813,15 @@ GNUNET_CONTAINER_multihashmap_iterator_destroy (struct GNUNET_CONTAINER_MultiHas
741 813
742 814
743/** 815/**
816 * @ingroup hashmap
744 * Iterate over all entries in the map that match a particular key. 817 * Iterate over all entries in the map that match a particular key.
745 * 818 *
746 * @param map the map 819 * @param map the map
747 * @param key key that the entries must correspond to 820 * @param key key that the entries must correspond to
748 * @param it function to call on each entry 821 * @param it function to call on each entry
749 * @param it_cls extra argument to it 822 * @param it_cls extra argument to @a it
750 * @return the number of key value pairs processed, 823 * @return the number of key value pairs processed,
751 * GNUNET_SYSERR if it aborted iteration 824 * #GNUNET_SYSERR if it aborted iteration
752 */ 825 */
753int 826int
754GNUNET_CONTAINER_multihashmap_get_multiple (const struct 827GNUNET_CONTAINER_multihashmap_get_multiple (const struct
@@ -760,20 +833,22 @@ GNUNET_CONTAINER_multihashmap_get_multiple (const struct
760/* Version of multihashmap with 32 bit keys */ 833/* Version of multihashmap with 32 bit keys */
761 834
762/** 835/**
836 * @ingroup hashmap
763 * Opaque handle for the 32-bit key HashMap. 837 * Opaque handle for the 32-bit key HashMap.
764 */ 838 */
765struct GNUNET_CONTAINER_MultiHashMap32; 839struct GNUNET_CONTAINER_MultiHashMap32;
766 840
767 841
768/** 842/**
843 * @ingroup hashmap
769 * Iterator over hash map entries. 844 * Iterator over hash map entries.
770 * 845 *
771 * @param cls closure 846 * @param cls closure
772 * @param key current key code 847 * @param key current key code
773 * @param value value in the hash map 848 * @param value value in the hash map
774 * @return GNUNET_YES if we should continue to 849 * @return #GNUNET_YES if we should continue to
775 * iterate, 850 * iterate,
776 * GNUNET_NO if not. 851 * #GNUNET_NO if not.
777 */ 852 */
778typedef int (*GNUNET_CONTAINER_HashMapIterator32) (void *cls, 853typedef int (*GNUNET_CONTAINER_HashMapIterator32) (void *cls,
779 uint32_t key, 854 uint32_t key,
@@ -781,6 +856,7 @@ typedef int (*GNUNET_CONTAINER_HashMapIterator32) (void *cls,
781 856
782 857
783/** 858/**
859 * @ingroup hashmap
784 * Create a 32-bit key multi hash map. 860 * Create a 32-bit key multi hash map.
785 * 861 *
786 * @param len initial size (map will grow as needed) 862 * @param len initial size (map will grow as needed)
@@ -791,6 +867,7 @@ GNUNET_CONTAINER_multihashmap32_create (unsigned int len);
791 867
792 868
793/** 869/**
870 * @ingroup hashmap
794 * Destroy a 32-bit key hash map. Will not free any values 871 * Destroy a 32-bit key hash map. Will not free any values
795 * stored in the hash map! 872 * stored in the hash map!
796 * 873 *
@@ -802,6 +879,7 @@ GNUNET_CONTAINER_multihashmap32_destroy (struct GNUNET_CONTAINER_MultiHashMap32
802 879
803 880
804/** 881/**
882 * @ingroup hashmap
805 * Get the number of key-value pairs in the map. 883 * Get the number of key-value pairs in the map.
806 * 884 *
807 * @param map the map 885 * @param map the map
@@ -813,6 +891,7 @@ GNUNET_CONTAINER_multihashmap32_size (const struct
813 891
814 892
815/** 893/**
894 * @ingroup hashmap
816 * Given a key find a value in the map matching the key. 895 * Given a key find a value in the map matching the key.
817 * 896 *
818 * @param map the map 897 * @param map the map
@@ -829,13 +908,14 @@ GNUNET_CONTAINER_multihashmap32_get (const struct
829 908
830 909
831/** 910/**
911 * @ingroup hashmap
832 * Iterate over all entries in the map. 912 * Iterate over all entries in the map.
833 * 913 *
834 * @param map the map 914 * @param map the map
835 * @param it function to call on each entry 915 * @param it function to call on each entry
836 * @param it_cls extra argument to it 916 * @param it_cls extra argument to @a it
837 * @return the number of key value pairs processed, 917 * @return the number of key value pairs processed,
838 * GNUNET_SYSERR if it aborted iteration 918 * #GNUNET_SYSERR if it aborted iteration
839 */ 919 */
840int 920int
841GNUNET_CONTAINER_multihashmap32_iterate (const struct 921GNUNET_CONTAINER_multihashmap32_iterate (const struct
@@ -845,6 +925,7 @@ GNUNET_CONTAINER_multihashmap32_iterate (const struct
845 925
846 926
847/** 927/**
928 * @ingroup hashmap
848 * Remove the given key-value pair from the map. Note that if the 929 * Remove the given key-value pair from the map. Note that if the
849 * key-value pair is in the map multiple times, only one of the pairs 930 * key-value pair is in the map multiple times, only one of the pairs
850 * will be removed. 931 * will be removed.
@@ -852,7 +933,7 @@ GNUNET_CONTAINER_multihashmap32_iterate (const struct
852 * @param map the map 933 * @param map the map
853 * @param key key of the key-value pair 934 * @param key key of the key-value pair
854 * @param value value of the key-value pair 935 * @param value value of the key-value pair
855 * @return GNUNET_YES on success, GNUNET_NO if the key-value pair 936 * @return #GNUNET_YES on success, #GNUNET_NO if the key-value pair
856 * is not in the map 937 * is not in the map
857 */ 938 */
858int 939int
@@ -863,6 +944,7 @@ GNUNET_CONTAINER_multihashmap32_remove (struct GNUNET_CONTAINER_MultiHashMap32
863 944
864 945
865/** 946/**
947 * @ingroup hashmap
866 * Remove all entries for the given key from the map. 948 * Remove all entries for the given key from the map.
867 * Note that the values would not be "freed". 949 * Note that the values would not be "freed".
868 * 950 *
@@ -878,13 +960,14 @@ GNUNET_CONTAINER_multihashmap32_remove_all (struct
878 960
879 961
880/** 962/**
963 * @ingroup hashmap
881 * Check if the map contains any value under the given 964 * Check if the map contains any value under the given
882 * key (including values that are NULL). 965 * key (including values that are NULL).
883 * 966 *
884 * @param map the map 967 * @param map the map
885 * @param key the key to test if a value exists for it 968 * @param key the key to test if a value exists for it
886 * @return GNUNET_YES if such a value exists, 969 * @return #GNUNET_YES if such a value exists,
887 * GNUNET_NO if not 970 * #GNUNET_NO if not
888 */ 971 */
889int 972int
890GNUNET_CONTAINER_multihashmap32_contains (const struct 973GNUNET_CONTAINER_multihashmap32_contains (const struct
@@ -893,14 +976,15 @@ GNUNET_CONTAINER_multihashmap32_contains (const struct
893 976
894 977
895/** 978/**
979 * @ingroup hashmap
896 * Check if the map contains the given value under the given 980 * Check if the map contains the given value under the given
897 * key. 981 * key.
898 * 982 *
899 * @param map the map 983 * @param map the map
900 * @param key the key to test if a value exists for it 984 * @param key the key to test if a value exists for it
901 * @param value value to test for 985 * @param value value to test for
902 * @return GNUNET_YES if such a value exists, 986 * @return #GNUNET_YES if such a value exists,
903 * GNUNET_NO if not 987 * #GNUNET_NO if not
904 */ 988 */
905int 989int
906GNUNET_CONTAINER_multihashmap32_contains_value (const struct 990GNUNET_CONTAINER_multihashmap32_contains_value (const struct
@@ -911,15 +995,16 @@ GNUNET_CONTAINER_multihashmap32_contains_value (const struct
911 995
912 996
913/** 997/**
998 * @ingroup hashmap
914 * Store a key-value pair in the map. 999 * Store a key-value pair in the map.
915 * 1000 *
916 * @param map the map 1001 * @param map the map
917 * @param key key to use 1002 * @param key key to use
918 * @param value value to use 1003 * @param value value to use
919 * @param opt options for put 1004 * @param opt options for put
920 * @return GNUNET_OK on success, 1005 * @return #GNUNET_OK on success,
921 * GNUNET_NO if a value was replaced (with REPLACE) 1006 * #GNUNET_NO if a value was replaced (with REPLACE)
922 * GNUNET_SYSERR if UNIQUE_ONLY was the option and the 1007 * #GNUNET_SYSERR if #GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY was the option and the
923 * value already exists 1008 * value already exists
924 */ 1009 */
925int 1010int
@@ -930,14 +1015,15 @@ GNUNET_CONTAINER_multihashmap32_put (struct GNUNET_CONTAINER_MultiHashMap32
930 1015
931 1016
932/** 1017/**
1018 * @ingroup hashmap
933 * Iterate over all entries in the map that match a particular key. 1019 * Iterate over all entries in the map that match a particular key.
934 * 1020 *
935 * @param map the map 1021 * @param map the map
936 * @param key key that the entries must correspond to 1022 * @param key key that the entries must correspond to
937 * @param it function to call on each entry 1023 * @param it function to call on each entry
938 * @param it_cls extra argument to it 1024 * @param it_cls extra argument to @a it
939 * @return the number of key value pairs processed, 1025 * @return the number of key value pairs processed,
940 * GNUNET_SYSERR if it aborted iteration 1026 * #GNUNET_SYSERR if it aborted iteration
941 */ 1027 */
942int 1028int
943GNUNET_CONTAINER_multihashmap32_get_multiple (const struct 1029GNUNET_CONTAINER_multihashmap32_get_multiple (const struct
@@ -953,6 +1039,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct
953/* To avoid mistakes: head->prev == tail->next == NULL */ 1039/* To avoid mistakes: head->prev == tail->next == NULL */
954 1040
955/** 1041/**
1042 * @ingroup dll
956 * Insert an element at the head of a DLL. Assumes that head, tail and 1043 * Insert an element at the head of a DLL. Assumes that head, tail and
957 * element are structs with prev and next fields. 1044 * element are structs with prev and next fields.
958 * 1045 *
@@ -973,6 +1060,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct
973 1060
974 1061
975/** 1062/**
1063 * @ingroup dll
976 * Insert an element at the tail of a DLL. Assumes that head, tail and 1064 * Insert an element at the tail of a DLL. Assumes that head, tail and
977 * element are structs with prev and next fields. 1065 * element are structs with prev and next fields.
978 * 1066 *
@@ -993,6 +1081,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct
993 1081
994 1082
995/** 1083/**
1084 * @ingroup dll
996 * Insert an element into a DLL after the given other element. Insert 1085 * Insert an element into a DLL after the given other element. Insert
997 * at the head if the other element is NULL. 1086 * at the head if the other element is NULL.
998 * 1087 *
@@ -1022,6 +1111,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct
1022 1111
1023 1112
1024/** 1113/**
1114 * @ingroup dll
1025 * Insert an element into a DLL before the given other element. Insert 1115 * Insert an element into a DLL before the given other element. Insert
1026 * at the tail if the other element is NULL. 1116 * at the tail if the other element is NULL.
1027 * 1117 *
@@ -1051,6 +1141,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct
1051 1141
1052 1142
1053/** 1143/**
1144 * @ingroup dll
1054 * Remove an element from a DLL. Assumes that head, tail and 1145 * Remove an element from a DLL. Assumes that head, tail and
1055 * element point to structs with prev and next fields. 1146 * element point to structs with prev and next fields.
1056 * 1147 *
@@ -1082,6 +1173,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct
1082 in multiple lists at the same time *********************** */ 1173 in multiple lists at the same time *********************** */
1083 1174
1084/** 1175/**
1176 * @ingroup dll
1085 * Insert an element at the head of a MDLL. Assumes that head, tail and 1177 * Insert an element at the head of a MDLL. Assumes that head, tail and
1086 * element are structs with prev and next fields. 1178 * element are structs with prev and next fields.
1087 * 1179 *
@@ -1103,6 +1195,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct
1103 1195
1104 1196
1105/** 1197/**
1198 * @ingroup dll
1106 * Insert an element at the tail of a MDLL. Assumes that head, tail and 1199 * Insert an element at the tail of a MDLL. Assumes that head, tail and
1107 * element are structs with prev and next fields. 1200 * element are structs with prev and next fields.
1108 * 1201 *
@@ -1124,6 +1217,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct
1124 1217
1125 1218
1126/** 1219/**
1220 * @ingroup dll
1127 * Insert an element into a MDLL after the given other element. Insert 1221 * Insert an element into a MDLL after the given other element. Insert
1128 * at the head if the other element is NULL. 1222 * at the head if the other element is NULL.
1129 * 1223 *
@@ -1154,6 +1248,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct
1154 1248
1155 1249
1156/** 1250/**
1251 * @ingroup dll
1157 * Insert an element into a MDLL before the given other element. Insert 1252 * Insert an element into a MDLL before the given other element. Insert
1158 * at the tail if the other element is NULL. 1253 * at the tail if the other element is NULL.
1159 * 1254 *
@@ -1184,6 +1279,7 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct
1184 1279
1185 1280
1186/** 1281/**
1282 * @ingroup dll
1187 * Remove an element from a MDLL. Assumes 1283 * Remove an element from a MDLL. Assumes
1188 * that head, tail and element are structs 1284 * that head, tail and element are structs
1189 * with prev and next fields. 1285 * with prev and next fields.
@@ -1213,23 +1309,26 @@ GNUNET_CONTAINER_multihashmap32_get_multiple (const struct
1213 1309
1214 1310
1215/** 1311/**
1312 * @ingroup heap
1216 * Cost by which elements in a heap can be ordered. 1313 * Cost by which elements in a heap can be ordered.
1217 */ 1314 */
1218typedef uint64_t GNUNET_CONTAINER_HeapCostType; 1315typedef uint64_t GNUNET_CONTAINER_HeapCostType;
1219 1316
1220 1317
1221/* 1318/**
1222 * Heap type, either max or min. Hopefully makes the 1319 * @ingroup heap
1223 * implementation more useful. 1320 * Heap type, either max or min.
1224 */ 1321 */
1225enum GNUNET_CONTAINER_HeapOrder 1322enum GNUNET_CONTAINER_HeapOrder
1226{ 1323{
1227 /** 1324 /**
1325 * @ingroup heap
1228 * Heap with the maximum cost at the root. 1326 * Heap with the maximum cost at the root.
1229 */ 1327 */
1230 GNUNET_CONTAINER_HEAP_ORDER_MAX, 1328 GNUNET_CONTAINER_HEAP_ORDER_MAX,
1231 1329
1232 /** 1330 /**
1331 * @ingroup heap
1233 * Heap with the minimum cost at the root. 1332 * Heap with the minimum cost at the root.
1234 */ 1333 */
1235 GNUNET_CONTAINER_HEAP_ORDER_MIN 1334 GNUNET_CONTAINER_HEAP_ORDER_MIN
@@ -1237,19 +1336,21 @@ enum GNUNET_CONTAINER_HeapOrder
1237 1336
1238 1337
1239/** 1338/**
1339 * @ingroup heap
1240 * Handle to a Heap. 1340 * Handle to a Heap.
1241 */ 1341 */
1242struct GNUNET_CONTAINER_Heap; 1342struct GNUNET_CONTAINER_Heap;
1243 1343
1244 1344
1245
1246/** 1345/**
1346 * @ingroup heap
1247 * Handle to a node in a heap. 1347 * Handle to a node in a heap.
1248 */ 1348 */
1249struct GNUNET_CONTAINER_HeapNode; 1349struct GNUNET_CONTAINER_HeapNode;
1250 1350
1251 1351
1252/** 1352/**
1353 * @ingroup heap
1253 * Create a new heap. 1354 * Create a new heap.
1254 * 1355 *
1255 * @param order how should the heap be sorted? 1356 * @param order how should the heap be sorted?
@@ -1260,6 +1361,7 @@ GNUNET_CONTAINER_heap_create (enum GNUNET_CONTAINER_HeapOrder order);
1260 1361
1261 1362
1262/** 1363/**
1364 * @ingroup heap
1263 * Destroys the heap. Only call on a heap that 1365 * Destroys the heap. Only call on a heap that
1264 * is already empty. 1366 * is already empty.
1265 * 1367 *
@@ -1270,6 +1372,7 @@ GNUNET_CONTAINER_heap_destroy (struct GNUNET_CONTAINER_Heap *heap);
1270 1372
1271 1373
1272/** 1374/**
1375 * @ingroup heap
1273 * Get element stored at root of heap. 1376 * Get element stored at root of heap.
1274 * 1377 *
1275 * @param heap heap to inspect 1378 * @param heap heap to inspect
@@ -1280,6 +1383,7 @@ GNUNET_CONTAINER_heap_peek (const struct GNUNET_CONTAINER_Heap *heap);
1280 1383
1281 1384
1282/** 1385/**
1386 * @ingroup heap
1283 * Get the current size of the heap 1387 * Get the current size of the heap
1284 * 1388 *
1285 * @param heap the heap to get the size of 1389 * @param heap the heap to get the size of
@@ -1290,6 +1394,7 @@ GNUNET_CONTAINER_heap_get_size (const struct GNUNET_CONTAINER_Heap *heap);
1290 1394
1291 1395
1292/** 1396/**
1397 * @ingroup heap
1293 * Get the current cost of the node 1398 * Get the current cost of the node
1294 * 1399 *
1295 * @param node the node to get the cost of 1400 * @param node the node to get the cost of
@@ -1300,14 +1405,15 @@ GNUNET_CONTAINER_heap_node_get_cost (const struct GNUNET_CONTAINER_HeapNode
1300 *node); 1405 *node);
1301 1406
1302/** 1407/**
1408 * @ingroup heap
1303 * Iterator for heap 1409 * Iterator for heap
1304 * 1410 *
1305 * @param cls closure 1411 * @param cls closure
1306 * @param node internal node of the heap 1412 * @param node internal node of the heap
1307 * @param element value stored at the node 1413 * @param element value stored at the node
1308 * @param cost cost associated with the node 1414 * @param cost cost associated with the node
1309 * @return GNUNET_YES if we should continue to iterate, 1415 * @return #GNUNET_YES if we should continue to iterate,
1310 * GNUNET_NO if not. 1416 * #GNUNET_NO if not.
1311 */ 1417 */
1312typedef int (*GNUNET_CONTAINER_HeapIterator) (void *cls, 1418typedef int (*GNUNET_CONTAINER_HeapIterator) (void *cls,
1313 struct GNUNET_CONTAINER_HeapNode * 1419 struct GNUNET_CONTAINER_HeapNode *
@@ -1317,11 +1423,12 @@ typedef int (*GNUNET_CONTAINER_HeapIterator) (void *cls,
1317 1423
1318 1424
1319/** 1425/**
1426 * @ingroup heap
1320 * Iterate over all entries in the heap. 1427 * Iterate over all entries in the heap.
1321 * 1428 *
1322 * @param heap the heap 1429 * @param heap the heap
1323 * @param iterator function to call on each entry 1430 * @param iterator function to call on each entry
1324 * @param iterator_cls closure for iterator 1431 * @param iterator_cls closure for @a iterator
1325 */ 1432 */
1326void 1433void
1327GNUNET_CONTAINER_heap_iterate (const struct GNUNET_CONTAINER_Heap *heap, 1434GNUNET_CONTAINER_heap_iterate (const struct GNUNET_CONTAINER_Heap *heap,
@@ -1329,6 +1436,7 @@ GNUNET_CONTAINER_heap_iterate (const struct GNUNET_CONTAINER_Heap *heap,
1329 void *iterator_cls); 1436 void *iterator_cls);
1330 1437
1331/** 1438/**
1439 * @ingroup heap
1332 * Perform a random walk of the tree. The walk is biased 1440 * Perform a random walk of the tree. The walk is biased
1333 * towards elements closer to the root of the tree (since 1441 * towards elements closer to the root of the tree (since
1334 * each walk starts at the root and ends at a random leaf). 1442 * each walk starts at the root and ends at a random leaf).
@@ -1344,6 +1452,7 @@ GNUNET_CONTAINER_heap_walk_get_next (struct GNUNET_CONTAINER_Heap *heap);
1344 1452
1345 1453
1346/** 1454/**
1455 * @ingroup heap
1347 * Inserts a new element into the heap. 1456 * Inserts a new element into the heap.
1348 * 1457 *
1349 * @param heap heap to modify 1458 * @param heap heap to modify
@@ -1357,6 +1466,7 @@ GNUNET_CONTAINER_heap_insert (struct GNUNET_CONTAINER_Heap *heap, void *element,
1357 1466
1358 1467
1359/** 1468/**
1469 * @ingroup heap
1360 * Remove root of the heap. 1470 * Remove root of the heap.
1361 * 1471 *
1362 * @param heap heap to modify 1472 * @param heap heap to modify
@@ -1367,6 +1477,7 @@ GNUNET_CONTAINER_heap_remove_root (struct GNUNET_CONTAINER_Heap *heap);
1367 1477
1368 1478
1369/** 1479/**
1480 * @ingroup heap
1370 * Removes a node from the heap. 1481 * Removes a node from the heap.
1371 * 1482 *
1372 * @param node node to remove 1483 * @param node node to remove
@@ -1377,6 +1488,7 @@ GNUNET_CONTAINER_heap_remove_node (struct GNUNET_CONTAINER_HeapNode *node);
1377 1488
1378 1489
1379/** 1490/**
1491 * @ingroup heap
1380 * Updates the cost of any node in the tree 1492 * Updates the cost of any node in the tree
1381 * 1493 *
1382 * @param heap heap to modify 1494 * @param heap heap to modify