[farsight2/master] Add list of current mappings
Olivier Crête
olivier.crete at collabora.co.uk
Tue Dec 23 15:24:38 PST 2008
---
fs-upnp-simple-igd.c | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/fs-upnp-simple-igd.c b/fs-upnp-simple-igd.c
index 39d7b34..585fcf4 100644
--- a/fs-upnp-simple-igd.c
+++ b/fs-upnp-simple-igd.c
@@ -35,6 +35,8 @@ struct _FsUpnpSimpleIgdPrivate
GPtrArray *service_proxies;
+ GPtrArray *mappings;
+
gulong avail_handler;
gulong unavail_handler;
@@ -55,6 +57,14 @@ struct Action {
GSource *timeout_source;
};
+struct Mapping {
+ gchar *protocol;
+ guint external_port;
+ gchar *local_ip;
+ guint16 local_port;
+ gchar *description;
+};
+
/* signals */
enum
@@ -216,6 +226,15 @@ cleanup_proxy (struct Proxy *prox)
}
static void
+cleanup_mapping (struct Mapping *mapping)
+{
+ g_free (mapping->protocol);
+ g_free (mapping->local_ip);
+ g_free (mapping->description);
+ g_slice_free (struct Mapping, mapping);
+}
+
+static void
fs_upnp_simple_igd_finalize (GObject *object)
{
FsUpnpSimpleIgd *self = FS_UPNP_SIMPLE_IGD_CAST (object);
@@ -225,6 +244,10 @@ fs_upnp_simple_igd_finalize (GObject *object)
g_warn_if_fail (self->priv->service_proxies->len == 0);
g_ptr_array_free (self->priv->service_proxies, TRUE);
+
+ g_ptr_array_foreach (self->priv->mappings, (GFunc) cleanup_mapping, NULL);
+ g_ptr_array_free (self->priv->mappings, TRUE);
+
G_OBJECT_CLASS (fs_upnp_simple_igd_parent_class)->finalize (object);
}
--
1.5.6.5
More information about the farsight-commits
mailing list