guix-env: some update.
[oweals/gnunet.git] / src / testbed / gnunet-daemon-testbed-underlay.c
index ce0cc46d9747632561174605a8fb53c1129bb820..0b6c44710a89751c5b76e37f0e48530827a21217 100644 (file)
@@ -29,6 +29,7 @@
 #include "platform.h"
 #include "gnunet_util_lib.h"
 #include "gnunet_transport_service.h"
+#include "gnunet_transport_manipulation_service.h"
 #include "gnunet_ats_service.h"
 #include "gnunet_testing_lib.h"
 #include <sqlite3.h>
@@ -74,7 +75,7 @@ static struct sqlite3 *db;
  * The blacklist handle we obtain from transport when we register ourselves for
  * access control
  */
-struct GNUNET_TRANSPORT_Blacklist *bh;
+static struct GNUNET_TRANSPORT_Blacklist *bh;
 
 /**
  * The hostkeys file
@@ -94,18 +95,13 @@ static void *hostkeys_data;
 /**
  * Handle to the transport service.  This is used for setting link metrics
  */
-static struct GNUNET_TRANSPORT_Handle *transport;
+static struct GNUNET_TRANSPORT_ManipulationHandle *transport;
 
 /**
  * The number of hostkeys in the hostkeys array
  */
 static unsigned int num_hostkeys;
 
-/**
- * Task for shutdown
- */
-static struct GNUNET_SCHEDULER_Task * shutdown_task;
-
 
 /**
  * @ingroup hashmap
@@ -175,7 +171,7 @@ get_identity (unsigned int offset, struct GNUNET_PeerIdentity *id)
 
   if (offset >= num_hostkeys)
     return GNUNET_SYSERR;
-  (void) memcpy (&private_key,
+  GNUNET_memcpy (&private_key,
                  hostkeys_data + (offset * GNUNET_TESTING_HOSTKEYFILESIZE),
                  GNUNET_TESTING_HOSTKEYFILESIZE);
   GNUNET_CRYPTO_eddsa_key_get_public (&private_key, &id->public_key);
@@ -292,7 +288,7 @@ do_shutdown (void *cls)
 {
   if (NULL != transport)
   {
-    GNUNET_TRANSPORT_disconnect (transport);
+    GNUNET_TRANSPORT_manipulation_disconnect (transport);
     transport = NULL;
   }
   cleanup_map ();
@@ -403,7 +399,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   if (GNUNET_OK != load_keys (c))
       goto close_db;
 
-  transport = GNUNET_TRANSPORT_connect (c, NULL, NULL, NULL, NULL, NULL);
+  transport = GNUNET_TRANSPORT_manipulation_connect (c);
   if (NULL == transport)
   {
     GNUNET_break (0);
@@ -415,7 +411,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   nrows = db_read_whitelist (db, pid, &wl_head);
   if ((GNUNET_SYSERR == nrows) || (0 == nrows))
   {
-    GNUNET_TRANSPORT_disconnect (transport);
+    GNUNET_TRANSPORT_manipulation_disconnect (transport);
     goto close_db;
   }
   map = GNUNET_CONTAINER_multipeermap_create (nrows, GNUNET_NO);
@@ -431,20 +427,18 @@ run (void *cls, char *const *args, const char *cfgfile,
     DEBUG ("Setting %u ms latency to peer `%s'\n",
            wl_entry->latency,
            GNUNET_i2s (&identity));
-    GNUNET_TRANSPORT_set_traffic_metric (transport,
-                                         &identity,
-                                         &prop,
-                                         delay,
-                                         delay);
+    GNUNET_TRANSPORT_manipulation_set (transport,
+                                      &identity,
+                                      &prop,
+                                      delay,
+                                      delay);
     GNUNET_free (wl_entry);
   }
   bh = GNUNET_TRANSPORT_blacklist (c, &check_access, NULL);
-  shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
-                                                &do_shutdown, NULL);
+  GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL);
 
  close_db:
   GNUNET_break (SQLITE_OK == sqlite3_close (db));
-  return;
 }