30 #include <extractor.h> 34 #define LOG(kind, ...) GNUNET_log_from (kind, "util-container-meta-data", \ 65 dlen = compressBound (old_size);
67 dlen = old_size + (old_size / 100) + 20;
73 compress2 ((Bytef *) tmp,
111 uncompress ((Bytef *) output,
113 (
const Bytef *) input,
236 if (NULL == md->
sbuf)
357 const char *data_mime_type,
const char *
data,
373 (0 == memcmp (pos->
data, data, data_size)))
375 if ((NULL == pos->
mime_type) && (NULL != data_mime_type))
404 (NULL == data_mime_type) ? NULL :
GNUNET_strdup (data_mime_type);
413 while ((
'\0' != *p) && (p < mi->data + data_size))
449 data_mime_type, data, data_size);
490 if ((pos->
type == type) &&
493 (0 == memcmp (pos->
data, data, data_size)))))
527 dat, strlen (dat) + 1);
579 if ((type == pos->
type) &&
613 type = va_arg (args,
int);
634 *md,
unsigned char **thumb)
645 (0 == strncasecmp (
"image/", pos->
mime_type, strlen (
"image/"))) &&
655 if ((NULL == match) || (0 == match->
data_size))
690 #define HEADER_COMPRESSED 0x80000000 696 #define HEADER_VERSION_MASK 0x7FFFFFFF 781 *md,
char **target,
size_t max,
810 if (NULL != md->
sbuf)
835 size = (size_t) msize;
852 ent[i].
type = htonl ((uint32_t) pos->
type);
893 if ((NULL == md->
sbuf) && (0 == i))
900 hdr->
size = htonl (left);
915 vmd->
sbuf = (
char *) hdr;
928 hdr->
size = htonl (left);
943 hdr->
size = htonl (left);
989 ihdr.
size = htonl (0);
1010 if (NULL != md->
sbuf)
1048 const char *meta_data;
1068 dataSize = ntohl (hdr.
size);
1111 for (i = 0; i < ic; i++)
1132 meta_data = &mdata[left];
1141 if (
'\0' != meta_data[dlen - 1])
1153 if ((plen > 0) && (
'\0' != mdata[left + plen - 1]))
1161 plugin_name = &mdata[left];
1169 if ((mlen > 0) && (
'\0' != mdata[left + mlen - 1]))
1177 mime_type = &mdata[left];
1180 ntohl (ent.
type), format, mime_type,
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
EXTRACTOR_MetaFormat
Format in which the extracted meta data is presented.
Some kind of binary format, see given Mime type.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
static int ret
Return value of the commandline.
0-terminated, UTF-8 encoded string.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
EXTRACTOR_MetaType
Enumeration defining various sources of keywords.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
int(* EXTRACTOR_MetaDataProcessor)(void *cls, const char *plugin_name, enum EXTRACTOR_MetaType type, enum EXTRACTOR_MetaFormat format, const char *data_mime_type, const char *data, size_t data_len)
Type of a function that libextractor calls for each meta data item found.
static struct GNUNET_OS_Process * p
Helper process we started.
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
static int result
Global testing status.
#define GNUNET_CONTAINER_DLL_insert_after(head, tail, other, element)
Insert an element into a DLL after the given other element.
uint32_t mime_type_len
Number of bytes in the mime type including 0-terminator.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
static unsigned int size
Size of the "table".
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
#define GNUNET_MAX_MALLOC_CHECKED
Maximum allocation with GNUNET_malloc macro.
uint32_t plugin_name_len
Number of bytes in the plugin name including 0-terminator.
uint32_t format
Meta data format.
Time for absolute times used by GNUnet, in microseconds.
uint32_t type
Meta data type.
uint32_t data_size
Number of bytes of meta data.
const char * GNUNET_STRINGS_absolute_time_to_string(struct GNUNET_TIME_Absolute t)
Like asctime, except for GNUnet time.
Entry of serialized meta data.
uint32_t data
The data value.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.