aboutsummaryrefslogtreecommitdiff
path: root/src/fs/fs_file_information.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-01-30 12:21:21 +0000
committerChristian Grothoff <christian@grothoff.org>2012-01-30 12:21:21 +0000
commit4cdecaf4c7815917932a3b80812ecbd840dab4e7 (patch)
tree8cc026fc0ac98a732aa4e559c5f49b5826e3b994 /src/fs/fs_file_information.c
parent2dac3d6eb9599b50e064b9ddb8796a12c480874e (diff)
downloadgnunet-4cdecaf4c7815917932a3b80812ecbd840dab4e7.tar.gz
gnunet-4cdecaf4c7815917932a3b80812ecbd840dab4e7.zip
-all meta data extraction should happen in helper, removing from API
Diffstat (limited to 'src/fs/fs_file_information.c')
-rw-r--r--src/fs/fs_file_information.c59
1 files changed, 0 insertions, 59 deletions
diff --git a/src/fs/fs_file_information.c b/src/fs/fs_file_information.c
index 01ce6f54b..a633dcb7b 100644
--- a/src/fs/fs_file_information.c
+++ b/src/fs/fs_file_information.c
@@ -22,10 +22,6 @@
22 * @file fs/fs_file_information.c 22 * @file fs/fs_file_information.c
23 * @brief Manage information for publishing directory hierarchies 23 * @brief Manage information for publishing directory hierarchies
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 *
26 * TODO:
27 * - metadata filename clean up code
28 * - metadata/ksk generation for directories from contained files
29 */ 25 */
30#include "platform.h" 26#include "platform.h"
31#include <extractor.h> 27#include <extractor.h>
@@ -35,61 +31,6 @@
35 31
36 32
37/** 33/**
38 * Add meta data that libextractor finds to our meta data
39 * container.
40 *
41 * @param cls closure, our meta data container
42 * @param plugin_name name of the plugin that produced this value;
43 * special values can be used (i.e. '&lt;zlib&gt;' for zlib being
44 * used in the main libextractor library and yielding
45 * meta data).
46 * @param type libextractor-type describing the meta data
47 * @param format basic format information about data
48 * @param data_mime_type mime-type of data (not of the original file);
49 * can be NULL (if mime-type is not known)
50 * @param data actual meta-data found
51 * @param data_len number of bytes in data
52 * @return always 0 to continue extracting
53 */
54static int
55add_to_md (void *cls, const char *plugin_name, enum EXTRACTOR_MetaType type,
56 enum EXTRACTOR_MetaFormat format, const char *data_mime_type,
57 const char *data, size_t data_len)
58{
59 struct GNUNET_CONTAINER_MetaData *md = cls;
60
61 (void) GNUNET_CONTAINER_meta_data_insert (md, plugin_name, type, format,
62 data_mime_type, data, data_len);
63 return 0;
64}
65
66
67/**
68 * Extract meta-data from a file.
69 *
70 * @return GNUNET_SYSERR on error, otherwise the number
71 * of meta-data items obtained
72 */
73int
74GNUNET_FS_meta_data_extract_from_file (struct GNUNET_CONTAINER_MetaData *md,
75 const char *filename,
76 struct EXTRACTOR_PluginList *extractors)
77{
78 int old;
79
80 if (filename == NULL)
81 return GNUNET_SYSERR;
82 if (extractors == NULL)
83 return 0;
84 old = GNUNET_CONTAINER_meta_data_iterate (md, NULL, NULL);
85 GNUNET_assert (old >= 0);
86 EXTRACTOR_extract (extractors, filename, NULL, 0, &add_to_md, md);
87 return (GNUNET_CONTAINER_meta_data_iterate (md, NULL, NULL) - old);
88}
89
90
91
92/**
93 * Obtain the name under which this file information 34 * Obtain the name under which this file information
94 * structure is stored on disk. Only works for top-level 35 * structure is stored on disk. Only works for top-level
95 * file information structures. 36 * file information structures.