[farsight2/master] emit signal when the mapped address changes
Olivier Crête
olivier.crete at collabora.co.uk
Tue Dec 23 15:24:56 PST 2008
---
fs-upnp-simple-igd.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/fs-upnp-simple-igd.c b/fs-upnp-simple-igd.c
index b62391f..f342454 100644
--- a/fs-upnp-simple-igd.c
+++ b/fs-upnp-simple-igd.c
@@ -308,6 +308,27 @@ static void
_external_ip_address_changed (GUPnPServiceProxy *proxy, const gchar *variable,
GValue *value, gpointer user_data)
{
+ struct Proxy *prox = user_data;
+ gchar *new_ip;
+ guint i;
+
+ g_return_if_fail (G_VALUE_HOLDS_STRING(value));
+
+ new_ip = g_value_dup_string (value);
+
+ for (i=0; i < prox->proxymappings->len; i++)
+ {
+ struct ProxyMapping *pm = g_ptr_array_index (prox->proxymappings, i);
+
+ if (pm->mapped)
+ g_signal_emit (prox->parent, signals[SIGNAL_MAPPED_EXTERNAL_PORT], 0,
+ pm->mapping->protocol, new_ip, prox->external_ip,
+ pm->mapping->external_port, pm->mapping->local_ip,
+ pm->mapping->local_port, pm->mapping->description);
+ }
+
+ g_free (prox->external_ip);
+ prox->external_ip = new_ip;
}
static void
--
1.5.6.5
More information about the farsight-commits
mailing list