Storing of meta data. More...
Go to the source code of this file.
Data Structures | |
struct | MetaItem |
Meta data item. More... | |
struct | GNUNET_FS_MetaData |
Meta data to associate with a file, directory or namespace. More... | |
struct | MetaDataHeader |
Header for serialized meta data. More... | |
struct | MetaDataEntry |
Entry of serialized meta data. More... | |
Macros | |
#define | MAX_META_DATA (1024 * 1024) |
Maximum size allowed for meta data written/read from disk. More... | |
#define | LOG(kind, ...) |
#define | HEADER_COMPRESSED 0x80000000 |
Flag in 'version' that indicates compressed meta-data. More... | |
#define | HEADER_VERSION_MASK 0x7FFFFFFF |
Bits in 'version' that give the version number. More... | |
Functions | |
struct GNUNET_FS_MetaData * | GNUNET_FS_meta_data_create () |
Create a fresh struct FS_MetaData token. More... | |
static void | meta_item_free (struct MetaItem *mi) |
Free meta data item. More... | |
static void | invalidate_sbuf (struct GNUNET_FS_MetaData *md) |
The meta data has changed, invalidate its serialization buffer. More... | |
void | GNUNET_FS_meta_data_destroy (struct GNUNET_FS_MetaData *md) |
Free meta data. More... | |
void | GNUNET_FS_meta_data_clear (struct GNUNET_FS_MetaData *md) |
Remove all items in the container. More... | |
int | GNUNET_FS_meta_data_test_equal (const struct GNUNET_FS_MetaData *md1, const struct GNUNET_FS_MetaData *md2) |
Test if two MDs are equal. More... | |
int | GNUNET_FS_meta_data_insert (struct GNUNET_FS_MetaData *md, const char *plugin_name, enum EXTRACTOR_MetaType type, enum EXTRACTOR_MetaFormat format, const char *data_mime_type, const char *data, size_t data_size) |
Extend metadata. More... | |
static int | merge_helper (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_size) |
Merge given meta data. More... | |
void | GNUNET_FS_meta_data_merge (struct GNUNET_FS_MetaData *md, const struct GNUNET_FS_MetaData *in) |
Extend metadata. More... | |
int | GNUNET_FS_meta_data_delete (struct GNUNET_FS_MetaData *md, enum EXTRACTOR_MetaType type, const char *data, size_t data_size) |
Remove an item. More... | |
void | GNUNET_FS_meta_data_add_publication_date (struct GNUNET_FS_MetaData *md) |
Add the current time as the publication date to the meta-data. More... | |
int | GNUNET_FS_meta_data_iterate (const struct GNUNET_FS_MetaData *md, EXTRACTOR_MetaDataProcessor iter, void *iter_cls) |
Iterate over MD entries. More... | |
char * | GNUNET_FS_meta_data_get_by_type (const struct GNUNET_FS_MetaData *md, enum EXTRACTOR_MetaType type) |
Get the first MD entry of the given type. More... | |
char * | GNUNET_FS_meta_data_get_first_by_types (const struct GNUNET_FS_MetaData *md,...) |
Get the first matching MD entry of the given types. More... | |
size_t | GNUNET_FS_meta_data_get_thumbnail (const struct GNUNET_FS_MetaData *md, unsigned char **thumb) |
Get a thumbnail from the meta-data (if present). More... | |
struct GNUNET_FS_MetaData * | GNUNET_FS_meta_data_duplicate (const struct GNUNET_FS_MetaData *md) |
Duplicate a struct GNUNET_FS_MetaData . More... | |
ssize_t | GNUNET_FS_meta_data_serialize (const struct GNUNET_FS_MetaData *md, char **target, size_t max, enum GNUNET_FS_MetaDataSerializationOptions opt) |
Serialize meta-data to target. More... | |
ssize_t | GNUNET_FS_meta_data_get_serialized_size (const struct GNUNET_FS_MetaData *md) |
Get the size of the full meta-data in serialized form. More... | |
struct GNUNET_FS_MetaData * | GNUNET_FS_meta_data_deserialize (const char *input, size_t size) |
Deserialize meta-data. More... | |
enum GNUNET_GenericReturnValue | GNUNET_FS_read_meta_data (struct GNUNET_BIO_ReadHandle *h, const char *what, struct GNUNET_FS_MetaData **result) |
Read a metadata container. More... | |
enum GNUNET_GenericReturnValue | GNUNET_FS_write_meta_data (struct GNUNET_BIO_WriteHandle *h, const char *what, const struct GNUNET_FS_MetaData *m) |
Write a metadata container. More... | |
static int | read_spec_handler_meta_data (void *cls, struct GNUNET_BIO_ReadHandle *h, const char *what, void *target, size_t target_size) |
Function used internally to read a metadata container from within a read spec. More... | |
struct GNUNET_BIO_ReadSpec | GNUNET_FS_read_spec_meta_data (const char *what, struct GNUNET_FS_MetaData **result) |
Create the specification to read a metadata container. More... | |
static int | write_spec_handler_meta_data (void *cls, struct GNUNET_BIO_WriteHandle *h, const char *what, void *source, size_t source_size) |
Function used internally to write a metadata container from within a write spec. More... | |
struct GNUNET_BIO_WriteSpec | GNUNET_FS_write_spec_meta_data (const char *what, const struct GNUNET_FS_MetaData *m) |
Create the specification to write a metadata container. More... | |
Storing of meta data.
Definition in file meta_data.c.
#define MAX_META_DATA (1024 * 1024) |
Maximum size allowed for meta data written/read from disk.
File-sharing limits to 64k, so this should be rather generous.
Definition at line 35 of file meta_data.c.
#define LOG | ( | kind, | |
... | |||
) |
Definition at line 38 of file meta_data.c.
#define HEADER_COMPRESSED 0x80000000 |
Flag in 'version' that indicates compressed meta-data.
Definition at line 547 of file meta_data.c.
#define HEADER_VERSION_MASK 0x7FFFFFFF |
Bits in 'version' that give the version number.
Definition at line 553 of file meta_data.c.
|
static |
Free meta data item.
mi | item to free |
Definition at line 139 of file meta_data.c.
References MetaItem::data, GNUNET_free, MetaItem::mime_type, and MetaItem::plugin_name.
Referenced by GNUNET_FS_meta_data_clear(), GNUNET_FS_meta_data_delete(), and GNUNET_FS_meta_data_destroy().
|
static |
The meta data has changed, invalidate its serialization buffer.
md | meta data that changed |
Definition at line 155 of file meta_data.c.
References GNUNET_free, GNUNET_FS_MetaData::sbuf, and GNUNET_FS_MetaData::sbuf_size.
Referenced by GNUNET_FS_meta_data_delete(), and GNUNET_FS_meta_data_insert().
|
static |
Merge given meta data.
cls | the struct GNUNET_FS_MetaData to merge into |
plugin_name | name of the plugin that produced this value; special values can be used (e.g. '<zlib>' for zlib being used in the main libextractor library and yielding meta data). |
type | libextractor-type describing the meta data |
format | basic format information about data |
data_mime_type | mime-type of data (not of the original file); can be NULL (if mime-type is not known) |
data | actual meta-data found |
data_size | number of bytes in data |
Definition at line 343 of file meta_data.c.
References data, data_size, GNUNET_FS_meta_data_insert(), plugin_name, and type.
Referenced by GNUNET_FS_meta_data_merge().
|
static |
Function used internally to read a metadata container from within a read spec.
cls | ignored, always NULL |
h | the IO handle to read from |
what | what is being read (for error message creation) |
target | where to store the data |
target_size | ignored |
Definition at line 1166 of file meta_data.c.
References GNUNET_FS_read_meta_data(), h, and result.
Referenced by GNUNET_FS_read_spec_meta_data().
|
static |
Function used internally to write a metadata container from within a write spec.
cls | ignored, always NULL |
h | the IO handle to write to |
what | what is being written (for error message creation) |
source | the data to write |
source_size | ignored |
Definition at line 1211 of file meta_data.c.
References GNUNET_FS_write_meta_data(), h, m, and source.
Referenced by GNUNET_FS_write_spec_meta_data().