[farsight2/master] Save new mapping when adding one

Olivier Crête olivier.crete at collabora.co.uk
Tue Dec 23 15:24:36 PST 2008


---
 fs-upnp-simple-igd.c |   25 +++++++++++++++++++++++++
 fs-upnp-simple-igd.h |    1 -
 2 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/fs-upnp-simple-igd.c b/fs-upnp-simple-igd.c
index 585fcf4..1d14fc9 100644
--- a/fs-upnp-simple-igd.c
+++ b/fs-upnp-simple-igd.c
@@ -62,6 +62,7 @@ struct Mapping {
   guint external_port;
   gchar *local_ip;
   guint16 local_port;
+  guint32 lease_duration;
   gchar *description;
 };
 
@@ -445,3 +446,27 @@ fs_upnp_simple_igd_gather_proxy (FsUpnpSimpleIgd *self,
 
   g_ptr_array_add(prox->actions, action);
 }
+
+
+void
+fs_upnp_simple_igd_add_port (FsUpnpSimpleIgd *self,
+    const gchar *protocol,
+    guint16 external_port,
+    const gchar *local_ip,
+    guint16 local_port,
+    guint32 lease_duration,
+    const gchar *description)
+{
+  struct Mapping *mapping = g_slice_new0 (struct Mapping);
+
+  g_return_if_fail (protocol && local_ip);
+
+  mapping->protocol = g_strdup (protocol);
+  mapping->external_port = external_port;
+  mapping->local_ip = g_strdup (local_ip);
+  mapping->local_port = local_port;
+  mapping->lease_duration = lease_duration;
+  mapping->description = g_strdup (description);
+
+  g_ptr_array_add (self->priv->mappings, mapping);
+}
diff --git a/fs-upnp-simple-igd.h b/fs-upnp-simple-igd.h
index 81c9620..dd13d47 100644
--- a/fs-upnp-simple-igd.h
+++ b/fs-upnp-simple-igd.h
@@ -90,7 +90,6 @@ fs_upnp_simple_igd_gather (FsUpnpSimpleIgd *self, gboolean gather);
 void
 fs_upnp_simple_igd_add_port (FsUpnpSimpleIgd *self,
     const gchar *protocol,
-    const gchar *remote_host,
     guint16 external_port,
     const gchar *local_ip,
     guint16 local_port,
-- 
1.5.6.5




More information about the farsight-commits mailing list