gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r25519 - in gnunet/src: include testbed testing


From: gnunet
Subject: [GNUnet-SVN] r25519 - in gnunet/src: include testbed testing
Date: Mon, 17 Dec 2012 17:02:32 +0100

Author: harsha
Date: 2012-12-17 17:02:32 +0100 (Mon, 17 Dec 2012)
New Revision: 25519

Modified:
   gnunet/src/include/gnunet_testbed_service.h
   gnunet/src/include/gnunet_testing_lib-new.h
   gnunet/src/testbed/gnunet-helper-testbed.c
   gnunet/src/testbed/testbed_api.c
   gnunet/src/testbed/testbed_helper.h
   gnunet/src/testing/testing.c
Log:
- rename controller_ip to trusted_ip

Modified: gnunet/src/include/gnunet_testbed_service.h
===================================================================
--- gnunet/src/include/gnunet_testbed_service.h 2012-12-17 15:09:25 UTC (rev 
25518)
+++ gnunet/src/include/gnunet_testbed_service.h 2012-12-17 16:02:32 UTC (rev 
25519)
@@ -439,8 +439,10 @@
 /**
  * Starts a controller process at the host.
  *
- * @param controller_ip the ip address of the controller. Will be set as 
TRUSTED
- *          host when starting testbed controller at host
+ * @param trusted_ip the ip address of the controller which will be set as 
TRUSTED
+ *          HOST(all connections form this ip are permitted by the testbed) 
when
+ *          starting testbed controller at host. This can either be a single ip
+ *          address or a network address in CIDR notation.
  * @param host the host where the controller has to be started; NULL for
  *          localhost
  * @param cfg template configuration to use for the remote controller; the
@@ -457,7 +459,7 @@
  * @return the controller process handle, NULL on errors
  */
 struct GNUNET_TESTBED_ControllerProc *
-GNUNET_TESTBED_controller_start (const char *controller_ip,
+GNUNET_TESTBED_controller_start (const char *trusted_ip,
                                  struct GNUNET_TESTBED_Host *host,
                                  const struct GNUNET_CONFIGURATION_Handle *cfg,
                                  GNUNET_TESTBED_ControllerStatusCallback cb,

Modified: gnunet/src/include/gnunet_testing_lib-new.h
===================================================================
--- gnunet/src/include/gnunet_testing_lib-new.h 2012-12-17 15:09:25 UTC (rev 
25518)
+++ gnunet/src/include/gnunet_testing_lib-new.h 2012-12-17 16:02:32 UTC (rev 
25519)
@@ -67,15 +67,17 @@
  * @param testdir only the directory name without any path. This is used for 
all
  *          service homes; the directory will be created in a temporary 
location
  *          depending on the underlying OS
- * @param controller hostname of the controlling host, service configurations
- *        are modified to allow control connections from this host; can be NULL
+ * @param trusted_ip the ip address which will be set as TRUSTED HOST in all
+ *          service configurations generated to allow control connections from
+ *          this ip. This can either be a single ip address or a network 
address
+ *          in CIDR notation.
  * @param hostname the hostname of the system we are using for testing; NULL 
for
  *          localhost
  * @return handle to this system, NULL on error
  */
 struct GNUNET_TESTING_System *
 GNUNET_TESTING_system_create (const char *testdir,
-                             const char *controller,
+                             const char *trusted_ip,
                              const char *hostname);
 
 
@@ -89,6 +91,10 @@
  * @param testdir only the directory name without any path. This is used for
  *          all service homes; the directory will be created in a temporary
  *          location depending on the underlying OS
+ * @param trusted_ip the ip address which will be set as TRUSTED HOST in all
+ *          service configurations generated to allow control connections from
+ *          this ip. This can either be a single ip address or a network 
address
+ *          in CIDR notation.
  * @param controller hostname of the controlling host, 
  *        service configurations are modified to allow 
  *        control connections from this host; can be NULL
@@ -100,7 +106,7 @@
  */
 struct GNUNET_TESTING_System *
 GNUNET_TESTING_system_create_with_portrange (const char *testdir,
-                                            const char *controller,
+                                            const char *trusted_ip,
                                             const char *hostname,
                                             uint16_t lowport,
                                             uint16_t highport);

Modified: gnunet/src/testbed/gnunet-helper-testbed.c
===================================================================
--- gnunet/src/testbed/gnunet-helper-testbed.c  2012-12-17 15:09:25 UTC (rev 
25518)
+++ gnunet/src/testbed/gnunet-helper-testbed.c  2012-12-17 16:02:32 UTC (rev 
25519)
@@ -242,14 +242,14 @@
   struct GNUNET_CONFIGURATION_Handle *cfg;
   struct WriteContext *wc;
   char *binary;
-  char *controller;
+  char *trusted_ip;
   char *hostname;
   char *config;
   char *xconfig;
   size_t config_size;
   uLongf ul_config_size;
   size_t xconfig_size;
-  uint16_t cname_size;
+  uint16_t trusted_ip_size;
   uint16_t hostname_size;
   uint16_t msize;
   
@@ -261,16 +261,16 @@
     goto error;
   }
   msg = (const struct GNUNET_TESTBED_HelperInit *) message;
-  cname_size = ntohs (msg->cname_size);
-  controller = (char *) &msg[1];
-  if ('\0' != controller[cname_size])
+  trusted_ip_size = ntohs (msg->trusted_ip_size);
+  trusted_ip = (char *) &msg[1];
+  if ('\0' != trusted_ip[trusted_ip_size])
   {
     LOG (GNUNET_ERROR_TYPE_WARNING,
-         "Controller name cannot be empty -- exiting\n");
+         "Trusted IP cannot be empty -- exiting\n");
     goto error;
   }
   hostname_size = ntohs (msg->hostname_size);
