[farsight2/master] Add function to remove a mapping
Olivier Crête
olivier.crete at collabora.co.uk
Tue Dec 23 15:24:40 PST 2008
---
fs-upnp-simple-igd.c | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/fs-upnp-simple-igd.c b/fs-upnp-simple-igd.c
index 1d14fc9..ed06abf 100644
--- a/fs-upnp-simple-igd.c
+++ b/fs-upnp-simple-igd.c
@@ -23,6 +23,8 @@
#include "fs-upnp-simple-igd.h"
+#include <string.h>
+
#include <libgupnp/gupnp-control-point.h>
@@ -470,3 +472,29 @@ fs_upnp_simple_igd_add_port (FsUpnpSimpleIgd *self,
g_ptr_array_add (self->priv->mappings, mapping);
}
+
+
+void
+fs_upnp_simple_igd_remove_port (FsUpnpSimpleIgd *self,
+ const gchar *protocol,
+ guint external_port)
+{
+ guint i;
+ struct Mapping *mapping;
+
+ g_return_if_fail (protocol);
+
+ for (i = 0; i < self->priv->mappings->len; i++)
+ {
+ struct Mapping *tmpmapping = g_ptr_array_index (self->priv->mappings, i);
+ if (tmpmapping->external_port == external_port &&
+ !strcmp (tmpmapping->protocol, protocol))
+ {
+ mapping = tmpmapping;
+ break;
+ }
+ }
+ g_return_if_fail (mapping);
+
+ cleanup_mapping (mapping);
+}
--
1.5.6.5
More information about the farsight-commits
mailing list