[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r6625 - GNUnet/src/applications/testing
From: |
gnunet |
Subject: |
[GNUnet-SVN] r6625 - GNUnet/src/applications/testing |
Date: |
Tue, 25 Mar 2008 15:39:25 -0600 (MDT) |
Author: nevans
Date: 2008-03-25 15:39:24 -0600 (Tue, 25 Mar 2008)
New Revision: 6625
Modified:
GNUnet/src/applications/testing/remote.c
GNUnet/src/applications/testing/remote.h
GNUnet/src/applications/testing/remotetest.c
GNUnet/src/applications/testing/remotetopologies.c
Log:
with pre-commit
Modified: GNUnet/src/applications/testing/remote.c
===================================================================
--- GNUnet/src/applications/testing/remote.c 2008-03-25 21:01:31 UTC (rev
6624)
+++ GNUnet/src/applications/testing/remote.c 2008-03-25 21:39:24 UTC (rev
6625)
@@ -66,7 +66,7 @@
snprintf (cmd, length + 1, "scp %s%s address@hidden:%s", localConfigPath,
configFileName, username, hostname, remote_config_path);
- fprintf (stderr,"scp command is : %s \n", cmd);
+ fprintf (stderr, "scp command is : %s \n", cmd);
system (cmd);
GNUNET_free (cmd);
@@ -77,7 +77,7 @@
snprintf (cmd, length + 1, "ssh address@hidden %sgnunetd -c %s%s", username,
hostname, gnunetd_home, remote_config_path, configFileName);
- fprintf (stderr,"ssh command is : %s \n", cmd);
+ fprintf (stderr, "ssh command is : %s \n", cmd);
system (cmd);
@@ -91,9 +91,9 @@
{
struct GNUNET_GC_Configuration *basecfg;
struct GNUNET_REMOTE_daemon_list *array_of_pointers[number_of_daemons];
- struct GNUNET_REMOTE_daemon_list *temp_pos;
- list_as_array = &array_of_pointers[0];
-
+ struct GNUNET_REMOTE_daemon_list *temp_pos;
+ list_as_array = &array_of_pointers[0];
+
char *ssh_username;
char *control_host;
char *remote_config_path;
@@ -104,7 +104,7 @@
unsigned long long starting_port;
unsigned long long port_increment;
unsigned long long daemons_per_machine;
-
+
char *hostnames;
char *temp;
char *temp_path;
@@ -190,10 +190,10 @@
GNUNET_GC_set_configuration_value_number (basecfg, NULL, "NETWORK",
"PORT", starting_port);
- GNUNET_GC_set_configuration_value_number (basecfg,
NULL, "TCP",
+ GNUNET_GC_set_configuration_value_number (basecfg, NULL, "TCP",
"PORT", starting_port + 1);
GNUNET_GC_set_configuration_value_number (basecfg, NULL, "UDP",
- "PORT", starting_port + 1);
+ "PORT", starting_port + 1);
GNUNET_GC_set_configuration_value_string (basecfg, NULL, "NETWORK",
"TRUSTED", control_host);
GNUNET_GC_set_configuration_value_string (basecfg, NULL, "PATHS",
@@ -226,24 +226,34 @@
temp_pid_file);
GNUNET_free (temp_pid_file);
-
- temp_remote_config_path_length =
snprintf(NULL,0,"%s%d",remote_config_path,j);
- temp_remote_config_path =
GNUNET_malloc(temp_remote_config_path_length + 1);
- snprintf(temp_remote_config_path,temp_remote_config_path_length +
1,"%s%d",remote_config_path,j);
- GNUNET_GC_set_configuration_value_string (basecfg, NULL,
"PATHS",
- "GNUNETD_HOME",
- temp_remote_config_path);
-
- GNUNET_free(temp_remote_config_path);
+ temp_remote_config_path_length =
+ snprintf (NULL, 0, "%s%d", remote_config_path, j);
+ temp_remote_config_path =
+ GNUNET_malloc (temp_remote_config_path_length + 1);
+ snprintf (temp_remote_config_path,
+ temp_remote_config_path_length + 1, "%s%d",
+ remote_config_path, j);
- GNUNET_GC_set_configuration_value_number (basecfg, NULL,
"NETWORK",
- "PORT", starting_port +
(j*port_increment));
+ GNUNET_GC_set_configuration_value_string (basecfg, NULL, "PATHS",
+ "GNUNETD_HOME",
+ temp_remote_config_path);
+
+ GNUNET_free (temp_remote_config_path);
+
+ GNUNET_GC_set_configuration_value_number (basecfg, NULL, "NETWORK",
+ "PORT",
+ starting_port +
+ (j * port_increment));
GNUNET_GC_set_configuration_value_number (basecfg, NULL, "TCP",
- "PORT", starting_port +
(j*port_increment) + 1);
- GNUNET_GC_set_configuration_value_number (basecfg, NULL, "UDP",
- "PORT", starting_port +
(j*port_increment) + 1);
-
+ "PORT",
+ starting_port +
+ (j * port_increment) + 1);
+ GNUNET_GC_set_configuration_value_number (basecfg, NULL, "UDP",
+ "PORT",
+ starting_port +
+ (j * port_increment) + 1);
+
temp_path = GNUNET_strdup ("/tmp/gnunetd.conf.XXXXXX");
ret = mkstemp (temp_path);
@@ -273,13 +283,15 @@
GNUNET_REMOTE_start_daemon (remote_gnunetd_path, "/tmp/",
temp, remote_config_path,
curr_host, ssh_username);
- temp_pos = GNUNET_malloc(sizeof(struct
GNUNET_REMOTE_daemon_list));
- temp_pos->hostname = GNUNET_malloc(strlen(curr_host));
- strcpy(temp_pos->hostname,curr_host);
+ temp_pos =
+ GNUNET_malloc (sizeof (struct GNUNET_REMOTE_daemon_list));
+ temp_pos->hostname = GNUNET_malloc (strlen (curr_host));
+ strcpy (temp_pos->hostname, curr_host);
GNUNET_GC_get_configuration_value_number (basecfg,
- "NETWORK",
- "PORT",
- 0, 65535, 65535,
&temp_pos->port);
+ "NETWORK",
+ "PORT",
+ 0, 65535, 65535,
+ &temp_pos->port);
temp_pos->next = head;
head = temp_pos;
array_of_pointers[count_started] = temp_pos;
@@ -303,13 +315,25 @@
temp_pid_file);
GNUNET_free (temp_pid_file);
-
GNUNET_GC_set_configuration_value_number (basecfg, NULL, "NETWORK",
- "PORT", starting_port +
((j+1)*port_increment));
- GNUNET_GC_set_configuration_value_number (basecfg,
NULL, "TCP",
- "PORT", starting_port +
((j+1)*port_increment) + 1);
- GNUNET_GC_set_configuration_value_number
(basecfg, NULL, "UDP",
- "PORT", starting_port +
((j+1)*port_increment) + 1);
-
+ GNUNET_GC_set_configuration_value_number (basecfg, NULL,
+ "NETWORK", "PORT",
+ starting_port +
+ ((j +
+ 1) *
+ port_increment));
+ GNUNET_GC_set_configuration_value_number (basecfg, NULL, "TCP",
+ "PORT",
+ starting_port +
+ ((j +
+ 1) *
+ port_increment) + 1);
+ GNUNET_GC_set_configuration_value_number (basecfg, NULL, "UDP",
+ "PORT",
+ starting_port +
+ ((j +
+ 1) *
+ port_increment) + 1);
+
temp_path = GNUNET_strdup ("/tmp/gnunetd.conf.XXXXXX");
ret = mkstemp (temp_path);
@@ -342,17 +366,19 @@
"/tmp/", temp,
remote_config_path,
curr_host, ssh_username);
- temp_pos = GNUNET_malloc(sizeof(struct
GNUNET_REMOTE_daemon_list));
- temp_pos->hostname = GNUNET_malloc(strlen(curr_host));
- strcpy(temp_pos->hostname,curr_host);
- GNUNET_GC_get_configuration_value_number (basecfg,
- "NETWORK",
- "PORT",
- 0, 65535, 65535,
&temp_pos->port);
- temp_pos->next = head;
- head = temp_pos;
- array_of_pointers[count_started] = temp_pos;
- count_started++;
+ temp_pos =
+ GNUNET_malloc (sizeof (struct GNUNET_REMOTE_daemon_list));
+ temp_pos->hostname = GNUNET_malloc (strlen (curr_host));
+ strcpy (temp_pos->hostname, curr_host);
+ GNUNET_GC_get_configuration_value_number (basecfg,
+ "NETWORK",
+ "PORT",
+ 0, 65535, 65535,
+ &temp_pos->port);
+ temp_pos->next = head;
+ head = temp_pos;
+ array_of_pointers[count_started] = temp_pos;
+ count_started++;
}
UNLINK (temp_path);
GNUNET_free (temp_path);
@@ -363,7 +389,8 @@
GNUNET_GC_free (basecfg);
++i;
}
- ret =
GNUNET_REMOTE_create_topology(GNUNET_REMOTE_CLIQUE,number_of_daemons);
+ ret =
+ GNUNET_REMOTE_create_topology (GNUNET_REMOTE_CLIQUE, number_of_daemons);
GNUNET_free (base_config);
GNUNET_free (remote_pid_path);
GNUNET_free (data_dir);
@@ -376,28 +403,30 @@
return ret;
}
-int
-GNUNET_REMOTE_create_topology(GNUNET_REMOTE_TOPOLOGIES t,int number_of_daemons)
+int
+GNUNET_REMOTE_create_topology (GNUNET_REMOTE_TOPOLOGIES t,
+ int number_of_daemons)
{
- int ret;
-
- ret = GNUNET_OK;
- switch (t)
- {
- case GNUNET_REMOTE_CLIQUE:
- ret = GNUNET_REMOTE_connect_clique(head);
- break;
- case GNUNET_REMOTE_SMALL_WORLD:
- break;
- case GNUNET_REMOTE_RING:
- break;
- case GNUNET_REMOTE_2D_TORUS:
- ret = GNUNET_REMOTE_connect_2d_torus(number_of_daemons,list_as_array);
- break;
- default:
- break;
- }
-
- return ret;
+ int ret;
+
+ ret = GNUNET_OK;
+ switch (t)
+ {
+ case GNUNET_REMOTE_CLIQUE:
+ ret = GNUNET_REMOTE_connect_clique (head);
+ break;
+ case GNUNET_REMOTE_SMALL_WORLD:
+ break;
+ case GNUNET_REMOTE_RING:
+ break;
+ case GNUNET_REMOTE_2D_TORUS:
+ ret = GNUNET_REMOTE_connect_2d_torus (number_of_daemons, list_as_array);
+ break;
+ default:
+ break;
+ }
+
+ return ret;
}
+
/* end of remote.c */
Modified: GNUnet/src/applications/testing/remote.h
===================================================================
--- GNUnet/src/applications/testing/remote.h 2008-03-25 21:01:31 UTC (rev
6624)
+++ GNUnet/src/applications/testing/remote.h 2008-03-25 21:39:24 UTC (rev
6625)
@@ -44,10 +44,10 @@
struct GNUNET_REMOTE_daemon_list
{
- struct GNUNET_REMOTE_daemon_list *next;
- char *hostname;
- unsigned long long port;
-
+ struct GNUNET_REMOTE_daemon_list *next;
+ char *hostname;
+ unsigned long long port;
+
};
@@ -63,15 +63,17 @@
* @return GNUNET_OK on success, GNUNET_SYSERR on failure
*/
int
-GNUNET_REMOTE_connect_daemons ( char * ip1, unsigned short port1, char * ip2,
unsigned short port2);
+GNUNET_REMOTE_connect_daemons (char *ip1, unsigned short port1, char *ip2,
+ unsigned short port2);
/**
* Create a topology (connect the running gnunetd's) that corresponds
* to the type specified in t.
*/
-int
-GNUNET_REMOTE_create_topology(GNUNET_REMOTE_TOPOLOGIES t,int
number_of_daemons);
+int
+GNUNET_REMOTE_create_topology (GNUNET_REMOTE_TOPOLOGIES t,
+ int number_of_daemons);
-#endif /*REMOTE_H_*/
+#endif /*REMOTE_H_ */
/* end of remote.h */
Modified: GNUnet/src/applications/testing/remotetest.c
===================================================================
--- GNUnet/src/applications/testing/remotetest.c 2008-03-25 21:01:31 UTC
(rev 6624)
+++ GNUnet/src/applications/testing/remotetest.c 2008-03-25 21:39:24 UTC
(rev 6625)
@@ -41,7 +41,7 @@
{'n', "number_of_daemons", "NUMBER_OF_DAEMONS",
gettext_noop ("set number of daemons to start"),
1, &GNUNET_getopt_configure_set_ulong, &number_of_daemons}, /* -n */
- GNUNET_COMMAND_LINE_OPTION_VERBOSE,
+ GNUNET_COMMAND_LINE_OPTION_VERBOSE,
GNUNET_COMMAND_LINE_OPTION_END,
};
Modified: GNUnet/src/applications/testing/remotetopologies.c
===================================================================
--- GNUnet/src/applications/testing/remotetopologies.c 2008-03-25 21:01:31 UTC
(rev 6624)
+++ GNUnet/src/applications/testing/remotetopologies.c 2008-03-25 21:39:24 UTC
(rev 6625)
@@ -39,33 +39,37 @@
"%s: %llu - %u\n", (const char *) &oth, last_message, bpmFromPeer);
return GNUNET_OK;
}
-
+
int
-GNUNET_REMOTE_connect_clique(struct GNUNET_REMOTE_daemon_list *main_list)
+GNUNET_REMOTE_connect_clique (struct GNUNET_REMOTE_daemon_list *main_list)
{
- struct GNUNET_REMOTE_daemon_list *pos = main_list;
- struct GNUNET_REMOTE_daemon_list *iter_pos = main_list;
-
- while((pos != NULL)&&(pos->next != NULL))
- {
- iter_pos = pos->next;
- while(iter_pos != NULL)
- {
- GNUNET_REMOTE_connect_daemons (pos->hostname,
pos->port, iter_pos->hostname, iter_pos->port);
- iter_pos = iter_pos->next;
- }
- pos = pos->next;
- }
-
- return GNUNET_OK;
+ struct GNUNET_REMOTE_daemon_list *pos = main_list;
+ struct GNUNET_REMOTE_daemon_list *iter_pos = main_list;
+
+ while ((pos != NULL) && (pos->next != NULL))
+ {
+ iter_pos = pos->next;
+ while (iter_pos != NULL)
+ {
+ GNUNET_REMOTE_connect_daemons (pos->hostname, pos->port,
+ iter_pos->hostname, iter_pos->port);
+ iter_pos = iter_pos->next;
+ }
+ pos = pos->next;
+ }
+
+ return GNUNET_OK;
}
int
-GNUNET_REMOTE_connect_2d_torus(int number_of_daemons,struct
GNUNET_REMOTE_daemon_list **list_as_array)
+GNUNET_REMOTE_connect_2d_torus (int number_of_daemons,
+ struct GNUNET_REMOTE_daemon_list
+ **list_as_array)
{
-
+
return GNUNET_SYSERR;
}
+
/**
* Establish a connection between two GNUnet daemons
*
@@ -77,7 +81,8 @@
*/
int
-GNUNET_REMOTE_connect_daemons ( char * hostname1, unsigned short port1, char *
hostname2, unsigned short port2)
+GNUNET_REMOTE_connect_daemons (char *hostname1, unsigned short port1,
+ char *hostname2, unsigned short port2)
{
char host[128];
struct GNUNET_GC_Configuration *cfg1 = GNUNET_GC_create ();
@@ -92,11 +97,11 @@
GNUNET_snprintf (host, 128, "%s:%u", hostname1, port1);
GNUNET_GC_set_configuration_value_string (cfg1, NULL, "NETWORK", "HOST",
host);
- fprintf(stderr,"host1 is %s\n",host);
+ fprintf (stderr, "host1 is %s\n", host);
GNUNET_snprintf (host, 128, "%s:%u", hostname2, port2);
GNUNET_GC_set_configuration_value_string (cfg2, NULL, "NETWORK", "HOST",
host);
- fprintf(stderr,"host2 is %s\n",host);
+ fprintf (stderr, "host2 is %s\n", host);
if ((GNUNET_OK ==
GNUNET_wait_for_daemon_running (NULL, cfg1, 300 * GNUNET_CRON_SECONDS))
&& (GNUNET_OK ==
@@ -159,7 +164,7 @@
GNUNET_IDENTITY_request_peer_infos (sock2, &printInfo, NULL);
}
- fprintf (stderr, "%s\n", ret == GNUNET_OK ? "!" : "?");
+ fprintf (stderr, "%s\n", ret == GNUNET_OK ? "Connected nodes." : "?");
GNUNET_client_connection_destroy (sock1);
GNUNET_client_connection_destroy (sock2);
}
@@ -171,5 +176,5 @@
GNUNET_GC_free (cfg2);
return ret;
}
-
+
/* end of remotetopologies.c */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r6625 - GNUnet/src/applications/testing,
gnunet <=