-  if ((sizeof (struct GNUNET_TESTBED_HelperInit) + cname_size + 1 +
+  if ((sizeof (struct GNUNET_TESTBED_HelperInit) + trusted_ip_size + 1 +
        hostname_size) >= msize)
   {
     GNUNET_break (0);
@@ -280,11 +280,11 @@
   ul_config_size = (uLongf) ntohs (msg->config_size);
   config = GNUNET_malloc (ul_config_size);
   xconfig_size =
-      ntohs (message->size) - (cname_size + 1 +
+      ntohs (message->size) - (trusted_ip_size + 1 +
                                sizeof (struct GNUNET_TESTBED_HelperInit));
   if (Z_OK !=
       uncompress ((Bytef *) config, &ul_config_size,
-                  (const Bytef *) (controller + cname_size + 1 + 
hostname_size),
+                  (const Bytef *) (trusted_ip + trusted_ip_size + 1 + 
hostname_size),
                   (uLongf) xconfig_size))
   {
     LOG (GNUNET_ERROR_TYPE_WARNING,
@@ -306,10 +306,10 @@
   if (0 != hostname_size)
   {
     hostname = GNUNET_malloc (hostname_size + 1);
-    (void) strncpy (hostname, ((char *) &msg[1]) + cname_size + 1, 
hostname_size);
+    (void) strncpy (hostname, ((char *) &msg[1]) + trusted_ip_size + 1, 
hostname_size);
     hostname[hostname_size] = '\0';
   }
-  test_system = GNUNET_TESTING_system_create ("testbed-helper", controller,
+  test_system = GNUNET_TESTING_system_create ("testbed-helper", trusted_ip,
                                              hostname);
   GNUNET_free_non_null (hostname);
   hostname = NULL;
@@ -341,7 +341,7 @@
   if (NULL == testbed)
   {
     LOG (GNUNET_ERROR_TYPE_WARNING,
-         "Error staring gnunet-service-testbed -- exiting\n");
+         "Error starting gnunet-service-testbed -- exiting\n");
     GNUNET_CONFIGURATION_destroy (cfg);
     goto error;
   }

Modified: gnunet/src/testbed/testbed_api.c
===================================================================
--- gnunet/src/testbed/testbed_api.c    2012-12-17 15:09:25 UTC (rev 25518)
+++ gnunet/src/testbed/testbed_api.c    2012-12-17 16:02:32 UTC (rev 25519)
@@ -1357,9 +1357,12 @@
 
 
 /**
- * Starts a controller process at the host. FIXME: add controller start 
callback
- * with the configuration with which the controller is started
+ * Starts a controller process at the given host
  *
+ * @param trusted_ip the ip address of the controller which will be set as 
TRUSTED
+ *          HOST(all connections form this ip are permitted by the testbed) 
when
+ *          starting testbed controller at host. This can either be a single ip
+ *          address or a network address in CIDR notation.
  * @param controller_ip the ip address of the controller. Will be set as 
TRUSTED
  *          host when starting testbed controller at host
  * @param host the host where the controller has to be started; NULL for
@@ -1378,7 +1381,7 @@
  * @return the controller process handle, NULL on errors
  */
 struct GNUNET_TESTBED_ControllerProc *
-GNUNET_TESTBED_controller_start (const char *controller_ip,
+GNUNET_TESTBED_controller_start (const char *trusted_ip,
                                  struct GNUNET_TESTBED_Host *host,
                                  const struct GNUNET_CONFIGURATION_Handle *cfg,
                                  GNUNET_TESTBED_ControllerStatusCallback cb,
@@ -1402,7 +1405,8 @@
   else
   {
     char *helper_binary_path;
-    const char *remote_args[12];
+#define NUM_REMOTE_ARGS 12
+    const char *remote_args[NUM_REMOTE_ARGS];
     const char *username;
     char *port;
     char *dst;
@@ -1433,7 +1437,7 @@
     remote_args[argp++] = "-lc";
     remote_args[argp++] = helper_binary_path;
     remote_args[argp++] = NULL;
-    GNUNET_assert (argp == 12);
+    GNUNET_assert (NUM_REMOTE_ARGS == argp);
     cp->helper_argv = copy_argv (remote_args);
     GNUNET_free (port);
     GNUNET_free (dst);
@@ -1452,7 +1456,7 @@
   cp->host = host;
   cp->cb = cb;
   cp->cls = cls;
-  msg = GNUNET_TESTBED_create_helper_init_msg_ (controller_ip, hostname, cfg);
+  msg = GNUNET_TESTBED_create_helper_init_msg_ (trusted_ip, hostname, cfg);
   cp->msg = &msg->header;
   cp->shandle =
       GNUNET_HELPER_send (cp->helper, &msg->header, GNUNET_NO, &clear_msg, cp);
@@ -2109,14 +2113,17 @@
  * Creates a helper initialization message. This function is here because we
  * want to use this in testing
  *
- * @param cname the ip address of the controlling host
+ * @param trusted_ip the ip address of the controller which will be set as 
TRUSTED
+ *          HOST(all connections form this ip are permitted by the testbed) 
when
+ *          starting testbed controller at host. This can either be a single ip
+ *          address or a network address in CIDR notation.
  * @param hostname the hostname of the destination this message is intended for
  * @param cfg the configuration that has to used to start the testbed service
  *          thru helper
  * @return the initialization message
  */
 struct GNUNET_TESTBED_HelperInit *
-GNUNET_TESTBED_create_helper_init_msg_ (const char *cname,
+GNUNET_TESTBED_create_helper_init_msg_ (const char *trusted_ip,
                                        const char *hostname,
                                         const struct 
GNUNET_CONFIGURATION_Handle
                                         *cfg)
@@ -2126,7 +2133,7 @@
   char *xconfig;
   size_t config_size;
   size_t xconfig_size;
-  uint16_t cname_len;
+  uint16_t trusted_ip_len;
   uint16_t hostname_len;
   uint16_t msg_size;
 
@@ -2135,23 +2142,23 @@
   xconfig_size =
       GNUNET_TESTBED_compress_config_ (config, config_size, &xconfig);
   GNUNET_free (config);
-  cname_len = strlen (cname);
+  trusted_ip_len = strlen (trusted_ip);
   hostname_len = (NULL == hostname) ? 0 : strlen (hostname);
   msg_size =
-      xconfig_size + cname_len + 1 + sizeof (struct GNUNET_TESTBED_HelperInit);
+      xconfig_size + trusted_ip_len + 1 + sizeof (struct 
GNUNET_TESTBED_HelperInit);
   msg_size += hostname_len;
   msg = GNUNET_realloc (xconfig, msg_size);
-  (void) memmove (((void *) &msg[1]) + cname_len + 1 + hostname_len,
+  (void) memmove (((void *) &msg[1]) + trusted_ip_len + 1 + hostname_len,
                  msg,
                  xconfig_size);
   msg->header.size = htons (msg_size);
   msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_HELPER_INIT);
-  msg->cname_size = htons (cname_len);
+  msg->trusted_ip_size = htons (trusted_ip_len);
   msg->hostname_size = htons (hostname_len);
   msg->config_size = htons (config_size);
-  (void) strcpy ((char *) &msg[1], cname);
+  (void) strcpy ((char *) &msg[1], trusted_ip);
   if (0 != hostname_len)
-    (void) strncpy (((char *) &msg[1]) + cname_len + 1, hostname, 
hostname_len);
+    (void) strncpy (((char *) &msg[1]) + trusted_ip_len + 1, hostname, 
hostname_len);
   return msg;
 }
 

Modified: gnunet/src/testbed/testbed_helper.h
===================================================================
--- gnunet/src/testbed/testbed_helper.h 2012-12-17 15:09:25 UTC (rev 25518)
+++ gnunet/src/testbed/testbed_helper.h 2012-12-17 16:02:32 UTC (rev 25519)
@@ -44,7 +44,7 @@
    * The controller hostname size excluding the NULL termination character -
    * strlen (hostname); cannot be zero
    */
-  uint16_t cname_size GNUNET_PACKED;
+  uint16_t trusted_ip_size GNUNET_PACKED;
 
   /**
    * The hostname size excluding the NULL termination character - strlen
@@ -57,7 +57,7 @@
    */
   uint16_t config_size GNUNET_PACKED;
 
-  /* Followed by NULL terminated controller hostname */
+  /* Followed by NULL terminated trusted ip */
 
   /* Followed by hostname of the machine on which helper runs. This is not NULL
      terminated */

Modified: gnunet/src/testing/testing.c
===================================================================
--- gnunet/src/testing/testing.c        2012-12-17 15:09:25 UTC (rev 25518)
+++ gnunet/src/testing/testing.c        2012-12-17 16:02:32 UTC (rev 25519)
@@ -75,9 +75,10 @@
   char *tmppath;
 
   /**
-   * The hostname of the controller
+   * The trusted ip. Can either be a single ip address or a network address in
+   * CIDR notation.
    */
-  char *controller;
+  char *trusted_ip;
 
   /**
    * our hostname
@@ -271,9 +272,10 @@
  * @param testdir only the directory name without any path. This is used for
  *          all service homes; the directory will be created in a temporary
  *          location depending on the underlying OS
- * @param controller hostname of the controlling host, 
- *        service configurations are modified to allow 
- *        control connections from this host; can be NULL
+ * @param trusted_ip the ip address which will be set as TRUSTED HOST in all
+ *          service configurations generated to allow control connections from
+ *          this ip. This can either be a single ip address or a network 
address
+ *          in CIDR notation.
  * @param hostname the hostname of the system we are using for testing; NULL 
for
  *          localhost
  * @param lowport lowest port number this system is allowed to allocate 
(inclusive)
@@ -282,7 +284,7 @@
  */
 struct GNUNET_TESTING_System *
 GNUNET_TESTING_system_create_with_portrange (const char *testdir,
-                                            const char *controller,
+                                            const char *trusted_ip,
                                             const char *hostname,
                                             uint16_t lowport,
                                             uint16_t highport)
@@ -299,8 +301,8 @@
     GNUNET_free (system);
     return NULL;
   }
-  if (NULL != controller)
-    system->controller = GNUNET_strdup (controller);
+  if (NULL != trusted_ip)
+    system->trusted_ip = GNUNET_strdup (trusted_ip);
   if (NULL != hostname)
     system->hostname = GNUNET_strdup (hostname);
   if (GNUNET_OK != hostkeys_load (system))
@@ -320,19 +322,21 @@
  * @param testdir only the directory name without any path. This is used for 
all
  *          service homes; the directory will be created in a temporary 
location
  *          depending on the underlying OS
- * @param controller hostname of the controlling host, service configurations
- *        are modified to allow control connections from this host; can be NULL
+ * @param trusted_ip the ip address which will be set as TRUSTED HOST in all
+ *          service configurations generated to allow control connections from
+ *          this ip. This can either be a single ip address or a network 
address
+ *          in CIDR notation.
  * @param hostname the hostname of the system we are using for testing; NULL 
for
  *          localhost
  * @return handle to this system, NULL on error
  */
 struct GNUNET_TESTING_System *
 GNUNET_TESTING_system_create (const char *testdir,
-                             const char *controller,
+                             const char *trusted_ip,
                              const char *hostname)
 {
   return GNUNET_TESTING_system_create_with_portrange (testdir,
-                                                     controller,
+                                                     trusted_ip,
                                                      hostname,
                                                      LOW_PORT,
                                                      HIGH_PORT);
@@ -355,7 +359,7 @@
   if (GNUNET_YES == remove_paths)
     GNUNET_DISK_directory_remove (system->tmppath);
   GNUNET_free (system->tmppath);
-  GNUNET_free_non_null (system->controller);
+  GNUNET_free_non_null (system->trusted_ip);
   GNUNET_free_non_null (system->hostname);
   GNUNET_free (system);
 }
@@ -677,8 +681,8 @@
 
 
 /**
- * Section iterator to set ACCEPT_FROM/ACCEPT_FROM6 depending on the ip of the
- * controller in all sections
+ * Section iterator to set ACCEPT_FROM/ACCEPT_FROM6 to include the address of
+ * 'trusted_hosts' in all sections
  *
  * @param cls the UpdateContext
  * @param section name of the section
@@ -756,8 +760,8 @@
   }
   GNUNET_free_non_null (val);
   ACCEPT_FROM_key = "ACCEPT_FROM";  
-  if ((NULL != uc->system->controller) && 
-      (NULL != strstr (uc->system->controller, ":"))) /* IPv6 in use */
+  if ((NULL != uc->system->trusted_ip) && 
+      (NULL != strstr (uc->system->trusted_ip, ":"))) /* IPv6 in use */
     ACCEPT_FROM_key = "ACCEPT_FROM6";
   if (GNUNET_OK != 
       GNUNET_CONFIGURATION_get_value_string (uc->cfg, section, ACCEPT_FROM_key,
@@ -765,11 +769,11 @@
   {
     orig_allowed_hosts = GNUNET_strdup ("127.0.0.1;");
   }
-  if (NULL == uc->system->controller)
+  if (NULL == uc->system->trusted_ip)
     allowed_hosts = GNUNET_strdup (orig_allowed_hosts);
   else
     GNUNET_asprintf (&allowed_hosts, "%s%s;", orig_allowed_hosts,
-                     uc->system->controller);
+                     uc->system->trusted_ip);
   GNUNET_free (orig_allowed_hosts);
   GNUNET_CONFIGURATION_set_value_string (uc->cfg, section, ACCEPT_FROM_key,
                                          allowed_hosts);
@@ -813,7 +817,7 @@
                                          uc.service_home);
   /* make PORTs and UNIXPATHs unique */
   GNUNET_CONFIGURATION_iterate (cfg, &update_config, &uc);
-  /* allow connections to services from system controller host */
+  /* allow connections to services from system trusted_ip host */
   GNUNET_CONFIGURATION_iterate_sections (cfg, &update_config_sections, &uc);
   /* enable loopback-based connections between peers */
   GNUNET_CONFIGURATION_set_value_string (cfg, 




reply via email to

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