[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r16576 - gnunet-gtk/src/setup
From: |
gnunet |
Subject: |
[GNUnet-SVN] r16576 - gnunet-gtk/src/setup |
Date: |
Mon, 15 Aug 2011 21:29:48 +0200 |
Author: grothoff
Date: 2011-08-15 21:29:48 +0200 (Mon, 15 Aug 2011)
New Revision: 16576
Modified:
gnunet-gtk/src/setup/gnunet-setup-transport.c
Log:
use new non-blocking external-ip api
Modified: gnunet-gtk/src/setup/gnunet-setup-transport.c
===================================================================
--- gnunet-gtk/src/setup/gnunet-setup-transport.c 2011-08-15 19:29:32 UTC
(rev 16575)
+++ gnunet-gtk/src/setup/gnunet-setup-transport.c 2011-08-15 19:29:48 UTC
(rev 16576)
@@ -202,53 +202,80 @@
/**
- * User asked for autoconfiguration. Try the full program.
+ * Set our external IPv4 address.
+ *
+ * @param cls closure
+ * @param addr the address, NULL on errors
*/
-void
-GNUNET_setup_transport_autoconfig_button_clicked_cb ()
+static void
+set_external_ipv4 (void *cls,
+ const struct in_addr *addr)
{
struct in_addr ia;
char buf[INET_ADDRSTRLEN];
+ GObject *o;
GtkEntry *entry;
GtkToggleButton *button;
- int hns;
- int hnc;
- char *tmp;
- /* try to detect external IP */
- if (GNUNET_OK ==
- GNUNET_NAT_mini_get_external_ipv4 (&ia))
- {
+ if (NULL != addr)
+ {
/* enable 'behind nat' */
- GNUNET_CONFIGURATION_set_value_string (cfg,
- "nat",
- "BEHIND_NAT",
- "YES");
- button = GTK_TOGGLE_BUTTON (GNUNET_SETUP_get_object
("GNUNET_setup_transport_nat_checkbutton"));
- if (button == NULL)
+ if (NULL != cfg)
+ GNUNET_CONFIGURATION_set_value_string (cfg,
+ "nat",
+ "BEHIND_NAT",
+ "YES");
+ o = GNUNET_SETUP_get_object ("GNUNET_setup_transport_nat_checkbutton");
+ if (NULL != o)
{
- GNUNET_break (0);
- return;
+ button = GTK_TOGGLE_BUTTON (o);
+ if (button == NULL)
+ {
+ GNUNET_break (0);
+ return;
+ }
+ gtk_toggle_button_set_active (button,
+ TRUE);
}
- gtk_toggle_button_set_active (button,
- TRUE);
/* set external IP address */
inet_ntop (AF_INET, &ia, buf, sizeof(buf));
- GNUNET_CONFIGURATION_set_value_string (cfg,
- "nat",
- "EXTERNAL_ADDRESS",
- buf);
- entry = GTK_ENTRY (GNUNET_SETUP_get_object
("GNUNET_setup_transport_external_ip_address_entry"));
- if (entry == NULL)
- {
- GNUNET_break (0);
- return;
+ if (NULL != cfg)
+ GNUNET_CONFIGURATION_set_value_string (cfg,
+ "nat",
+ "EXTERNAL_ADDRESS",
+ buf);
+ o = GNUNET_SETUP_get_object
("GNUNET_setup_transport_external_ip_address_entry");
+ if (NULL != o)
+ {
+ entry = GTK_ENTRY (o);
+ if (entry == NULL)
+ {
+ GNUNET_break (0);
+ return;
+ }
+ gtk_entry_set_text (entry,
+ buf);
}
- gtk_entry_set_text (entry,
- buf);
}
+}
+
+/**
+ * User asked for autoconfiguration. Try the full program.
+ */
+void
+GNUNET_setup_transport_autoconfig_button_clicked_cb ()
+{
+ GtkToggleButton *button;
+ int hns;
+ int hnc;
+ char *tmp;
+
+ /* try to detect external IP */
+ (void) GNUNET_NAT_mini_get_external_ipv4 (TIMEOUT,
+ &set_external_ipv4,
+ NULL);
/* Try to detect internal IP */
GNUNET_OS_network_interfaces_list (&nipo, NULL);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r16576 - gnunet-gtk/src/setup,
gnunet <=