multicast,psyc,social: remove core dependencny
authorGabor X Toth <*@tg-x.net>
Fri, 23 Sep 2016 14:26:55 +0000 (14:26 +0000)
committerGabor X Toth <*@tg-x.net>
Fri, 23 Sep 2016 14:26:55 +0000 (14:26 +0000)
src/multicast/Makefile.am
src/multicast/gnunet-service-multicast.c
src/multicast/test_multicast.c
src/multicast/test_multicast_multipeer.c
src/psyc/Makefile.am
src/psyc/test_psyc.c
src/social/Makefile.am
src/social/gnunet-service-social.c
src/social/gnunet-social.c
src/social/test_social.c

index 64c0bfe1d304a676b7d5aab237a571c37b65268e..b1f422765322eb8684c07cd664a5b4e28d887d3f 100644 (file)
@@ -45,7 +45,6 @@ gnunet_service_multicast_SOURCES = \
  gnunet-service-multicast.c
 gnunet_service_multicast_LDADD = \
   $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/core/libgnunetcore.la \
   $(top_builddir)/src/cadet/libgnunetcadet.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(GN_LIBINTL)
@@ -65,13 +64,11 @@ test_multicast_SOURCES = \
 test_multicast_LDADD = \
   libgnunetmulticast.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/core/libgnunetcore.la
+  $(top_builddir)/src/util/libgnunetutil.la
 
 test_multicast_multipeer_SOURCE = \
  test_multicast_multipeer.c
 test_multicast_multipeer_LDADD = \
   libgnunetmulticast.la \
   $(top_builddir)/src/testbed/libgnunettestbed.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/core/libgnunetcore.la
+  $(top_builddir)/src/util/libgnunetutil.la
index af530e27a696771f0515627aa8bb83f6368bff92..5f8b1cdb61fd36ce9e988bea0b4ceed9beecdabc 100644 (file)
@@ -28,7 +28,6 @@
 #include "gnunet_signatures.h"
 #include "gnunet_applications.h"
 #include "gnunet_statistics_service.h"
-#include "gnunet_core_service.h"
 #include "gnunet_cadet_service.h"
 #include "gnunet_multicast_service.h"
 #include "multicast.h"
@@ -43,12 +42,6 @@ static const struct GNUNET_CONFIGURATION_Handle *cfg;
  */
 static struct GNUNET_SERVER_Handle *server;
 
-/**
- * Core handle.
- * Only used during initialization.
- */
-static struct GNUNET_CORE_Handle *core;
-
 /**
  * CADET handle.
  */
