aboutsummaryrefslogtreecommitdiff
path: root/src/util/container_meta_data.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2009-10-08 19:00:19 +0000
committerChristian Grothoff <christian@grothoff.org>2009-10-08 19:00:19 +0000
commitfe947a9704bed14c2fc74b2f2069596fe884cbad (patch)
tree644efdaa37d692b09f8e279bfe5e8b2ebe81448b /src/util/container_meta_data.c
parenta8b0ab037820f6a9f405be3855ce8d3ebbd4399b (diff)
downloadgnunet-fe947a9704bed14c2fc74b2f2069596fe884cbad.tar.gz
gnunet-fe947a9704bed14c2fc74b2f2069596fe884cbad.zip
better comments
Diffstat (limited to 'src/util/container_meta_data.c')
-rw-r--r--src/util/container_meta_data.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/util/container_meta_data.c b/src/util/container_meta_data.c
index bbe6dad3b..5ae3b15cf 100644
--- a/src/util/container_meta_data.c
+++ b/src/util/container_meta_data.c
@@ -139,6 +139,11 @@ GNUNET_CONTAINER_meta_data_insert (struct GNUNET_CONTAINER_MetaData *md,
139 139
140/** 140/**
141 * Remove an item. 141 * Remove an item.
142 *
143 * @param md metadata to manipulate
144 * @param type type of the item to remove
145 * @param data specific value to remove, NULL to remove all
146 * entries of the given type
142 * @return GNUNET_OK on success, GNUNET_SYSERR if the item does not exist in md 147 * @return GNUNET_OK on success, GNUNET_SYSERR if the item does not exist in md
143 */ 148 */
144int 149int
@@ -170,13 +175,16 @@ GNUNET_CONTAINER_meta_data_delete (struct GNUNET_CONTAINER_MetaData *md,
170/** 175/**
171 * Iterate over MD entries, excluding thumbnails. 176 * Iterate over MD entries, excluding thumbnails.
172 * 177 *
178 * @param md metadata to inspect
179 * @param iter function to call on each entry
180 * @param iter_cls closure for iterator
173 * @return number of entries 181 * @return number of entries
174 */ 182 */
175int 183int
176GNUNET_CONTAINER_meta_data_get_contents (const struct 184GNUNET_CONTAINER_meta_data_get_contents (const struct
177 GNUNET_CONTAINER_MetaData *md, 185 GNUNET_CONTAINER_MetaData *md,
178 GNUNET_CONTAINER_MetaDataProcessor 186 GNUNET_CONTAINER_MetaDataProcessor
179 iterator, void *closure) 187 iter, void *iter_cls)
180{ 188{
181 uint32_t i; 189 uint32_t i;
182 uint32_t sub; 190 uint32_t sub;
@@ -187,9 +195,9 @@ GNUNET_CONTAINER_meta_data_get_contents (const struct
187 if (!EXTRACTOR_isBinaryType (md->items[i].type)) 195 if (!EXTRACTOR_isBinaryType (md->items[i].type))
188 { 196 {
189 if ((iterator != NULL) && 197 if ((iterator != NULL) &&
190 (GNUNET_OK != iterator (closure, 198 (GNUNET_OK != iter (iter_cls,
191 md->items[i].type, 199 md->items[i].type,
192 md->items[i].data))) 200 md->items[i].data)))
193 return GNUNET_SYSERR; 201 return GNUNET_SYSERR;
194 } 202 }
195 else 203 else
@@ -280,6 +288,9 @@ GNUNET_CONTAINER_meta_data_get_thumbnail (const struct
280 288
281/** 289/**
282 * Duplicate struct GNUNET_CONTAINER_MetaData. 290 * Duplicate struct GNUNET_CONTAINER_MetaData.
291 *
292 * @param md what to duplicate
293 * @return duplicate meta-data container
283 */ 294 */
284struct GNUNET_CONTAINER_MetaData * 295struct GNUNET_CONTAINER_MetaData *
285GNUNET_CONTAINER_meta_data_duplicate (const struct GNUNET_CONTAINER_MetaData 296GNUNET_CONTAINER_meta_data_duplicate (const struct GNUNET_CONTAINER_MetaData
@@ -439,7 +450,7 @@ struct MetaDataHeader
439 * @param md metadata to serialize 450 * @param md metadata to serialize
440 * @param target where to write the serialized metadata 451 * @param target where to write the serialized metadata
441 * @param max maximum number of bytes available in target 452 * @param max maximum number of bytes available in target
442 * @param part is it ok to just write SOME of the 453 * @param opt is it ok to just write SOME of the
443 * meta-data to match the size constraint, 454 * meta-data to match the size constraint,
444 * possibly discarding some data? 455 * possibly discarding some data?
445 * @return number of bytes written on success, 456 * @return number of bytes written on success,
@@ -451,7 +462,7 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
451 *md, char *target, size_t max, 462 *md, char *target, size_t max,
452 enum 463 enum
453 GNUNET_CONTAINER_MetaDataSerializationOptions 464 GNUNET_CONTAINER_MetaDataSerializationOptions
454 part) 465 opt)
455{ 466{
456 struct MetaDataHeader *hdr; 467 struct MetaDataHeader *hdr;
457 size_t size; 468 size_t size;
@@ -488,7 +499,7 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
488 } 499 }
489 500
490 hdr->size = htonl (size); 501 hdr->size = htonl (size);
491 if ((part & GNUNET_CONTAINER_META_DATA_SERIALIZE_NO_COMPRESS) == 0) 502 if ((opt & GNUNET_CONTAINER_META_DATA_SERIALIZE_NO_COMPRESS) == 0)
492 { 503 {
493 pos = tryCompression ((char *) &hdr[1], 504 pos = tryCompression ((char *) &hdr[1],
494 size - sizeof (struct MetaDataHeader)); 505 size - sizeof (struct MetaDataHeader));
@@ -507,7 +518,7 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
507 GNUNET_free (hdr); 518 GNUNET_free (hdr);
508 hdr = NULL; 519 hdr = NULL;
509 520
510 if ((part & GNUNET_CONTAINER_META_DATA_SERIALIZE_PART) == 0) 521 if ((opt & GNUNET_CONTAINER_META_DATA_SERIALIZE_PART) == 0)
511 { 522 {
512 return GNUNET_SYSERR; /* does not fit! */ 523 return GNUNET_SYSERR; /* does not fit! */
513 } 524 }