gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r21552 - gnunet/src/testing


From: gnunet
Subject: [GNUnet-SVN] r21552 - gnunet/src/testing
Date: Sun, 20 May 2012 17:06:15 +0200

Author: harsha
Date: 2012-05-20 17:06:15 +0200 (Sun, 20 May 2012)
New Revision: 21552

Modified:
   gnunet/src/testing/testing_new.c
Log:
testing system

Modified: gnunet/src/testing/testing_new.c
===================================================================
--- gnunet/src/testing/testing_new.c    2012-05-20 14:44:07 UTC (rev 21551)
+++ gnunet/src/testing/testing_new.c    2012-05-20 15:06:15 UTC (rev 21552)
@@ -30,6 +30,7 @@
  *
  */
 #include "platform.h"
+#include "gnunet_disk_lib.h"
 #include "gnunet_testing_lib-new.h"
 
 
@@ -46,6 +47,11 @@
   char *tmppath;
 
   /**
+   * The hostname of the controller
+   */
+  char *controller;
+
+  /**
    * Bitmap where each TCP port that has already been reserved for
    * some GNUnet peer is recorded.  Note that we additionally need to
    * test if a port is already in use by non-GNUnet components before
@@ -76,6 +82,11 @@
    * we never re-use path counters.
    */
   uint32_t path_counter;
+
+  /**
+   * Last used port number
+   */
+  
 };
 
 
@@ -108,6 +119,23 @@
 
 
 /**
+ * Lowest port used for GNUnet testing.  Should be high enough to not
+ * conflict with other applications running on the hosts but be low
+ * enough to not conflict with client-ports (typically starting around
+ * 32k).
+ */
+#define LOW_PORT 12000
+
+
+/**
+ * Highest port used for GNUnet testing.  Should be low enough to not
+ * conflict with the port range for "local" ports (client apps; see
+ * /proc/sys/net/ipv4/ip_local_port_range on Linux for example).
+ */
+#define HIGH_PORT 56000
+
+
+/**
  * Create a system handle.  There must only be one system
  * handle per operating system.
  *
@@ -121,8 +149,15 @@
 GNUNET_TESTING_system_create (const char *tmppath,
                              const char *controller)
 {
-  GNUNET_break (0);
-  return NULL;
+  struct GNUNET_TESTING_System *system;
+
+  if (NULL == tmppath)
+    return NULL;
+  system = GNUNET_malloc (sizeof (struct GNUNET_TESTING_System));
+  system->tmppath = GNUNET_strdup (tmppath);
+  if (NULL != controller)
+    system->controller = GNUNET_strdup (controller);
+  return system;
 }
 
 
@@ -137,7 +172,12 @@
 GNUNET_TESTING_system_destroy (struct GNUNET_TESTING_System *system,
                               int remove_paths)
 {
-  GNUNET_break (0);
+  GNUNET_assert (NULL != system);
+  if (GNUNET_YES == remove_paths)
+    GNUNET_DISK_directory_remove (system->tmppath);
+  GNUNET_free (system->tmppath);
+  GNUNET_free_non_null (system->controller);
+  GNUNET_free (system);
 }
 
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]