@@ -341,11 +334,6 @@ struct ReplayRequestKey
 static void
 shutdown_task (void *cls)
 {
-  if (NULL != core)
-  {
-    GNUNET_CORE_disconnecT (core);
-    core = NULL;
-  }
   if (NULL != cadet)
   {
     GNUNET_CADET_disconnect (cadet);
@@ -1846,12 +1834,21 @@ static const struct GNUNET_CADET_MessageHandler cadet_handlers[] = {
 
 
 /**
- * Connected to core service.
+ * Service started.
+ *
+ * @param cls closure
+ * @param server the initialized server
+ * @param cfg configuration to use
  */
 static void
-core_connected_cb  (void *cls, const struct GNUNET_PeerIdentity *my_identity)
+run (void *cls,
+     struct GNUNET_SERVER_Handle *srv,
+     const struct GNUNET_CONFIGURATION_Handle *c)
 {
-  this_peer = *my_identity;
+  cfg = c;
+  server = srv;
+  GNUNET_SERVER_connect_notify (server, &client_notify_connect, NULL);
+  GNUNET_CRYPTO_get_peer_identity (cfg, &this_peer);
 
   stats = GNUNET_STATISTICS_create ("multicast", cfg);
   origins = GNUNET_CONTAINER_multihashmap_create (1, GNUNET_YES);
@@ -1876,25 +1873,6 @@ core_connected_cb  (void *cls, const struct GNUNET_PeerIdentity *my_identity)
 }
 
 
-/**
- * Service started.
- *
- * @param cls closure
- * @param server the initialized server
- * @param cfg configuration to use
- */
-static void
-run (void *cls,
-     struct GNUNET_SERVER_Handle *srv,
-     const struct GNUNET_CONFIGURATION_Handle *c)
-{
-  cfg = c;
-  server = srv;
-  GNUNET_SERVER_connect_notify (server, &client_notify_connect, NULL);
-  core = GNUNET_CORE_connecT (cfg, NULL, &core_connected_cb, NULL, NULL, NULL);
-}
-
-
 /**
  * The main function for the multicast service.
  *
index 44c62f677b169013c89cfa31c022334498aa95a0..1e3a4922b807f83d8c18ab05da2247e3eddd32ec 100644 (file)
@@ -31,7 +31,6 @@
 #include "gnunet_common.h"
 #include "gnunet_util_lib.h"
 #include "gnunet_testing_lib.h"
-#include "gnunet_core_service.h"
 #include "gnunet_multicast_service.h"
 
 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
@@ -48,7 +47,6 @@ static struct GNUNET_SCHEDULER_Task * end_badly_task;
 
 static const struct GNUNET_CONFIGURATION_Handle *cfg;
 
-struct GNUNET_CORE_Handle *core;
 struct GNUNET_PeerIdentity this_peer;
 
 struct GNUNET_MULTICAST_Origin *origin;
@@ -110,11 +108,6 @@ member_join (int t);
 static void
 cleanup ()
 {
-  if (NULL != core)
-  {
-    GNUNET_CORE_disconnecT (core);
-    core = NULL;
-  }
   if (NULL != member)
   {
     GNUNET_MULTICAST_member_part (member, NULL, NULL);
@@ -705,16 +698,6 @@ origin_start ()
 }
 
 
-static void
-core_connected (void *cls, const struct GNUNET_PeerIdentity *my_identity)
-{
-  this_peer = *my_identity;
-
-  // Test 1 starts here
-  origin_start ();
-}
-
-
 /**
  * Main function of the test, run from scheduler.
  *
@@ -737,8 +720,10 @@ run (void *cls,
   cfg = c;
   end_badly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
                                                 &end_badly, NULL);
-  core = GNUNET_CORE_connecT (cfg, NULL,
-                             &core_connected, NULL, NULL, NULL);
+  GNUNET_CRYPTO_get_peer_identity (cfg, &this_peer);
+
+  // Test 1 starts here
+  origin_start ();
 }
 
 
index 2e8b9818d0931a77b53f23054e17c41ef4e6cb1f..3edf0153e800425cfdb33221e98cb4d8ccc65350 100644 (file)
@@ -31,7 +31,6 @@
 #include "gnunet_common.h"
 #include "gnunet_util_lib.h"
 #include "gnunet_testbed_service.h"
-#include "gnunet_core_service.h"
 #include "gnunet_multicast_service.h"
 
 #define NUM_PEERS 2
index e00537e733cbbce5385090efa2d72bdc9cbdf2d7..0016b1b3bd6daab7cd1a72d85f633f7bffe9cb1c 100644 (file)
@@ -63,7 +63,6 @@ test_psyc_LDADD = \
   libgnunetpsyc.la \
   $(top_builddir)/src/psycutil/libgnunetpsycutil.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/core/libgnunetcore.la \
   $(top_builddir)/src/util/libgnunetutil.la
 
 EXTRA_DIST = \
index d1846b8cc561dfa27abf7110a1ae0310220f22bc..03a1890b1fa160256b24967f4545170ce2288351 100644 (file)
@@ -34,7 +34,6 @@
 #include "gnunet_testing_lib.h"
 #include "gnunet_psyc_util_lib.h"
 #include "gnunet_psyc_service.h"
-#include "gnunet_core_service.h"
 
 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
 
@@ -45,7 +44,6 @@ static int res;
 
 static const struct GNUNET_CONFIGURATION_Handle *cfg;
 
-static struct GNUNET_CORE_Handle *core;
 static struct GNUNET_PeerIdentity this_peer;
 
 /**
@@ -143,11 +141,6 @@ slave_parted (void *cls)
 static void
 cleanup ()
 {
-  if (NULL != core)
-  {
-    GNUNET_CORE_disconnecT (core);
-    core = NULL;
-  }
   if (NULL != slv)
   {
     GNUNET_PSYC_slave_part (slv, GNUNET_NO, &slave_parted, NULL);
@@ -951,21 +944,6 @@ schedule_master_start (void *cls)
 }
 
 
-static void
-core_connected (void *cls, const struct GNUNET_PeerIdentity *my_identity)
-{
-  this_peer = *my_identity;
-
-#if DEBUG_TEST_PSYC
-  master_start ();
-#else
-  /* Allow some time for the services to initialize. */
-  GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
-                                &schedule_master_start, NULL);
-#endif
-
-}
-
 /**
  * Main function of the test, run from scheduler.
  *
@@ -986,13 +964,21 @@ run (void *cls,
   cfg = c;
   end_badly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL);
 
+  GNUNET_CRYPTO_get_peer_identity (cfg, &this_peer);
+
   channel_key = GNUNET_CRYPTO_eddsa_key_create ();
   slave_key = GNUNET_CRYPTO_ecdsa_key_create ();
 
   GNUNET_CRYPTO_eddsa_key_get_public (channel_key, &channel_pub_key);
   GNUNET_CRYPTO_ecdsa_key_get_public (slave_key, &slave_pub_key);
 
-  core = GNUNET_CORE_connecT (cfg, NULL, &core_connected, NULL, NULL, NULL);
+#if DEBUG_TEST_PSYC
+  master_start ();
+#else
+  /* Allow some time for the services to initialize. */
+  GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
+                                &schedule_master_start, NULL);
+#endif
 }
 
 
