Changes to support both miniupnpc 1.0 and up-to-date 1.2

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@786 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
stockpicker 2008-11-02 13:33:06 +00:00
parent c0e846f7f7
commit c222c354d6
3 changed files with 18 additions and 1 deletions

View file

@ -32,7 +32,13 @@ bool upnphandler::initUPnPState()
/* allocate memory */
uPnPConfigData *upcd = new uPnPConfigData;
#if MINIUPNPC_VERSION >= 11
/* Starting from version 1.1, miniupnpc api has a new parameter (int sameport) */
upcd->devlist = upnpDiscover(2000, NULL, NULL, 0);
#else
upcd->devlist = upnpDiscover(2000, NULL, NULL);
#endif
if(upcd->devlist)
{
struct UPNPDev * device;

View file

@ -141,8 +141,14 @@ bool SetRedirectAndTest(struct UPNPUrls * urls,
printf("GetExternalIPAddress failed.\n");
// Unix at the moment!
#if MINIUPNPC_VERSION >= 12
/* Starting from miniupnpc version 1.2, lease duration parameter is gone */
r = UPNP_AddPortMapping(urls->controlURL, data->servicetype,
eport, iport, iaddr, 0, proto);
#else
r = UPNP_AddPortMapping(urls->controlURL, data->servicetype,
eport, iport, iaddr, 0, 0, proto);
#endif
// r = UPNP_AddPortMapping(urls->controlURL, data->servicetype,
// eport, iport, iaddr, 0, leaseDuration, proto);