Add UPnP support.

Feedback is in logs as suggested by skid_au. The checkbox is still there, but
mostly for people who would like to opt out (unfortunately, I can not be sure
how this feature may behave for some routers - there's a hell of a lot of bad
UPnP implementations.)

The Visual Studio stuff is a little messy, so I apologize if anything is a bit
off. I tested most configurations and it worked.

I also tested CMake on Debian Wheezy, Ubuntu Saucy, and Mac OS X Mountain Lion.
All seemed to be OK.
This commit is contained in:
John Chadwick
2013-07-08 20:13:02 -04:00
parent 379a15ba3b
commit 16cd26d177
53 changed files with 9321 additions and 1336 deletions

View File

@ -192,6 +192,10 @@ public:
u64 CalculateMinimumBufferTime();
void AdjustPadBufferSize(unsigned int size);
#ifdef USE_UPNP
void TryPortmapping(u16 port);
#endif
private:
class Client : public Player
{
@ -215,6 +219,22 @@ private:
Common::Timer m_ping_timer;
u32 m_ping_key;
bool m_update_pings;
#ifdef USE_UPNP
static void mapPortThread(const u16 port);
static void unmapPortThread();
static bool initUPnP();
static bool UPnPMapPort(const std::string& addr, const u16 port);
static bool UPnPUnmapPort(const u16 port);
static struct UPNPUrls m_upnp_urls;
static struct IGDdatas m_upnp_data;
static u16 m_upnp_mapped;
static bool m_upnp_inited;
static bool m_upnp_error;
static std::thread m_upnp_thread;
#endif
};
class NetPlayClient : public NetPlay