index fb761dcae1ff2479cefbe723242aaca8658a1161..693a61411d982138bcc5dcc4d47f33c33b05b848 100644 (file)
@@ -41,7 +41,6 @@ gnunet_social_SOURCES = \
 gnunet_social_LDADD = \
   libgnunetsocial.la \
   $(top_builddir)/src/psycutil/libgnunetpsycutil.la \
-  $(top_builddir)/src/core/libgnunetcore.la \
   $(top_builddir)/src/util/libgnunetutil.la
 
 gnunet_service_social_SOURCES = \
@@ -51,7 +50,6 @@ gnunet_service_social_LDADD = \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(top_builddir)/src/psycutil/libgnunetpsycutil.la \
   $(top_builddir)/src/psyc/libgnunetpsyc.la \
-  $(top_builddir)/src/core/libgnunetcore.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   $(top_builddir)/src/gns/libgnunetgns.la \
   $(top_builddir)/src/namestore/libgnunetnamestore.la \
@@ -75,7 +73,6 @@ test_social_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/util/libgnunetutil.la \
   $(top_builddir)/src/psycutil/libgnunetpsycutil.la \
-  $(top_builddir)/src/core/libgnunetcore.la \
   $(top_builddir)/src/identity/libgnunetidentity.la
 
 EXTRA_DIST = \
index 01a624e2af5351d7578f5c163cbd2123d89ec08a..681d469bcb4af5db9c0908f5c106867916ea3b4c 100644 (file)
@@ -31,7 +31,6 @@
 #include "gnunet_util_lib.h"
 #include "gnunet_constants.h"
 #include "gnunet_protocols.h"
-#include "gnunet_core_service.h"
 #include "gnunet_identity_service.h"
 #include "gnunet_namestore_service.h"
 #include "gnunet_gns_service.h"
@@ -48,7 +47,6 @@
 static const struct GNUNET_CONFIGURATION_Handle *cfg;
 
 /* Handles to other services */
-static struct GNUNET_CORE_Handle *core;
 static struct GNUNET_IDENTITY_Handle *id;
 static struct GNUNET_GNS_Handle *gns;
 static struct GNUNET_NAMESTORE_Handle *namestore;
@@ -454,11 +452,6 @@ shutdown_task (void *cls)
     GNUNET_SERVER_notification_context_destroy (nc);
     nc = NULL;
   }
