[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r8485 - GNUnet/src/applications/testing
From: |
gnunet |
Subject: |
[GNUnet-SVN] r8485 - GNUnet/src/applications/testing |
Date: |
Fri, 29 May 2009 17:12:58 -0600 |
Author: nevans
Date: 2009-05-29 17:12:58 -0600 (Fri, 29 May 2009)
New Revision: 8485
Modified:
GNUnet/src/applications/testing/remote.c
GNUnet/src/applications/testing/remotetopologies.c
Log:
topology and other random stuff
Modified: GNUnet/src/applications/testing/remote.c
===================================================================
--- GNUnet/src/applications/testing/remote.c 2009-05-29 23:12:43 UTC (rev
8484)
+++ GNUnet/src/applications/testing/remote.c 2009-05-29 23:12:58 UTC (rev
8485)
@@ -38,10 +38,11 @@
*
* @param gnunetd_home directory where gnunetd is on remote machine
* @param localConfigPath local configuration path for config file
+ * @param configFileName file to copy and use on remote machine
* @param remote_config_path remote path to copy local config to
- * @param configFileName file to copy and use on remote machine
- * @param ip_address ip address of remote machine
+ * @param hostname hostname or ip address of remote machine
* @param username username to use for ssh (assumed to be used with ssh-agent)
+ * @param remote_friend_file_path path for friend file on remote machine
*/
int
GNUNET_REMOTE_start_daemon (char *gnunetd_home,
@@ -78,10 +79,7 @@
configFileName, username, hostname,
remote_config_path);
}
- /* To me this seems like information that will always be appreciated by the
user
- * if this is contested by anyone, please mark it here as well as how it
should be
- * done, and I can change it everywhere else by example! NE
- */
+
#if VERBOSE
fprintf (stderr, _("cp command is : %s \n"), cmd);
#endif
@@ -140,10 +138,7 @@
#endif
unused = system (cmd);
-
GNUNET_free (cmd);
-
-
return GNUNET_OK;
}
@@ -246,6 +241,10 @@
char *remote_config_path;
char *remote_gnunetd_path;
char *remote_pid_path;
+ char *mysql_server;
+ char *mysql_user;
+ char *mysql_password;
+ char *mysql_db;
char *base_config;
char *data_dir;
char *hostnames;
@@ -258,12 +257,11 @@
unsigned long long starting_port;
unsigned long long port_increment;
+ unsigned long long mysql_port;
unsigned long long daemons_per_machine;
unsigned long long temp_port;
unsigned long long topology;
-
-
unsigned int extra_daemons;
unsigned int count;
unsigned int count_started;
@@ -331,6 +329,10 @@
"PORT_INCREMENT",
1, -1, 2, &port_increment);
+ GNUNET_GC_get_configuration_value_number (newcfg, "MULTIPLE_SERVER_TESTING",
+ "MYSQL_PORT",
+ 1, -1, 3306, &mysql_port);
+
GNUNET_GC_get_configuration_value_string (newcfg, "MULTIPLE_SERVER_TESTING",
"REMOTE_CONFIG_PATH", "/tmp/",
&remote_config_path);
@@ -353,6 +355,19 @@
"PID_PATH", "/tmp/",
&remote_pid_path);
+ GNUNET_GC_get_configuration_value_string (newcfg, "MULTIPLE_SERVER_TESTING",
+ "MYSQL_SERVER", control_host,
+ &mysql_server);
+
+ GNUNET_GC_get_configuration_value_string (newcfg, "MULTIPLE_SERVER_TESTING",
+ "MYSQL_DB", "dht", &mysql_db);
+
+ GNUNET_GC_get_configuration_value_string (newcfg, "MULTIPLE_SERVER_TESTING",
+ "MYSQL_USER", "dht", &mysql_user);
+
+ GNUNET_GC_get_configuration_value_string (newcfg, "MULTIPLE_SERVER_TESTING",
+ "MYSQL_PASSWORD", "dht**",
+ &mysql_password);
length = strlen (hostnames);
num_machines = 1;
for (count = 0; count < length; count++)
@@ -386,6 +401,22 @@
GNUNET_GC_set_configuration_value_string (basecfg, NULL, "PATHS",
"GNUNETD_HOME",
remote_config_path);
+ GNUNET_GC_set_configuration_value_string (basecfg, NULL,
+ "MYSQL_LOGGING",
+ "MYSQL_SERVER", mysql_server);
+ GNUNET_GC_set_configuration_value_string (basecfg, NULL,
+ "MYSQL_LOGGING", "MYSQL_DB",
+ mysql_db);
+ GNUNET_GC_set_configuration_value_string (basecfg, NULL,
+ "MYSQL_LOGGING", "MYSQL_USER",
+ mysql_user);
+ GNUNET_GC_set_configuration_value_string (basecfg, NULL,
+ "MYSQL_LOGGING",
+ "MYSQL_PASSWORD",
+ mysql_password);
+ GNUNET_GC_set_configuration_value_number (basecfg, NULL,
+ "MYSQL_LOGGING", "MYSQL_PORT",
+ mysql_port);
while (hostnames[pos] != ' ' && pos > 0)
pos--;
@@ -727,8 +758,9 @@
#if VERBOSE
fprintf (stderr, _("Creating small world topology\n"));
#endif
- ret = GNUNET_REMOTE_connect_small_world(number_of_daemons, list_as_array,
- dotOutFile);
+ ret =
+ GNUNET_REMOTE_connect_small_world (number_of_daemons, list_as_array,
+ dotOutFile);
break;
case GNUNET_REMOTE_RING:
#if VERBOSE
Modified: GNUnet/src/applications/testing/remotetopologies.c
===================================================================
--- GNUnet/src/applications/testing/remotetopologies.c 2009-05-29 23:12:43 UTC
(rev 8484)
+++ GNUnet/src/applications/testing/remotetopologies.c 2009-05-29 23:12:58 UTC
(rev 8485)
@@ -44,13 +44,15 @@
#endif
static int
-addNodeRefs(GNUNET_EncName *node1enc, GNUNET_EncName *node2enc, struct
GNUNET_REMOTE_host_list *node1pos, struct GNUNET_REMOTE_host_list *node2pos)
+addNodeRefs (GNUNET_EncName * node1enc, GNUNET_EncName * node2enc,
+ struct GNUNET_REMOTE_host_list *node1pos,
+ struct GNUNET_REMOTE_host_list *node2pos)
{
struct GNUNET_REMOTE_friends_list *node1temp;
struct GNUNET_REMOTE_friends_list *node2temp;
- node1temp = GNUNET_malloc (sizeof(struct GNUNET_REMOTE_friends_list));
- node2temp = GNUNET_malloc (sizeof(struct GNUNET_REMOTE_friends_list));
+ node1temp = GNUNET_malloc (sizeof (struct GNUNET_REMOTE_friends_list));
+ node2temp = GNUNET_malloc (sizeof (struct GNUNET_REMOTE_friends_list));
node2temp->hostentry = node1pos;
node1temp->hostentry = node2pos;
@@ -70,7 +72,72 @@
return GNUNET_OK;
}
+int
+GNUNET_REMOTE_connect_nated_internet (double nat_percentage,
+ int number_of_daemons,
+ struct GNUNET_REMOTE_host_list
+ *main_list, FILE * dotOutFile)
+{
+ unsigned int count, inner_count;
+ int is_nat, inner_is_nat, can_connect;
+ unsigned int cutoff;
+ struct GNUNET_REMOTE_host_list *pos = main_list;
+ struct GNUNET_REMOTE_host_list *iter_pos = main_list;
+ GNUNET_EncName *node1;
+ GNUNET_EncName *node2;
+ node1 = GNUNET_malloc (sizeof (GNUNET_EncName));
+ node2 = GNUNET_malloc (sizeof (GNUNET_EncName));
+ cutoff = (unsigned int) (nat_percentage * number_of_daemons);
+
+ count = 0;
+ while ((pos != NULL) && (pos->next != NULL))
+ {
+ if (count < cutoff)
+ is_nat = GNUNET_YES;
+ else
+ is_nat = GNUNET_NO;
+ inner_count = 0;
+ iter_pos = pos->next;
+ while (iter_pos != NULL)
+ {
+ if (inner_count < cutoff)
+ inner_is_nat = GNUNET_YES;
+ else
+ inner_is_nat = GNUNET_NO;
+ can_connect = GNUNET_YES;
+
+ if ((is_nat == GNUNET_YES) && (inner_is_nat == GNUNET_YES))
+ {
+ can_connect = GNUNET_NO;
+ }
+
+ if (GNUNET_YES == can_connect)
+ {
+ if (GNUNET_OK ==
+ GNUNET_REMOTE_get_daemons_information (pos->hostname,
+ pos->port,
+ iter_pos->hostname,
+ iter_pos->port,
+ &node1, &node2))
+ {
+ addNodeRefs (node1, node2, pos, iter_pos);
+ }
+ }
+ iter_pos = iter_pos->next;
+ inner_count++;
+ }
+ pos = pos->next;
+ count++;
+ }
+
+ GNUNET_free (node1);
+ GNUNET_free (node2);
+
+ return GNUNET_OK;
+}
+
+
int
GNUNET_REMOTE_connect_erdos_renyi (double probability,
struct GNUNET_REMOTE_host_list *main_list,
@@ -104,7 +171,7 @@
#endif
if (temp_rand < probability)
{
- addNodeRefs(node1, node2, pos, iter_pos);
+ addNodeRefs (node1, node2, pos, iter_pos);
}
}
iter_pos = iter_pos->next;
@@ -141,7 +208,7 @@
iter_pos->port, &node1,
&node2))
{
- addNodeRefs(node1, node2, pos, iter_pos);
+ addNodeRefs (node1, node2, pos, iter_pos);
}
iter_pos = iter_pos->next;
}
@@ -174,7 +241,7 @@
iter_pos->port, &node1,
&node2))
{
- addNodeRefs(node1, node2, pos, iter_pos);
+ addNodeRefs (node1, node2, pos, iter_pos);
}
pos = pos->next;
}
@@ -184,7 +251,7 @@
iter_pos->hostname,
iter_pos->port, &node1, &node2))
{
- addNodeRefs(node1, node2, pos, iter_pos);
+ addNodeRefs (node1, node2, pos, iter_pos);
}
GNUNET_free (node1);
@@ -257,7 +324,8 @@
[nodeToConnect]->port, &node1,
&node2);
- addNodeRefs(node1, node2, list_as_array[i],
list_as_array[nodeToConnect]);
+ addNodeRefs (node1, node2, list_as_array[i],
+ list_as_array[nodeToConnect]);
/* Second connect to the node immediately above */
if (i < cols)
@@ -278,7 +346,8 @@
[nodeToConnect]->port,
&node1, &node2);
- addNodeRefs(node1, node2, list_as_array[i],
list_as_array[nodeToConnect]);
+ addNodeRefs (node1, node2, list_as_array[i],
+ list_as_array[nodeToConnect]);
}
}
@@ -358,7 +427,8 @@
list_as_array
[nodeToConnect]->port, &node1,
&node2);
- addNodeRefs(node1, node2, list_as_array[i],
list_as_array[nodeToConnect]);
+ addNodeRefs (node1, node2, list_as_array[i],
+ list_as_array[nodeToConnect]);
if (i < cols)
nodeToConnect = (rows * cols) - cols + i;
@@ -377,50 +447,55 @@
list_as_array
[nodeToConnect]->port,
&node1, &node2);
- addNodeRefs(node1, node2, list_as_array[i],
list_as_array[nodeToConnect]);
+ addNodeRefs (node1, node2, list_as_array[i],
+ list_as_array[nodeToConnect]);
}
}
- natLog = log(number_of_daemons);
+ natLog = log (number_of_daemons);
for (i = 0; i < natLog; i++)
- {
- for (j = 0; j < number_of_daemons; j++)
{
- /* Determine the row and column of node at position j on the 2d torus */
- node1Row = j / cols;
- node1Col = j - (node1Row * cols);
- for (k = 0; k < number_of_daemons; k++)
- {
- /* Determine the row and column of node at position k on the 2d torus
*/
- node2Row = k / cols;
- node2Col = k - (node2Row * cols);
- /* Simple Cartesian distance */
- distance = abs(node1Row - node2Row) + abs(node1Col - node2Col);
- if (distance > 1)
+ for (j = 0; j < number_of_daemons; j++)
{
- /* Calculate probability as 1 over the square of the distance */
- probability = 1.0 / (distance * distance);
- /* Choose a random, divide by RAND_MAX to get a number between 0 and
1 */
- random = ((double) rand() / RAND_MAX);
- /* If random < probability, then connect the two nodes */
- if (random < probability)
- {
- GNUNET_REMOTE_get_daemons_information (list_as_array[j]->hostname,
-
list_as_array[j]->port,
- list_as_array
- [k]->hostname,
- list_as_array
- [k]->port, &node1,
- &node2);
+ /* Determine the row and column of node at position j on the 2d
torus */
+ node1Row = j / cols;
+ node1Col = j - (node1Row * cols);
+ for (k = 0; k < number_of_daemons; k++)
+ {
+ /* Determine the row and column of node at position k on the 2d
torus */
+ node2Row = k / cols;
+ node2Col = k - (node2Row * cols);
+ /* Simple Cartesian distance */
+ distance =
+ abs (node1Row - node2Row) + abs (node1Col - node2Col);
+ if (distance > 1)
+ {
+ /* Calculate probability as 1 over the square of the
distance */
+ probability = 1.0 / (distance * distance);
+ /* Choose a random, divide by RAND_MAX to get a number
between 0 and 1 */
+ random = ((double) rand () / RAND_MAX);
+ /* If random < probability, then connect the two nodes */
+ if (random < probability)
+ {
+ GNUNET_REMOTE_get_daemons_information (list_as_array
+ [j]->hostname,
+ list_as_array
+ [j]->port,
+ list_as_array
+ [k]->hostname,
+ list_as_array
+ [k]->port,
+ &node1, &node2);
- addNodeRefs(node1, node2, list_as_array[j], list_as_array[k]);
- }
+ addNodeRefs (node1, node2, list_as_array[j],
+ list_as_array[k]);
+ }
+ }
+ }
}
- }
}
- }
GNUNET_free (node1);
GNUNET_free (node2);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r8485 - GNUnet/src/applications/testing,
gnunet <=