  };
  
  #endif
+ 
++

   torcontrol
   util
 )
Index: src/vidalia/config/serversettings.cpp
===================================================================
--- src/vidalia/config/serversettings.cpp	(revision 2423)
+++ src/vidalia/config/serversettings.cpp	(working copy)
@@ -130,6 +130,9 @@
   bool rc;

+
+/* TODO: We should call this periodically, in case the router gets rebooted or forgets its UPnP settings */
+/* TODO: Remove port forwarding when Tor is shutdown or the ORPort changes */
+/* TODO: init_upnp() will block for up to 2 seconds. We should fire off a thread */
+/** Configure UPnP device to forward DirPort and ORPort */
+void
+ServerSettings::configurePortForwarding()
+{
+  init_upnp();
+}
+
 /** Virtual method called when we retrieve a server-related setting from Tor.
  * Currently this just translates BandwidthFoo to RelayBandwidthFoo when
  * appropriate. */
@@ -321,3 +390,4 @@
   setValue(SETTING_BANDWIDTH_BURST, rate);
 }
 
+
Index: src/vidalia/config/serversettings.h
===================================================================
--- src/vidalia/config/serversettings.h	(revision 2465)
+++ src/vidalia/config/serversettings.h	(working copy)
@@ -20,6 +20,10 @@
 #include "abstracttorsettings.h"
 #include "exitpolicy.h"
 
+#define STATICLIB
+#include <miniupnpc/miniwget.h>
+#include <miniupnpc/miniupnpc.h>
+#include <miniupnpc/upnpcommands.h>
 
 class ServerSettings : public AbstractTorSettings
 {
@@ -89,9 +93,20 @@
   virtual QVariant torValue(const QString &key) const;
 
 private:
+  /** Used by miniupnpc library */
+  struct UPNPUrls urls;
+  struct IGDdatas data;
+  void init_upnp();
+  void upnp_add_redir (const char * addr, int port);
+  void upnp_rem_redir(int port);