-  if (NULL != core)
-  {
-    GNUNET_CORE_disconnecT (core);
-    core = NULL;
-  }
   if (NULL != id)
   {
     GNUNET_IDENTITY_disconnect (id);
@@ -3467,16 +3460,6 @@ identity_recv_ego (void *cls, struct GNUNET_IDENTITY_Ego *id_ego,
 }
 
 
-/**
- * Connected to core service.
- */
-static void
-core_connected (void *cls, const struct GNUNET_PeerIdentity *my_identity)
-{
-  this_peer = *my_identity;
-}
-
-
 /**
  * Initialize the PSYC service.
  *
@@ -3489,6 +3472,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
      const struct GNUNET_CONFIGURATION_Handle *c)
 {
   cfg = c;
+  GNUNET_CRYPTO_get_peer_identity (cfg, &this_peer);
 
   hosts = GNUNET_CONTAINER_multihashmap_create (1, GNUNET_YES);
   guests = GNUNET_CONTAINER_multihashmap_create (1, GNUNET_YES);
@@ -3500,7 +3484,6 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
   apps_places = GNUNET_CONTAINER_multihashmap_create(1, GNUNET_NO);
   places_apps = GNUNET_CONTAINER_multihashmap_create(1, GNUNET_NO);
 
-  core = GNUNET_CORE_connecT (cfg, NULL, core_connected, NULL, NULL, NULL);
   id = GNUNET_IDENTITY_connect (cfg, &identity_recv_ego, NULL);
   gns = GNUNET_GNS_connect (cfg);
   namestore = GNUNET_NAMESTORE_connect (cfg);
index 98a48c2941c2b2114acde2cef4e4bff3976b3135..afd06028c1a92ab27487dd563a20da12eb0794e8 100644 (file)
@@ -29,7 +29,6 @@
 #include "platform.h"
 #include "gnunet_util_lib.h"
 #include "gnunet_social_service.h"
-#include "gnunet_core_service.h"
 
 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
 
@@ -139,7 +138,6 @@ struct GNUNET_SCHEDULER_Task *timeout_task;
 
 const struct GNUNET_CONFIGURATION_Handle *cfg;
 
-struct GNUNET_CORE_Handle *core;
 struct GNUNET_PeerIdentity peer, this_peer;
 
 struct GNUNET_SOCIAL_App *app;
@@ -1086,9 +1084,6 @@ app_recv_ego (void *cls,
 static void
 app_connect (void *cls)
 {
-  GNUNET_CORE_disconnecT (core);
-  core = NULL;
-
   app = GNUNET_SOCIAL_app_connect (cfg, opt_app,
                                    app_recv_ego,
                                    app_recv_host,
@@ -1098,20 +1093,6 @@ app_connect (void *cls)
 }
 
 
-/* CORE */
-
-
-static void
-core_connected (void *cls, const struct GNUNET_PeerIdentity *my_identity)
-{
-  this_peer = *my_identity;
-  GNUNET_SCHEDULER_add_now (app_connect, NULL);
-}
-
-
-/* RUN */
-
-
 /**
  * Main function run by the scheduler.
  *
@@ -1125,6 +1106,7 @@ run (void *cls, char *const *args, const char *cfgfile,
      const struct GNUNET_CONFIGURATION_Handle *c)
 {
   cfg = c;
+  GNUNET_CRYPTO_get_peer_identity (cfg, &this_peer);
 
   if (!opt_method)
     opt_method = "message";
@@ -1181,7 +1163,7 @@ run (void *cls, char *const *args, const char *cfgfile,
     }
   }
 
-  core = GNUNET_CORE_connecT (cfg, NULL, &core_connected, NULL, NULL, NULL);
+  GNUNET_SCHEDULER_add_now (app_connect, NULL);
 }
 
 
index 4960b8820ab6a3d724e0a8455f792ebab860061f..0dc2a9d302cc963eb4850d7721a0624c059b95e8 100644 (file)
@@ -32,7 +32,6 @@
 #include "gnunet_testing_lib.h"
 #include "gnunet_psyc_util_lib.h"
 #include "gnunet_social_service.h"
-#include "gnunet_core_service.h"
 #include "gnunet_identity_service.h"
 
 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
@@ -54,7 +53,6 @@ struct GNUNET_SCHEDULER_Task *end_badly_task;
 
 const struct GNUNET_CONFIGURATION_Handle *cfg;
 
-struct GNUNET_CORE_Handle *core;
 struct GNUNET_PeerIdentity this_peer;
 
 struct GNUNET_IDENTITY_Handle *id;
@@ -185,12 +183,6 @@ host_announce2 ();
 static void
 cleanup ()
 {
-  if (NULL != core)
-  {
-    GNUNET_CORE_disconnecT (core);
-    core = NULL;
-  }
-
   if (NULL != id)
   {
     GNUNET_IDENTITY_disconnect (id);
@@ -406,11 +398,6 @@ app_connected (void *cls)
 {
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Test #%u: App connected: %p\n", test, cls);
-  if (NULL != core)
-  {
-    GNUNET_CORE_disconnecT (core);
-    core = NULL;
-  }
 }
 
 
@@ -1314,17 +1301,6 @@ identity_ego_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego,
 }
 
 
-static void
-core_connected (void *cls, const struct GNUNET_PeerIdentity *my_identity)
-{
-  this_peer = *my_identity;
-  id = GNUNET_IDENTITY_connect (cfg, &identity_ego_cb, NULL);
-
-  test = TEST_HOST_CREATE;
-  GNUNET_IDENTITY_create (id, host_name, &id_host_created, NULL);
-}
-
-
 /**
  * Main function of the test, run from scheduler.
  *
@@ -1346,7 +1322,12 @@ run (void *cls,
   end_badly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
                                                 &end_badly, NULL);
 
-  core = GNUNET_CORE_connecT (cfg, NULL, &core_connected, NULL, NULL, NULL);
+  GNUNET_CRYPTO_get_peer_identity (cfg, &this_peer);
+
+  id = GNUNET_IDENTITY_connect (cfg, &identity_ego_cb, NULL);
+
+  test = TEST_HOST_CREATE;
+  GNUNET_IDENTITY_create (id, host_name, &id_host_created, NULL);
 }