From 57c1d2318f14c4b5c21609cb96f32517d02752e7 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 25 Jan 2016 14:57:32 +0100 Subject: getting aggregator structure laid out for #4141 --- src/wire/Makefile.am | 13 ++++++++++ src/wire/test_sepa_wireformat.c | 53 ++++------------------------------------- 2 files changed, 17 insertions(+), 49 deletions(-) (limited to 'src/wire') diff --git a/src/wire/Makefile.am b/src/wire/Makefile.am index 528d91014..fb6f25616 100644 --- a/src/wire/Makefile.am +++ b/src/wire/Makefile.am @@ -15,6 +15,9 @@ plugin_LTLIBRARIES = \ noinst_LTLIBRARIES = \ libtaler_plugin_wire_template.la +lib_LTLIBRARIES = \ + libtalerwire.la + libtaler_plugin_wire_test_la_SOURCES = \ plugin_wire_test.c @@ -47,6 +50,15 @@ libtaler_plugin_wire_template_la_LDFLAGS = \ -lgnunetutil $(XLIB) +libtalerwire_la_SOURCES = \ + wire.c +libtalerwire_la_LIBADD = \ + -lgnunetutil + $(XLIB) +libtalerwire_la_LDFLAGS = \ + -version-info 0:0:0 \ + -export-dynamic -no-undefined + TESTS = \ test_sepa_wireformat @@ -61,4 +73,5 @@ test_sepa_wireformat_SOURCES = \ test_sepa_wireformat_LDADD = \ -lgnunetutil \ -ljansson \ + libtalerwire.la \ $(top_builddir)/src/util/libtalerutil.la diff --git a/src/wire/test_sepa_wireformat.c b/src/wire/test_sepa_wireformat.c index 958aac260..edbe5bc45 100644 --- a/src/wire/test_sepa_wireformat.c +++ b/src/wire/test_sepa_wireformat.c @@ -22,7 +22,7 @@ #include "platform.h" #include "taler_util.h" -#include "taler_wire_plugin.h" +#include "taler_wire_lib.h" /* Valid SEPA data */ @@ -62,51 +62,6 @@ static const char * const unsupported_wire_str = \"address\": \"foobar\"}"; -/** - * Initialize the plugin. - * - * @param cfg configuration to use - * @return #GNUNET_OK on success - */ -static struct TALER_WIRE_Plugin * -wire_plugin_load (const struct GNUNET_CONFIGURATION_Handle *cfg, - const char *plugin_name) -{ - char *lib_name; - struct TALER_WIRE_Plugin *plugin; - - (void) GNUNET_asprintf (&lib_name, - "libtaler_plugin_wire_%s", - plugin_name); - plugin = GNUNET_PLUGIN_load (lib_name, - (void *) cfg); - if (NULL != plugin) - plugin->library_name = lib_name; - else - GNUNET_free (lib_name); - return plugin; -} - - -/** - * Shutdown the plugin. - * - * @param plugin the plugin to unload - */ -static void -wire_plugin_unload (struct TALER_WIRE_Plugin *plugin) -{ - char *lib_name; - - if (NULL == plugin) - return; - lib_name = plugin->library_name; - GNUNET_assert (NULL == GNUNET_PLUGIN_unload (lib_name, - plugin)); - GNUNET_free (lib_name); -} - - int main(int argc, const char *const argv[]) @@ -125,8 +80,8 @@ main(int argc, "mint", "currency", "EUR"); - plugin = wire_plugin_load (cfg, - "sepa"); + plugin = TALER_WIRE_plugin_load (cfg, + "sepa"); GNUNET_assert (NULL != plugin); (void) memset(&error, 0, sizeof(error)); GNUNET_assert (NULL != (wire = json_loads (unsupported_wire_str, 0, NULL))); @@ -141,7 +96,7 @@ main(int argc, GNUNET_assert (NULL != (wire = json_loads (valid_wire_str, 0, &error))); ret = plugin->wire_validate (wire); json_decref (wire); - wire_plugin_unload (plugin); + TALER_WIRE_plugin_unload (plugin); GNUNET_CONFIGURATION_destroy (cfg); if (GNUNET_NO == ret) return 1; -- cgit v1.2.3