2 This file is part of GNUnet.
3 (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010 Christian Grothoff (and other contributing authors)
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
7 by the Free Software Foundation; either version 2, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file util/container_meta_data.c
23 * @brief Storing of meta data
24 * @author Christian Grothoff
28 #include "gnunet_common.h"
29 #include "gnunet_container_lib.h"
30 #include "gnunet_strings_lib.h"
31 #include "gnunet_time_lib.h"
32 #include <extractor.h>
41 * This is a linked list.
43 struct MetaItem *next;
46 * Name of the extracting plugin.
56 * The actual meta data.
61 * Number of bytes in 'data'.
66 * Type of the meta data.
68 enum EXTRACTOR_MetaType type;
71 * Format of the meta data.
73 enum EXTRACTOR_MetaFormat format;
78 * Meta data to associate with a file, directory or namespace.
80 struct GNUNET_CONTAINER_MetaData
83 * Linked list of the meta data items.
85 struct MetaItem *items;
88 * Complete serialized and compressed buffer of the items.
89 * NULL if we have not computed that buffer yet.
94 * Number of bytes in 'sbuf'. 0 if the buffer is stale.
99 * Number of items in the linked list.
101 unsigned int item_count;
107 * Create a fresh struct CONTAINER_MetaData token.
109 * @return empty meta-data container
111 struct GNUNET_CONTAINER_MetaData *
112 GNUNET_CONTAINER_meta_data_create ()
114 return GNUNET_malloc (sizeof (struct GNUNET_CONTAINER_MetaData));
119 * Free meta data item.
121 * @param item item to free
124 meta_item_free (struct MetaItem *item)
126 GNUNET_free_non_null (item->plugin_name);
127 GNUNET_free_non_null (item->mime_type);
128 GNUNET_free_non_null (item->data);
134 * The meta data has changed, invalidate its serialization
137 * @param md meta data that changed
140 invalidate_sbuf (struct GNUNET_CONTAINER_MetaData *md)
142 if (md->sbuf == NULL)
144 GNUNET_free (md->sbuf);
153 * @param md what to free
156 GNUNET_CONTAINER_meta_data_destroy (struct GNUNET_CONTAINER_MetaData *md)
158 struct MetaItem *item;
162 while (NULL != (item = md->items))
164 md->items = item->next;
165 meta_item_free (item);
167 GNUNET_free_non_null (md->sbuf);
173 * Remove all items in the container.
175 * @param md metadata to manipulate
178 GNUNET_CONTAINER_meta_data_clear (struct GNUNET_CONTAINER_MetaData *md)
180 struct MetaItem *item;
184 while (NULL != (item = md->items))
186 md->items = item->next;
187 meta_item_free (item);
189 GNUNET_free_non_null (md->sbuf);
190 memset (md, 0, sizeof (struct GNUNET_CONTAINER_MetaData));
196 * Test if two MDs are equal. We consider them equal if
197 * the meta types, formats and content match (we do not
198 * include the mime types and plugins names in this
201 * @param md1 first value to check
202 * @param md2 other value to check
203 * @return GNUNET_YES if they are equal
206 GNUNET_CONTAINER_meta_data_test_equal (const struct GNUNET_CONTAINER_MetaData
208 const struct GNUNET_CONTAINER_MetaData
217 if (md1->item_count != md2->item_count)
227 if ( (i->type == j->type) &&
228 (i->format == j->format) &&
229 (i->data_size == j->data_size) &&
230 (0 == memcmp (i->data,
239 if (found == GNUNET_NO)
248 * Extend metadata. Note that the list of meta data items is
249 * sorted by size (largest first).
251 * @param md metadata to extend
252 * @param plugin_name name of the plugin that produced this value;
253 * special values can be used (i.e. '<zlib>' for zlib being
254 * used in the main libextractor library and yielding
256 * @param type libextractor-type describing the meta data
257 * @param format basic format information about data
258 * @param data_mime_type mime-type of data (not of the original file);
259 * can be NULL (if mime-type is not known)
260 * @param data actual meta-data found
261 * @param data_len number of bytes in data
262 * @return GNUNET_OK on success, GNUNET_SYSERR if this entry already exists
263 * data_mime_type and plugin_name are not considered for "exists" checks
266 GNUNET_CONTAINER_meta_data_insert (struct GNUNET_CONTAINER_MetaData *md,
267 const char *plugin_name,
268 enum EXTRACTOR_MetaType type,
269 enum EXTRACTOR_MetaFormat format,
270 const char *data_mime_type,
274 struct MetaItem *prev;
275 struct MetaItem *pos;
283 if (pos->data_size < data_len)
285 if ( (pos->type == type) &&
286 (pos->data_size == data_len) &&
287 (0 == memcmp (pos->data,
291 if ( (pos->mime_type == NULL) &&
292 (data_mime_type != NULL) )
294 pos->mime_type = GNUNET_strdup (data_mime_type);
295 invalidate_sbuf (md);
297 if ( (pos->format == EXTRACTOR_METAFORMAT_C_STRING) &&
298 (format == EXTRACTOR_METAFORMAT_UTF8) )
300 pos->format = EXTRACTOR_METAFORMAT_UTF8;
301 invalidate_sbuf (md);
303 return GNUNET_SYSERR;
309 i = GNUNET_malloc (sizeof (struct MetaItem));
312 i->data_size = data_len;
318 i->mime_type = (data_mime_type == NULL) ? NULL : GNUNET_strdup (data_mime_type);
319 i->plugin_name = (plugin_name == NULL) ? NULL : GNUNET_strdup (plugin_name);
320 i->data = GNUNET_malloc (data_len);
321 memcpy (i->data, data, data_len);
322 /* change OS native dir separators to unix '/' and others to '_' */
323 if (type == EXTRACTOR_METATYPE_FILENAME)
326 while ( (*p != '\0') &&
327 (p < i->data + data_len) )
329 if (*p == DIR_SEPARATOR)
336 invalidate_sbuf (md);
342 * Merge given meta data.
344 * @param cls the 'struct GNUNET_CONTAINER_MetaData' to merge into
345 * @param plugin_name name of the plugin that produced this value;
346 * special values can be used (i.e. '<zlib>' for zlib being
347 * used in the main libextractor library and yielding
349 * @param type libextractor-type describing the meta data
350 * @param format basic format information about data
351 * @param data_mime_type mime-type of data (not of the original file);
352 * can be NULL (if mime-type is not known)
353 * @param data actual meta-data found
354 * @param data_len number of bytes in data
355 * @return 0 (to continue)
358 merge_helper(void *cls,
359 const char *plugin_name,
360 enum EXTRACTOR_MetaType type,
361 enum EXTRACTOR_MetaFormat format,
362 const char *data_mime_type,
366 struct GNUNET_CONTAINER_MetaData *md = cls;
367 (void) GNUNET_CONTAINER_meta_data_insert (md, plugin_name,
369 data_mime_type, data, data_len);
375 * Extend metadata. Merges the meta data from the second argument
376 * into the first, discarding duplicate key-value pairs.
378 * @param md metadata to extend
379 * @param in metadata to merge
382 GNUNET_CONTAINER_meta_data_merge (struct GNUNET_CONTAINER_MetaData *md,
383 const struct GNUNET_CONTAINER_MetaData *in)
385 GNUNET_CONTAINER_meta_data_iterate (in, &merge_helper, md);
392 * @param md metadata to manipulate
393 * @param type type of the item to remove
394 * @param data specific value to remove, NULL to remove all
395 * entries of the given type
396 * @param data_len number of bytes in data
397 * @return GNUNET_OK on success, GNUNET_SYSERR if the item does not exist in md
400 GNUNET_CONTAINER_meta_data_delete (struct GNUNET_CONTAINER_MetaData *md,
401 enum EXTRACTOR_MetaType type,
405 struct MetaItem *pos;
406 struct MetaItem *prev;
412 if ( (pos->type == type) &&
414 ( (pos->data_size == data_len) &&
415 (0 == memcmp (pos->data,
420 md->items = pos->next;
422 prev->next = pos->next;
423 meta_item_free (pos);
425 invalidate_sbuf (md);
431 return GNUNET_SYSERR;
436 * Add the current time as the publication date
439 * @param md metadata to modify
442 GNUNET_CONTAINER_meta_data_add_publication_date (struct
443 GNUNET_CONTAINER_MetaData
447 struct GNUNET_TIME_Absolute t;
449 t = GNUNET_TIME_absolute_get ();
450 GNUNET_CONTAINER_meta_data_delete (md,
451 EXTRACTOR_METATYPE_PUBLICATION_DATE,
454 dat = GNUNET_STRINGS_absolute_time_to_string (t);
455 GNUNET_CONTAINER_meta_data_insert (md,
457 EXTRACTOR_METATYPE_PUBLICATION_DATE,
458 EXTRACTOR_METAFORMAT_UTF8,
467 * Iterate over MD entries.
469 * @param md metadata to inspect
470 * @param iter function to call on each entry
471 * @param iter_cls closure for iterator
472 * @return number of entries
475 GNUNET_CONTAINER_meta_data_iterate (const struct
476 GNUNET_CONTAINER_MetaData *md,
477 EXTRACTOR_MetaDataProcessor
478 iter, void *iter_cls)
480 struct MetaItem *pos;
485 return md->item_count;
489 if (0 != iter (iter_cls,
496 return md->item_count;
499 return md->item_count;
504 * Get the first MD entry of the given type. Caller
505 * is responsible for freeing the return value.
506 * Also, only meta data items that are strings (0-terminated)
507 * are returned by this function.
509 * @param md metadata to inspect
510 * @param type type to look for
511 * @return NULL if no entry was found
514 GNUNET_CONTAINER_meta_data_get_by_type (const struct GNUNET_CONTAINER_MetaData
515 *md, enum EXTRACTOR_MetaType type)
517 struct MetaItem *pos;
524 if ( (type == pos->type) &&
525 ( (pos->format == EXTRACTOR_METAFORMAT_UTF8) ||
526 (pos->format == EXTRACTOR_METAFORMAT_C_STRING) ) )
527 return GNUNET_strdup (pos->data);
535 * Get the first matching MD entry of the given types. Caller is
536 * responsible for freeing the return value. Also, only meta data
537 * items that are strings (0-terminated) are returned by this
540 * @param md metadata to inspect
541 * @param ... -1-terminated list of types
542 * @return NULL if we do not have any such entry,
543 * otherwise client is responsible for freeing the value!
546 GNUNET_CONTAINER_meta_data_get_first_by_types (const struct
547 GNUNET_CONTAINER_MetaData *md,
552 enum EXTRACTOR_MetaType type;
560 type = va_arg (args, enum EXTRACTOR_MetaType);
563 ret = GNUNET_CONTAINER_meta_data_get_by_type (md, type);
573 * Get a thumbnail from the meta-data (if present).
575 * @param md metadata to get the thumbnail from
576 * @param thumb will be set to the thumbnail data. Must be
577 * freed by the caller!
578 * @return number of bytes in thumbnail, 0 if not available
581 GNUNET_CONTAINER_meta_data_get_thumbnail (const struct
582 GNUNET_CONTAINER_MetaData * md,
583 unsigned char **thumb)
585 struct MetaItem *pos;
586 struct MetaItem *match;
594 if ( (NULL != pos->mime_type) &&
595 (0 == strncasecmp ("image/", pos->mime_type,
596 strlen("image/"))) &&
597 (pos->format == EXTRACTOR_METAFORMAT_BINARY) )
601 else if ( (match->type != EXTRACTOR_METATYPE_THUMBNAIL) &&
602 (pos->type == EXTRACTOR_METATYPE_THUMBNAIL) )
607 if ( (match == NULL) ||
608 (match->data_size == 0) )
610 *thumb = GNUNET_malloc (match->data_size);
611 memcpy (*thumb, match->data, match->data_size);
612 return match->data_size;
617 * Duplicate struct GNUNET_CONTAINER_MetaData.
619 * @param md what to duplicate
620 * @return duplicate meta-data container
622 struct GNUNET_CONTAINER_MetaData *
623 GNUNET_CONTAINER_meta_data_duplicate (const struct GNUNET_CONTAINER_MetaData
626 struct GNUNET_CONTAINER_MetaData *ret;
627 struct MetaItem *pos;
631 ret = GNUNET_CONTAINER_meta_data_create ();
635 GNUNET_CONTAINER_meta_data_insert (ret,
650 * Try to compress the given block of data.
652 * @param data block to compress; if compression
653 * resulted in a smaller block, the first
654 * bytes of data are updated to the compressed
656 * @param oldSize number of bytes in data
657 * @param result set to the compressed data
658 * @param newSize set to size of result
659 * @return GNUNET_YES if compression reduce the size,
660 * GNUNET_NO if compression did not help
663 try_compression (const char *data,
672 dlen = compressBound (oldSize);
674 dlen = oldSize + (oldSize / 100) + 20;
675 /* documentation says 100.1% oldSize + 12 bytes, but we
676 should be able to overshoot by more to be safe */
678 tmp = GNUNET_malloc (dlen);
679 if (Z_OK == compress2 ((Bytef *) tmp,
680 &dlen, (const Bytef *) data, oldSize, 9))
695 * Flag in 'version' that indicates compressed meta-data.
697 #define HEADER_COMPRESSED 0x80000000
701 * Bits in 'version' that give the version number.
703 #define HEADER_VERSION_MASK 0x7FFFFFFF
707 * Header for serialized meta data.
709 struct MetaDataHeader
712 * The version of the MD serialization. The highest bit is used to
713 * indicate compression.
715 * Version 0 is traditional (pre-0.9) meta data (unsupported)
716 * Version is 1 for a NULL pointer
717 * Version 2 is for 0.9.x (and possibly higher)
718 * Other version numbers are not yet defined.
723 * How many MD entries are there?
728 * Size of the decompressed meta data.
733 * This is followed by 'entries' values of type 'struct MetaDataEntry'
734 * and then by 'entry' plugin names, mime-types and data blocks
735 * as specified in those meta data entries.
741 * Entry of serialized meta data.
746 * Meta data type. Corresponds to an 'enum EXTRACTOR_MetaType'
751 * Meta data format. Corresponds to an 'enum EXTRACTOR_MetaFormat'
756 * Number of bytes of meta data.
761 * Number of bytes in the plugin name including 0-terminator. 0 for NULL.
763 uint32_t plugin_name_len;
766 * Number of bytes in the mime type including 0-terminator. 0 for NULL.
768 uint32_t mime_type_len;
774 * Serialize meta-data to target.
776 * @param md metadata to serialize
777 * @param target where to write the serialized metadata;
778 * *target can be NULL, in which case memory is allocated
779 * @param max maximum number of bytes available in target
780 * @param opt is it ok to just write SOME of the
781 * meta-data to match the size constraint,
782 * possibly discarding some data?
783 * @return number of bytes written on success,
784 * GNUNET_SYSERR on error (typically: not enough
788 GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
789 *md, char **target, size_t max,
791 GNUNET_CONTAINER_MetaDataSerializationOptions
794 struct GNUNET_CONTAINER_MetaData *vmd;
795 struct MetaItem *pos;
796 struct MetaDataHeader ihdr;
797 struct MetaDataHeader *hdr;
798 struct MetaDataEntry *ent;
813 if (max < sizeof (struct MetaDataHeader))
814 return GNUNET_SYSERR; /* far too small */
818 if (md->sbuf != NULL)
820 /* try to use serialization cache */
821 if (md->sbuf_size <= max)
824 *target = GNUNET_malloc (md->sbuf_size);
828 return md->sbuf_size;
830 if (0 == (opt & GNUNET_CONTAINER_META_DATA_SERIALIZE_PART))
831 return GNUNET_SYSERR; /* can say that this will fail */
832 /* need to compute a partial serialization, sbuf useless ... */
839 msize += sizeof (struct MetaDataEntry);
840 msize += pos->data_size;
841 if (pos->plugin_name != NULL)
842 msize += strlen (pos->plugin_name) + 1;
843 if (pos->mime_type != NULL)
844 msize += strlen (pos->mime_type) + 1;
847 size = (size_t) msize;
850 GNUNET_break (0); /* integer overflow */
851 return GNUNET_SYSERR;
853 if (size >= GNUNET_MAX_MALLOC_CHECKED)
855 /* too large to be processed */
856 return GNUNET_SYSERR;
858 ent = GNUNET_malloc (size);
859 mdata = (char *) &ent[md->item_count];
860 off = size - (md->item_count * sizeof(struct MetaDataEntry));
865 ent[i].type = htonl ((uint32_t) pos->type);
866 ent[i].format = htonl ((uint32_t) pos->format);
867 ent[i].data_size = htonl ((uint32_t) pos->data_size);
868 if (pos->plugin_name == NULL)
871 plen = strlen (pos->plugin_name) + 1;
872 ent[i].plugin_name_len = htonl ( (uint32_t) plen);
873 if (pos->mime_type == NULL)
876 mlen = strlen (pos->mime_type) + 1;
877 ent[i].mime_type_len = htonl ((uint32_t) mlen);
878 off -= pos->data_size;
879 memcpy (&mdata[off], pos->data, pos->data_size);
881 if (pos->plugin_name != NULL)
882 memcpy (&mdata[off], pos->plugin_name, plen);
884 if (pos->mime_type != NULL)
885 memcpy (&mdata[off], pos->mime_type, mlen);
889 GNUNET_assert (off == 0);
899 if (0 == (opt & GNUNET_CONTAINER_META_DATA_SERIALIZE_NO_COMPRESS))
900 comp = try_compression ((const char*) &ent[i],
905 if ( (md->sbuf == NULL) &&
908 /* fill 'sbuf'; this "modifies" md, but since this is only
909 an internal cache we will cast away the 'const' instead
910 of making the API look strange. */
911 vmd = (struct GNUNET_CONTAINER_MetaData*) md;
912 hdr = GNUNET_malloc (left + sizeof (struct MetaDataHeader));
913 hdr->size = htonl (left);
914 hdr->entries = htonl (md->item_count);
915 if (GNUNET_YES == comp)
917 GNUNET_assert (clen < left);
918 hdr->version = htonl (2 | HEADER_COMPRESSED);
922 vmd->sbuf_size = clen + sizeof (struct MetaDataHeader);
926 hdr->version = htonl (2);
930 vmd->sbuf_size = left + sizeof (struct MetaDataHeader);
932 vmd->sbuf = (char*) hdr;
935 if ( ( (left + sizeof (struct MetaDataHeader)) <= max) ||
936 ( (comp == GNUNET_YES) &&
939 /* success, this now fits! */
940 if (GNUNET_YES == comp)
943 dst = GNUNET_malloc (clen + sizeof (struct MetaDataHeader));
944 hdr = (struct MetaDataHeader*) dst;
945 hdr->version = htonl (2 | HEADER_COMPRESSED);
946 hdr->size = htonl (left);
947 hdr->entries = htonl (md->item_count - i);
948 memcpy (&dst[sizeof(struct MetaDataHeader)],
953 rlen = clen + sizeof (struct MetaDataHeader);
958 dst = GNUNET_malloc (left + sizeof (struct MetaDataHeader));
959 hdr = (struct MetaDataHeader*) dst;
960 hdr->version = htonl (2);
961 hdr->entries = htonl (md->item_count - i);
962 hdr->size = htonl (left);
963 memcpy (&dst[sizeof(struct MetaDataHeader)],
967 rlen = left + sizeof (struct MetaDataHeader);
971 memcpy (*target, dst, clen + sizeof (struct MetaDataHeader));
981 if (0 == (opt & GNUNET_CONTAINER_META_DATA_SERIALIZE_PART))
985 return GNUNET_SYSERR;
988 /* next iteration: ignore the corresponding meta data at the
989 end and try again without it */
990 left -= sizeof (struct MetaDataEntry);
991 left -= pos->data_size;
992 if (pos->plugin_name != NULL)
993 left -= strlen (pos->plugin_name) + 1;
994 if (pos->mime_type != NULL)
995 left -= strlen (pos->mime_type) + 1;
1001 /* nothing fit, only write header! */
1002 ihdr.version = htonl (2);
1003 ihdr.entries = htonl (0);
1004 ihdr.size = htonl (0);
1005 if (*target == NULL)
1006 *target = GNUNET_malloc (sizeof (struct MetaDataHeader));
1007 memcpy (*target, &ihdr, sizeof (struct MetaDataHeader));
1008 return sizeof (struct MetaDataHeader);
1013 * Get the size of the full meta-data in serialized form.
1015 * @param md metadata to inspect
1016 * @return number of bytes needed for serialization, -1 on error
1019 GNUNET_CONTAINER_meta_data_get_serialized_size (const struct GNUNET_CONTAINER_MetaData *md)
1024 if (md->sbuf != NULL)
1025 return md->sbuf_size;
1027 ret = GNUNET_CONTAINER_meta_data_serialize (md,
1029 GNUNET_MAX_MALLOC_CHECKED,
1030 GNUNET_CONTAINER_META_DATA_SERIALIZE_FULL);
1038 * Decompress input, return the decompressed data
1039 * as output, set outputSize to the number of bytes
1042 * @param input compressed data
1043 * @param inputSize number of bytes in input
1044 * @param outputSize expected size of the output
1045 * @return NULL on error
1048 decompress (const char *input,
1056 output = GNUNET_malloc (olen);
1057 if (Z_OK == uncompress ((Bytef *) output,
1058 &olen, (const Bytef *) input, inputSize))
1064 GNUNET_free (output);
1071 * Deserialize meta-data. Initializes md.
1073 * @param input buffer with the serialized metadata
1074 * @param size number of bytes available in input
1075 * @return MD on success, NULL on error (i.e.
1078 struct GNUNET_CONTAINER_MetaData *
1079 GNUNET_CONTAINER_meta_data_deserialize (const char *input, size_t size)
1081 struct GNUNET_CONTAINER_MetaData *md;
1082 struct MetaDataHeader hdr;
1083 struct MetaDataEntry ent;
1096 const char *meta_data;
1097 const char *plugin_name;
1098 const char *mime_type;
1099 enum EXTRACTOR_MetaFormat format;
1101 if (size < sizeof (struct MetaDataHeader))
1105 sizeof (struct MetaDataHeader));
1106 version = ntohl (hdr.version) & HEADER_VERSION_MASK;
1107 compressed = (ntohl (hdr.version) & HEADER_COMPRESSED) != 0;
1110 return NULL; /* null pointer */
1113 GNUNET_break_op (0); /* unsupported version */
1117 ic = ntohl (hdr.entries);
1118 dataSize = ntohl (hdr.size);
1119 if ((sizeof (struct MetaDataEntry) * ic) > dataSize)
1121 GNUNET_break_op (0);
1127 if (dataSize >= GNUNET_MAX_MALLOC_CHECKED)
1129 /* make sure we don't blow our memory limit because of a mal-formed
1131 GNUNET_break_op (0);
1135 decompress ((const char *) &input[sizeof (struct MetaDataHeader)],
1136 size - sizeof (struct MetaDataHeader), dataSize);
1139 GNUNET_break_op (0);
1147 cdata = (const char *) &input[sizeof (struct MetaDataHeader)];
1148 if (dataSize != size - sizeof (struct MetaDataHeader))
1150 GNUNET_break_op (0);
1155 md = GNUNET_CONTAINER_meta_data_create ();
1156 left = dataSize - ic * sizeof (struct MetaDataEntry);
1157 mdata = &cdata[ic * sizeof (struct MetaDataEntry)];
1161 &cdata[i * sizeof(struct MetaDataEntry)],
1162 sizeof (struct MetaDataEntry));
1163 format = (enum EXTRACTOR_MetaFormat) ntohl (ent.format);
1164 if ( (format != EXTRACTOR_METAFORMAT_UTF8) &&
1165 (format != EXTRACTOR_METAFORMAT_C_STRING) &&
1166 (format != EXTRACTOR_METAFORMAT_BINARY) )
1168 GNUNET_break_op (0);
1171 dlen = ntohl (ent.data_size);
1172 plen = ntohl (ent.plugin_name_len);
1173 mlen = ntohl (ent.mime_type_len);
1176 GNUNET_break_op (0);
1180 meta_data = &mdata[left];
1181 if ( (format == EXTRACTOR_METAFORMAT_UTF8) ||
1182 (format == EXTRACTOR_METAFORMAT_C_STRING) )
1185 (mdata[left + dlen - 1] != '\0') )
1187 GNUNET_break_op (0);
1193 GNUNET_break_op (0);
1198 (mdata[left + plen - 1] != '\0') )
1200 GNUNET_break_op (0);
1206 plugin_name = &mdata[left];
1210 GNUNET_break_op (0);
1215 (mdata[left + mlen - 1] != '\0') )
1217 GNUNET_break_op (0);
1223 mime_type = &mdata[left];
1224 GNUNET_CONTAINER_meta_data_insert (md,
1226 (enum EXTRACTOR_MetaType) ntohl (ent.type),
1232 GNUNET_free_non_null (data);
1237 /* end of container_meta_data.c */