aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-05-30 18:35:02 +0000
committerChristian Grothoff <christian@grothoff.org>2015-05-30 18:35:02 +0000
commit93fba12ad8159dc6b683f9e7ce9f0528a11047f5 (patch)
tree73b1bd212c6c5a32adb924d208d8a315b606e854 /src
parentcfd880578bd21f9adedba557291c903d325e93cd (diff)
make libextractor actually optional, both for GNUnet and GNUnet-taler builds
Diffstat (limited to 'src')
-rw-r--r--src/fs/Makefile.am64
-rw-r--r--src/fs/fs_file_information.c2
-rw-r--r--src/fs/fs_getopt.c15
-rw-r--r--src/fs/gnunet-directory.c21
-rw-r--r--src/fs/gnunet-helper-fs-publish.c35
-rw-r--r--src/fs/gnunet-publish.c4
-rw-r--r--src/fs/gnunet-search.c6
-rw-r--r--src/fs/test_fs_directory.c8
-rw-r--r--src/include/Makefile.am3
-rw-r--r--src/include/gnunet_configuration_lib.h1
-rw-r--r--src/include/gnunet_container_lib.h94
-rw-r--r--src/include/gnunet_crypto_lib.h6
-rw-r--r--src/include/gnunet_util_taler_wallet_lib.h1
-rw-r--r--src/util/Makefile.am3
-rw-r--r--src/util/common_allocation.c2
-rw-r--r--src/util/common_endian.c2
-rw-r--r--src/util/common_logging.c10
-rw-r--r--src/util/configuration.c5
-rw-r--r--src/util/container_heap.c2
-rw-r--r--src/util/container_meta_data.c9
-rw-r--r--src/util/container_multihashmap.c2
-rw-r--r--src/util/container_multihashmap32.c2
-rw-r--r--src/util/crypto_crc.c2
-rw-r--r--src/util/crypto_ecc.c3
-rw-r--r--src/util/crypto_hash.c3
-rw-r--r--src/util/crypto_mpi.c2
-rw-r--r--src/util/crypto_random.c2
-rw-r--r--src/util/crypto_rsa.c8
-rw-r--r--src/util/crypto_symmetric.c2
-rw-r--r--src/util/disk.c3
-rw-r--r--src/util/disk.h3
-rw-r--r--src/util/strings.c3
-rw-r--r--src/util/test_container_meta_data.c14
-rw-r--r--src/util/time.c3
34 files changed, 279 insertions, 66 deletions
diff --git a/src/fs/Makefile.am b/src/fs/Makefile.am
index 8ac42c18d6..736339aabf 100644
--- a/src/fs/Makefile.am
+++ b/src/fs/Makefile.am
@@ -51,7 +51,12 @@ libgnunetfs_la_SOURCES = \
libgnunetfs_la_LIBADD = \
$(top_builddir)/src/datastore/libgnunetdatastore.la \
$(top_builddir)/src/util/libgnunetutil.la \
- $(GN_LIBINTL) $(XLIB) $(LIBGCRYPT_LIBS) -lunistring -lextractor
+ $(GN_LIBINTL) $(XLIB) $(LIBGCRYPT_LIBS) -lunistring
+
+if HAVE_LIBEXTRACTOR
+libgnunetfs_la_LIBADD += \
+ -lextractor
+endif
libgnunetfs_la_LDFLAGS = \
$(GN_LIB_LDFLAGS) $(WINFLAGS) \
@@ -92,9 +97,13 @@ gnunet_directory_SOURCES = \
gnunet_directory_LDADD = \
libgnunetfs.la \
$(top_builddir)/src/util/libgnunetutil.la \
- -lextractor \
$(GN_LIBINTL)
+if HAVE_LIBEXTRACTOR
+gnunet_directory_LDADD += \
+ -lextractor
+endif
+
gnunet_fs_profiler_SOURCES = \
gnunet-fs-profiler.c
gnunet_fs_profiler_LDADD = \
@@ -107,9 +116,13 @@ gnunet_fs_SOURCES = \
gnunet_fs_LDADD = \
libgnunetfs.la \
$(top_builddir)/src/util/libgnunetutil.la \
- -lextractor \
$(GN_LIBINTL)
+if HAVE_LIBEXTRACTOR
+gnunet_fs_LDADD += \
+ -lextractor
+endif
+
gnunet_download_SOURCES = \
gnunet-download.c
gnunet_download_LDADD = \
@@ -123,31 +136,48 @@ gnunet_publish_LDADD = \
$(top_builddir)/src/identity/libgnunetidentity.la \
libgnunetfs.la \
$(top_builddir)/src/util/libgnunetutil.la \
- -lextractor \
$(GN_LIBINTL)
+if HAVE_LIBEXTRACTOR
+gnunet_publish_LDADD += \
+ -lextractor
+endif
+
gnunet_auto_share_SOURCES = \
gnunet-auto-share.c
gnunet_auto_share_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la \
- -lextractor \
$(GN_LIBINTL)
+if HAVE_LIBEXTRACTOR
+gnunet_auto_share_LDADD += \
+ -lextractor
+endif
+
gnunet_helper_fs_publish_SOURCES = \
gnunet-helper-fs-publish.c
gnunet_helper_fs_publish_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la \
- -lextractor \
$(GN_LIBINTL)
+if HAVE_LIBEXTRACTOR
+gnunet_helper_fs_publish_LDADD += \
+ -lextractor
+endif
+
gnunet_search_SOURCES = \
gnunet-search.c
gnunet_search_LDADD = \
libgnunetfs.la \
$(top_builddir)/src/util/libgnunetutil.la \
- -lextractor \
$(GN_LIBINTL)
+if HAVE_LIBEXTRACTOR
+gnunet_search_LDADD += \
+ -lextractor
+endif
+
+
gnunet_daemon_fsprofiler_SOURCES = \
gnunet-daemon-fsprofiler.c
gnunet_daemon_fsprofiler_LDADD = \
@@ -243,9 +273,13 @@ test_plugin_block_fs_LDADD = \
if HAVE_PYTHON
check_SCRIPTS = \
- test_gnunet_fs_psd.py \
test_gnunet_fs_rec.py \
test_gnunet_fs_idx.py
+
+if HAVE_LIBEXTRACTOR
+check_SCRIPTS += \
+ test_gnunet_fs_psd.py
+endif
endif
if ENABLE_MONKEY
@@ -289,10 +323,15 @@ endif
test_fs_directory_SOURCES = \
test_fs_directory.c
test_fs_directory_LDADD = \
- -lextractor \
libgnunetfs.la \
$(top_builddir)/src/util/libgnunetutil.la
+if HAVE_LIBEXTRACTOR
+test_fs_directory_LDADD += \
+ -lextractor
+endif
+
+
test_fs_download_SOURCES = \
test_fs_download.c
test_fs_download_LDADD = \
@@ -324,10 +363,15 @@ test_fs_download_persistence_LDADD = \
test_fs_file_information_SOURCES = \
test_fs_file_information.c
test_fs_file_information_LDADD = \
- -lextractor \
libgnunetfs.la \
$(top_builddir)/src/util/libgnunetutil.la
+if HAVE_LIBEXTRACTOR
+test_fs_file_information_LDADD += \
+ -lextractor
+endif
+
+
test_fs_getopt_SOURCES = \
test_fs_getopt.c
test_fs_getopt_LDADD = \
diff --git a/src/fs/fs_file_information.c b/src/fs/fs_file_information.c
index ffe2d191db..b787ca8fd8 100644
--- a/src/fs/fs_file_information.c
+++ b/src/fs/fs_file_information.c
@@ -24,7 +24,9 @@
* @author Christian Grothoff
*/
#include "platform.h"
+#if HAVE_EXTRACTOR_H
#include <extractor.h>
+#endif
#include "gnunet_fs_service.h"
#include "fs_api.h"
#include "fs_tree.h"
diff --git a/src/fs/fs_getopt.c b/src/fs/fs_getopt.c
index d2ee34a948..86fc9578ca 100644
--- a/src/fs/fs_getopt.c
+++ b/src/fs/fs_getopt.c
@@ -118,17 +118,20 @@ GNUNET_FS_getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext
* @param scls must be of type "struct GNUNET_MetaData **"
* @param option name of the option (typically 'k')
* @param value command line argument given
- * @return GNUNET_OK on success
+ * @return #GNUNET_OK on success
*/
int
-GNUNET_FS_getopt_set_metadata (struct GNUNET_GETOPT_CommandLineProcessorContext
- *ctx, void *scls, const char *option,
+GNUNET_FS_getopt_set_metadata (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
+ void *scls,
+ const char *option,
const char *value)
{
struct GNUNET_CONTAINER_MetaData **mm = scls;
+#if HAVE_EXTRACTOR_H
enum EXTRACTOR_MetaType type;
const char *typename;
const char *typename_i18n;
+#endif
struct GNUNET_CONTAINER_MetaData *meta;
char *tmp;
@@ -144,7 +147,7 @@ GNUNET_FS_getopt_set_metadata (struct GNUNET_GETOPT_CommandLineProcessorContext
*/
/*tmp = GNUNET_STRINGS_to_utf8 (value, strlen (value), locale_charset ());*/
tmp = GNUNET_strdup (value);
-
+#if HAVE_EXTRACTOR_H
type = EXTRACTOR_metatype_get_max ();
while (type > 0)
{
@@ -181,7 +184,9 @@ GNUNET_FS_getopt_set_metadata (struct GNUNET_GETOPT_CommandLineProcessorContext
break;
}
}
- if (tmp != NULL)
+#endif
+
+ if (NULL != tmp)
{
GNUNET_CONTAINER_meta_data_insert (meta, "<gnunet>",
EXTRACTOR_METATYPE_UNKNOWN,
diff --git a/src/fs/gnunet-directory.c b/src/fs/gnunet-directory.c
index 536766abba..c06e1aca2a 100644
--- a/src/fs/gnunet-directory.c
+++ b/src/fs/gnunet-directory.c
@@ -36,13 +36,17 @@ static int ret;
* @param format format of data
* @param data_mime_type mime type of data
* @param data value of the meta data
- * @param data_size number of bytes in data
+ * @param data_size number of bytes in @a data
* @return always 0 (to continue iterating)
*/
static int
-item_printer (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)
+item_printer (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)
{
if (type == EXTRACTOR_METATYPE_GNUNET_FULL_DATA)
{
@@ -55,9 +59,16 @@ item_printer (void *cls, const char *plugin_name, enum EXTRACTOR_MetaType type,
return 0;
if (type == EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME)
return 0;
+#if HAVE_LIBEXTRACTOR
printf ("\t%20s: %s\n",
dgettext (LIBEXTRACTOR_GETTEXT_DOMAIN,
- EXTRACTOR_metatype_to_string (type)), data);
+ EXTRACTOR_metatype_to_string (type)),
+ data);
+#else
+ printf ("\t%20d: %s\n",
+ type,
+ data);
+#endif
return 0;
}
diff --git a/src/fs/gnunet-helper-fs-publish.c b/src/fs/gnunet-helper-fs-publish.c
index 2e63b12a81..6c2c76fe9b 100644
--- a/src/fs/gnunet-helper-fs-publish.c
+++ b/src/fs/gnunet-helper-fs-publish.c
@@ -82,10 +82,12 @@ struct ScanTreeNode
};
+#if HAVE_LIBEXTRACTOR
/**
* List of libextractor plugins to use for extracting.
*/
static struct EXTRACTOR_PluginList *plugins;
+#endif
/**
* File descriptor we use for IPC with the parent.
@@ -93,6 +95,7 @@ static struct EXTRACTOR_PluginList *plugins;
static int output_stream;
+#if HAVE_LIBEXTRACTOR
/**
* Add meta data that libextractor finds to our meta data
* container.
@@ -111,9 +114,13 @@ static int output_stream;
* @return always 0 to continue extracting
*/
static int
-add_to_md (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)
+add_to_md (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)
{
struct GNUNET_CONTAINER_MetaData *md = cls;
@@ -134,6 +141,7 @@ add_to_md (void *cls, const char *plugin_name, enum EXTRACTOR_MetaType type,
}
return 0;
}
+#endif
/**
@@ -151,7 +159,7 @@ free_tree (struct ScanTreeNode *tree)
if (NULL != tree->parent)
GNUNET_CONTAINER_DLL_remove (tree->parent->children_head,
tree->parent->children_tail,
- tree);
+ tree);
GNUNET_free (tree->filename);
GNUNET_free (tree);
}
@@ -383,7 +391,13 @@ extract_files (struct ScanTreeNode *item)
/* this is the expensive operation, *afterwards* we'll check for aborts */
meta = GNUNET_CONTAINER_meta_data_create ();
- EXTRACTOR_extract (plugins, item->filename, NULL, 0, &add_to_md, meta);
+#if HAVE_LIBEXTRACTOR
+ EXTRACTOR_extract (plugins,
+ item->filename,
+ NULL, 0,
+ &add_to_md,
+ meta);
+#endif
slen = strlen (item->filename) + 1;
size = GNUNET_CONTAINER_meta_data_get_serialized_size (meta);
if (-1 == size)
@@ -525,10 +539,12 @@ main (int argc,
if ( (NULL == ex) ||
(0 != strcmp (ex, "-")) )
{
+#if HAVE_LIBEXTRACTOR
plugins = EXTRACTOR_plugin_add_defaults (EXTRACTOR_OPTION_DEFAULT_POLICY);
if (NULL != ex)
plugins = EXTRACTOR_plugin_add_config (plugins, ex,
EXTRACTOR_OPTION_DEFAULT_POLICY);
+#endif
}
/* scan tree to find out how much work there is to be done */
@@ -536,7 +552,9 @@ main (int argc,
&root))
{
(void) write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_ERROR, NULL, 0);
+#if HAVE_LIBEXTRACTOR
EXTRACTOR_plugin_remove_all (plugins);
+#endif
#if WINDOWS
GNUNET_free ((void*) argv);
#endif
@@ -547,7 +565,9 @@ main (int argc,
if (GNUNET_OK !=
write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_COUNTING_DONE, NULL, 0))
{
+#if HAVE_LIBEXTRACTOR
EXTRACTOR_plugin_remove_all (plugins);
+#endif
#if WINDOWS
GNUNET_free ((void*) argv);
#endif
@@ -560,7 +580,9 @@ main (int argc,
{
(void) write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_ERROR, NULL, 0);
free_tree (root);
+#if HAVE_LIBEXTRACTOR
EXTRACTOR_plugin_remove_all (plugins);
+#endif
#if WINDOWS
GNUNET_free ((void*) argv);
#endif
@@ -570,7 +592,9 @@ main (int argc,
}
/* enable "clean" shutdown by telling parent that we are done */
(void) write_message (GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_FINISHED, NULL, 0);
+#if HAVE_LIBEXTRACTOR
EXTRACTOR_plugin_remove_all (plugins);
+#endif
#if WINDOWS
GNUNET_free ((void*) argv);
#endif
@@ -578,4 +602,3 @@ main (int argc,
}
/* end of gnunet-helper-fs-publish.c */
-
diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c
index b213218e45..7844acd96a 100644
--- a/src/fs/gnunet-publish.c
+++ b/src/fs/gnunet-publish.c
@@ -348,7 +348,11 @@ meta_printer (void *cls,
return 0;
if (EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME == type)
return 0;
+#if HAVE_LIBEXTRACTOR
FPRINTF (stdout, "\t%s - %s\n", EXTRACTOR_metatype_to_string (type), data);
+#else
+ FPRINTF (stdout, "\t%d - %s\n", type, data);
+#endif
return 0;
}
diff --git a/src/fs/gnunet-search.c b/src/fs/gnunet-search.c
index 395fb9ffe1..9065922e14 100644
--- a/src/fs/gnunet-search.c
+++ b/src/fs/gnunet-search.c
@@ -82,9 +82,15 @@ item_printer (void *cls, const char *plugin_name, enum EXTRACTOR_MetaType type,
return 0;
if (type == EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME)
return 0;
+#if HAVE_LIBEXTRACTOR
printf ("\t%20s: %s\n",
dgettext (LIBEXTRACTOR_GETTEXT_DOMAIN,
EXTRACTOR_metatype_to_string (type)), data);
+#else
+ printf ("\t%20d: %s\n",
+ type,
+ data);
+#endif
return 0;
}
diff --git a/src/fs/test_fs_directory.c b/src/fs/test_fs_directory.c
index bdbaf906f3..4960b8922b 100644
--- a/src/fs/test_fs_directory.c
+++ b/src/fs/test_fs_directory.c
@@ -17,15 +17,15 @@
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-
/**
* @file fs/test_fs_directory.c
* @brief Test for fs_directory.c
* @author Christian Grothoff
*/
-
#include "platform.h"
+#if HAVE_EXTRACTOR_H
#include <extractor.h>
+#endif
#include "gnunet_util_lib.h"
#include "gnunet_fs_service.h"
#include "fs_api.h"
@@ -99,7 +99,11 @@ testDirectory (unsigned int i)
{
GNUNET_snprintf (txt, sizeof (txt), "%u -- %u\n", p, q);
GNUNET_CONTAINER_meta_data_insert (mds[p], "<test>",
+#if HAVE_EXTRACTOR_H
q % EXTRACTOR_metatype_get_max (),
+#else
+ q % 128,
+#endif
EXTRACTOR_METAFORMAT_UTF8,
"text/plain", txt, strlen (txt) + 1);
}
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index c8e40bc27a..af6d02ada1 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -17,11 +17,8 @@ if TALER_ONLY
gnunetinclude_HEADERS = \
platform.h plibc.h $(WINPROC) gettext.h \
gnunet_common.h \
- gnunet_configuration_lib.h \
gnunet_container_lib.h \
gnunet_crypto_lib.h \
- gnunet_disk_lib.h \
- gnunet_scheduler_lib.h \
gnunet_strings_lib.h \
gnunet_time_lib.h \
gnunet_util_taler_wallet_lib.h
diff --git a/src/include/gnunet_configuration_lib.h b/src/include/gnunet_configuration_lib.h
index 2aaaac5831..0939424a36 100644
--- a/src/include/gnunet_configuration_lib.h
+++ b/src/include/gnunet_configuration_lib.h
@@ -28,6 +28,7 @@
#ifndef GNUNET_CONFIGURATION_LIB_H
#define GNUNET_CONFIGURATION_LIB_H
+#include "gnunet_time_lib.h"
#ifdef __cplusplus
extern "C"
diff --git a/src/include/gnunet_container_lib.h b/src/include/gnunet_container_lib.h
index 778e5b84b0..590c6a2fa8 100644
--- a/src/include/gnunet_container_lib.h
+++ b/src/include/gnunet_container_lib.h
@@ -35,8 +35,102 @@
/* add error and config prototypes */
#include "gnunet_crypto_lib.h"
+
+#if HAVE_EXTRACTOR_H
+
#include <extractor.h>
+#else
+
+/* definitions from extractor.h we need for the build */
+
+/**
+ * Enumeration defining various sources of keywords. See also
+ * http://dublincore.org/documents/1998/09/dces/
+ */
+enum EXTRACTOR_MetaType {
+ EXTRACTOR_METATYPE_RESERVED = 0,
+ EXTRACTOR_METATYPE_MIMETYPE = 1,
+ EXTRACTOR_METATYPE_FILENAME = 2,
+ EXTRACTOR_METATYPE_COMMENT = 3,
+ EXTRACTOR_METATYPE_TITLE = 4,
+ EXTRACTOR_METATYPE_BOOK_TITLE = 5,
+ EXTRACTOR_METATYPE_JOURNAL_NAME = 8,
+ EXTRACTOR_METATYPE_AUTHOR_NAME = 13,
+ EXTRACTOR_METATYPE_PUBLICATION_DATE = 24,
+ EXTRACTOR_METATYPE_URL = 29,
+ EXTRACTOR_METATYPE_URI = 30,
+ EXTRACTOR_METATYPE_ISRC = 31,
+ EXTRACTOR_METATYPE_UNKNOWN = 45,
+ EXTRACTOR_METATYPE_DESCRIPTION = 46,
+ EXTRACTOR_METATYPE_KEYWORDS = 49,
+ EXTRACTOR_METATYPE_SUBJECT = 52,
+ EXTRACTOR_METATYPE_PACKAGE_NAME = 69,
+ EXTRACTOR_METATYPE_THUMBNAIL = 114,
+ EXTRACTOR_METATYPE_ALBUM = 129,
+ EXTRACTOR_METATYPE_ARTIST = 130,
+ EXTRACTOR_METATYPE_ORIGINAL_TITLE = 162,
+ EXTRACTOR_METATYPE_GNUNET_FULL_DATA = 174,
+ EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME = 180,
+
+};
+
+/**
+ * Format in which the extracted meta data is presented.
+ */
+enum EXTRACTOR_MetaFormat {
+ /**
+ * Format is unknown.
+ */
+ EXTRACTOR_METAFORMAT_UNKNOWN = 0,
+
+ /**
+ * 0-terminated, UTF-8 encoded string. "data_len"
+ * is strlen(data)+1.
+ */
+ EXTRACTOR_METAFORMAT_UTF8 = 1,
+
+ /**
+ * Some kind of binary format, see given Mime type.
+ */
+ EXTRACTOR_METAFORMAT_BINARY = 2,
+
+ /**
+ * 0-terminated string. The specific encoding is unknown.
+ * "data_len" is strlen (data)+1.
+ */
+ EXTRACTOR_METAFORMAT_C_STRING = 3
+};
+
+
+/**
+ * Type of a function that libextractor calls for each
+ * meta data item found.
+ *
+ * @param cls closure (user-defined)
+ * @param plugin_name name of the plugin that produced this value;
+ * special values can be used (i.e. '&lt;zlib&gt;' for zlib being
+ * used in the main libextractor library and yielding
+ * meta data).
+ * @param type libextractor-type describing the meta data
+ * @param format basic format information about @a data
+ * @param data_mime_type mime-type of @a data (not of the original file);
+ * can be NULL (if mime-type is not known)
+ * @param data actual meta-data found
+ * @param data_len number of bytes in @a data
+ * @return 0 to continue extracting, 1 to abort
+ */
+typedef 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);
+
+#endif
+
#ifndef EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME
/* hack for LE < 0.6.3 */
#define EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME 180
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h
index ff337e7978..99508af43c 100644
--- a/src/include/gnunet_crypto_lib.h
+++ b/src/include/gnunet_crypto_lib.h
@@ -54,9 +54,13 @@ struct GNUNET_HashCode;
struct GNUNET_PeerIdentity;
#include "gnunet_common.h"
-#include "gnunet_scheduler_lib.h"
#include <gcrypt.h>
+/**
+ * We need this enum here, but not the entire scheduler API.
+ * For the full definition, see gnunet_scheduler_lib.h.
+ */
+enum GNUNET_SCHEDULER_Priority;
/**
* @brief A 512-bit hashcode
diff --git a/src/include/gnunet_util_taler_wallet_lib.h b/src/include/gnunet_util_taler_wallet_lib.h
index ff3b2613bd..a1db60de56 100644
--- a/src/include/gnunet_util_taler_wallet_lib.h
+++ b/src/include/gnunet_util_taler_wallet_lib.h
@@ -43,7 +43,6 @@ extern "C"
#include "gnunet_crypto_lib.h"
#include "gnunet_container_lib.h"
-#include "gnunet_disk_lib.h"
#include "gnunet_strings_lib.h"
#if 0 /* keep Emacsens' auto-indent happy */
diff --git a/src/util/Makefile.am b/src/util/Makefile.am
index a2482fc874..916a588fa5 100644
--- a/src/util/Makefile.am
+++ b/src/util/Makefile.am
@@ -128,7 +128,6 @@ libgnunetutil_taler_wallet_la_SOURCES = \
common_allocation.c \
common_endian.c \
common_logging.c \
- configuration.c \
container_heap.c \
container_multihashmap.c \
container_multihashmap32.c \
@@ -141,8 +140,6 @@ libgnunetutil_taler_wallet_la_SOURCES = \
crypto_mpi.c \
crypto_random.c \
crypto_rsa.c \
- disk.c \
- disk.h \
strings.c \
time.c
diff --git a/src/util/common_allocation.c b/src/util/common_allocation.c
index 5280d73b25..4fdc05f10a 100644
--- a/src/util/common_allocation.c
+++ b/src/util/common_allocation.c
@@ -24,7 +24,7 @@
* @author Christian Grothoff
*/
#include "platform.h"
-#include "gnunet_util_lib.h"
+#include "gnunet_crypto_lib.h"
#if HAVE_MALLOC_H
#include <malloc.h>
#endif
diff --git a/src/util/common_endian.c b/src/util/common_endian.c
index 4a8a01664b..e6c34250af 100644
--- a/src/util/common_endian.c
+++ b/src/util/common_endian.c
@@ -26,7 +26,7 @@
*/
#include "platform.h"
-#include "gnunet_util_lib.h"
+#include "gnunet_crypto_lib.h"
#define LOG(kind,...) GNUNET_log_from (kind, "util",__VA_ARGS__)
diff --git a/src/util/common_logging.c b/src/util/common_logging.c
index 695b49913e..492d00dc69 100644
--- a/src/util/common_logging.c
+++ b/src/util/common_logging.c
@@ -24,7 +24,8 @@
* @author Christian Grothoff
*/
#include "platform.h"
-#include "gnunet_util_lib.h"
+#include "gnunet_crypto_lib.h"
+#include "gnunet_strings_lib.h"
#include <regex.h>
@@ -328,7 +329,6 @@ setup_log_file (const struct tm *tm)
{
static char last_fn[PATH_MAX + 1];
char fn[PATH_MAX + 1];
- int dirwarn;
int altlog_fd;
int dup_return;
FILE *altlog;
@@ -352,7 +352,6 @@ setup_log_file (const struct tm *tm)
return GNUNET_OK; /* no change */
log_rotate (last_fn);
strcpy (last_fn, fn);
- dirwarn = (GNUNET_OK != GNUNET_DISK_directory_create_for_file (fn));
#if WINDOWS
altlog_fd = OPEN (fn, O_APPEND |
O_BINARY |
@@ -386,16 +385,13 @@ setup_log_file (const struct tm *tm)
if (-1 == altlog_fd)
{
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "open", fn);
- if (dirwarn)
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Failed to create or access directory for log file `%s'\n"),
- fn);
return GNUNET_SYSERR;
}
GNUNET_stderr = altlog;
return GNUNET_OK;
}
+
/**
* Utility function - adds a parsed definition to logdefs array.
*
diff --git a/src/util/configuration.c b/src/util/configuration.c
index f61b43d573..3c75709816 100644
--- a/src/util/configuration.c
+++ b/src/util/configuration.c
@@ -25,7 +25,10 @@
*/
#include "platform.h"
-#include "gnunet_util_lib.h"
+#include "gnunet_crypto_lib.h"
+#include "gnunet_strings_lib.h"
+#include "gnunet_configuration_lib.h"
+#include "gnunet_disk_lib.h"
#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
diff --git a/src/util/container_heap.c b/src/util/container_heap.c
index 8c3de6c260..ad96af01d4 100644
--- a/src/util/container_heap.c
+++ b/src/util/container_heap.c
@@ -26,7 +26,7 @@
*/
#include "platform.h"
-#include "gnunet_util_lib.h"
+#include "gnunet_container_lib.h"
#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
diff --git a/src/util/container_meta_data.c b/src/util/container_meta_data.c
index 622b453349..5cef31f372 100644
--- a/src/util/container_meta_data.c
+++ b/src/util/container_meta_data.c
@@ -26,7 +26,9 @@
#include "platform.h"
#include "gnunet_util_lib.h"
+#if HAVE_EXTRACTOR_H
#include <extractor.h>
+#endif
#include <zlib.h>
#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
@@ -432,7 +434,8 @@ GNUNET_CONTAINER_meta_data_add_publication_date (struct
struct GNUNET_TIME_Absolute t;
t = GNUNET_TIME_absolute_get ();
- GNUNET_CONTAINER_meta_data_delete (md, EXTRACTOR_METATYPE_PUBLICATION_DATE,
+ GNUNET_CONTAINER_meta_data_delete (md,
+ EXTRACTOR_METATYPE_PUBLICATION_DATE,
NULL, 0);
dat = GNUNET_STRINGS_absolute_time_to_string (t);
GNUNET_CONTAINER_meta_data_insert (md, "<gnunet>",
@@ -481,8 +484,8 @@ GNUNET_CONTAINER_meta_data_iterate (const struct GNUNET_CONTAINER_MetaData *md,
* @return NULL if no entry was found
*/
char *
-GNUNET_CONTAINER_meta_data_get_by_type (const struct GNUNET_CONTAINER_MetaData
- *md, enum EXTRACTOR_MetaType type)
+GNUNET_CONTAINER_meta_data_get_by_type (const struct GNUNET_CONTAINER_MetaData *md,
+ enum EXTRACTOR_MetaType type)
{
struct MetaItem *pos;
diff --git a/src/util/container_multihashmap.c b/src/util/container_multihashmap.c
index df6dd5704a..46379b34ef 100644
--- a/src/util/container_multihashmap.c
+++ b/src/util/container_multihashmap.c
@@ -24,7 +24,7 @@
*/
#include "platform.h"
-#include "gnunet_util_lib.h"
+#include "gnunet_container_lib.h"
#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
diff --git a/src/util/container_multihashmap32.c b/src/util/container_multihashmap32.c
index 00dee18cd5..d7b8413c45 100644
--- a/src/util/container_multihashmap32.c
+++ b/src/util/container_multihashmap32.c
@@ -26,7 +26,7 @@
*/
#include "platform.h"
-#include "gnunet_util_lib.h"
+#include "gnunet_container_lib.h"
#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
diff --git a/src/util/crypto_crc.c b/src/util/crypto_crc.c
index 252cdad05d..5a83574780 100644
--- a/src/util/crypto_crc.c
+++ b/src/util/crypto_crc.c
@@ -28,7 +28,7 @@
* @author Christian Grothoff
*/
#include "platform.h"
-#include "gnunet_util_lib.h"
+#include "gnunet_crypto_lib.h"
#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
diff --git a/src/util/crypto_ecc.c b/src/util/crypto_ecc.c
index 87c7871858..adeaf77c83 100644
--- a/src/util/crypto_ecc.c
+++ b/src/util/crypto_ecc.c
@@ -25,7 +25,8 @@
*/
#include "platform.h"
#include <gcrypt.h>
-#include "gnunet_util_lib.h"
+#include "gnunet_crypto_lib.h"
+#include "gnunet_strings_lib.h"
#define EXTRA_CHECKS 0
diff --git a/src/util/crypto_hash.c b/src/util/crypto_hash.c
index e9f25bf842..8e5730ffd6 100644
--- a/src/util/crypto_hash.c
+++ b/src/util/crypto_hash.c
@@ -24,7 +24,8 @@
* @author Christian Grothoff
*/
#include "platform.h"
-#include "gnunet_util_lib.h"
+#include "gnunet_crypto_lib.h"
+#include "gnunet_strings_lib.h"
#include <gcrypt.h>
#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
diff --git a/src/util/crypto_mpi.c b/src/util/crypto_mpi.c
index 806a35da8b..ad64778fd4 100644
--- a/src/util/crypto_mpi.c
+++ b/src/util/crypto_mpi.c
@@ -26,7 +26,7 @@
*/
#include "platform.h"
#include <gcrypt.h>
-#include "gnunet_util_lib.h"
+#include "gnunet_crypto_lib.h"
#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
diff --git a/src/util/crypto_random.c b/src/util/crypto_random.c
index 2960af17ee..f9a0664e25 100644
--- a/src/util/crypto_random.c
+++ b/src/util/crypto_random.c
@@ -25,7 +25,7 @@
* @author Christian Grothoff
*/
#include "platform.h"
-#include "gnunet_util_lib.h"
+#include "gnunet_crypto_lib.h"
#include <gcrypt.h>
#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
diff --git a/src/util/crypto_rsa.c b/src/util/crypto_rsa.c
index 0b21b40b4d..b8e29146f0 100644
--- a/src/util/crypto_rsa.c
+++ b/src/util/crypto_rsa.c
@@ -22,7 +22,7 @@
*/
#include "platform.h"
#include <gcrypt.h>
-#include "gnunet_util_lib.h"
+#include "gnunet_crypto_lib.h"
#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
@@ -413,7 +413,7 @@ GNUNET_CRYPTO_rsa_blinding_key_create (unsigned int len)
/**
* Compare the values of two blinding keys.
- *
+ *
* @param b1 one key
* @param b2 the other key
* @return 0 if the two are equal
@@ -443,7 +443,7 @@ GNUNET_CRYPTO_rsa_signature_cmp (struct GNUNET_CRYPTO_rsa_Signature *s1,
size_t z1;
size_t z2;
int ret;
-
+
z1 = GNUNET_CRYPTO_rsa_signature_encode (s1,
&b1);
z2 = GNUNET_CRYPTO_rsa_signature_encode (s2,
@@ -476,7 +476,7 @@ GNUNET_CRYPTO_rsa_public_key_cmp (struct GNUNET_CRYPTO_rsa_PublicKey *p1,
size_t z1;
size_t z2;
int ret;
-
+
z1 = GNUNET_CRYPTO_rsa_public_key_encode (p1,
&b1);
z2 = GNUNET_CRYPTO_rsa_public_key_encode (p2,
diff --git a/src/util/crypto_symmetric.c b/src/util/crypto_symmetric.c
index 4551665463..6465d5eb67 100644
--- a/src/util/crypto_symmetric.c
+++ b/src/util/crypto_symmetric.c
@@ -26,7 +26,7 @@
*/
#include "platform.h"
-#include "gnunet_util_lib.h"
+#include "gnunet_crypto_lib.h"
#include <gcrypt.h>
#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
diff --git a/src/util/disk.c b/src/util/disk.c
index a56966d04f..c9f6408e81 100644
--- a/src/util/disk.c
+++ b/src/util/disk.c
@@ -24,8 +24,9 @@
* @author Nils Durner
*/
#include "platform.h"
-#include "gnunet_util_lib.h"
#include "disk.h"
+#include "gnunet_strings_lib.h"
+#include "gnunet_disk_lib.h"
#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
diff --git a/src/util/disk.h b/src/util/disk.h
index 1dfec216fc..2592bd8c0a 100644
--- a/src/util/disk.h
+++ b/src/util/disk.h
@@ -26,7 +26,8 @@
#ifndef GNUNET_DISK_H_
#define GNUNET_DISK_H_
-#include "gnunet_util_lib.h"
+#include "gnunet_crypto_lib.h"
+#include "gnunet_disk_lib.h"
/**
* Retrieve OS file handle
diff --git a/src/util/strings.c b/src/util/strings.c
index 379f3f5a38..407a135d1d 100644
--- a/src/util/strings.c
+++ b/src/util/strings.c
@@ -29,7 +29,8 @@
#if HAVE_ICONV
#include <iconv.h>
#endif
-#include "gnunet_util_lib.h"
+#include "gnunet_crypto_lib.h"
+#include "gnunet_strings_lib.h"
#include <unicase.h>
#include <unistr.h>
#include <uniconv.h>
diff --git a/src/util/test_container_meta_data.c b/src/util/test_container_meta_data.c
index a3729fc9f1..df6587efdb 100644
--- a/src/util/test_container_meta_data.c
+++ b/src/util/test_container_meta_data.c
@@ -27,6 +27,8 @@
#include "platform.h"
#include "gnunet_util_lib.h"
+#if HAVE_EXTRACTOR_H
+
#define ABORT(m) { fprintf(stderr, "Error at %s:%d\n", __FILE__, __LINE__); if (m != NULL) GNUNET_CONTAINER_meta_data_destroy(m); return 1; }
static int
@@ -343,4 +345,16 @@ main (int argc, char *argv[])
return 0;
}
+#else
+
+int
+main (int argc, char *argv[])
+{
+ fprintf (stderr,
+ "GNU libextractor not found, skipping test.\n");
+ return 0;
+}
+
+#endif
+
/* end of test_container_meta_data.c */
diff --git a/src/util/time.c b/src/util/time.c
index 01a3cddd5a..78dd4c6d24 100644
--- a/src/util/time.c
+++ b/src/util/time.c
@@ -24,7 +24,8 @@
* @brief functions for handling time and time arithmetic
*/
#include "platform.h"
-#include "gnunet_util_lib.h"
+#include "gnunet_crypto_lib.h"
+#include "gnunet_time_lib.h"
#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)