|
|
@ -24,22 +24,13 @@ |
|
|
|
#include <miniupnpc/upnpcommands.h> |
|
|
|
#include <miniupnpc/upnpcommands.h> |
|
|
|
|
|
|
|
|
|
|
|
// These are per-process and are safe to reuse for all threads
|
|
|
|
// These are per-process and are safe to reuse for all threads
|
|
|
|
#ifndef UPNPDISCOVER_SUCCESS |
|
|
|
decltype(upnpDiscover) *upnpDiscoverFunc; |
|
|
|
/* miniupnpc 1.5 */ |
|
|
|
decltype(UPNP_AddPortMapping) *UPNP_AddPortMappingFunc; |
|
|
|
UPNPDev* (*upnpDiscoverFunc) (int, const char *, const char *, int); |
|
|
|
decltype(UPNP_GetValidIGD) *UPNP_GetValidIGDFunc; |
|
|
|
int (*UPNP_AddPortMappingFunc) (const char *, const char *, const char *, const char *, |
|
|
|
decltype(UPNP_GetExternalIPAddress) *UPNP_GetExternalIPAddressFunc; |
|
|
|
const char *, const char *, const char *, const char *); |
|
|
|
decltype(UPNP_DeletePortMapping) *UPNP_DeletePortMappingFunc; |
|
|
|
#else |
|
|
|
decltype(freeUPNPDevlist) *freeUPNPDevlistFunc; |
|
|
|
/* miniupnpc 1.6 */ |
|
|
|
decltype(FreeUPNPUrls) *FreeUPNPUrlsFunc; |
|
|
|
UPNPDev* (*upnpDiscoverFunc) (int, const char *, const char *, int, int, int *); |
|
|
|
|
|
|
|
int (*UPNP_AddPortMappingFunc) (const char *, const char *, const char *, const char *, |
|
|
|
|
|
|
|
const char *, const char *, const char *, const char *, const char *); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
int (*UPNP_GetValidIGDFunc) (struct UPNPDev *, struct UPNPUrls *, struct IGDdatas *, char *, int); |
|
|
|
|
|
|
|
int (*UPNP_GetExternalIPAddressFunc) (const char *, const char *, char *); |
|
|
|
|
|
|
|
int (*UPNP_DeletePortMappingFunc) (const char *, const char *, const char *, const char *, const char *); |
|
|
|
|
|
|
|
void (*freeUPNPDevlistFunc) (struct UPNPDev *); |
|
|
|
|
|
|
|
void (*FreeUPNPUrlsFunc) (struct UPNPUrls *); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Nice approach http://stackoverflow.com/a/21517513/673826
|
|
|
|
// Nice approach http://stackoverflow.com/a/21517513/673826
|
|
|
|
template<class M, typename F> |
|
|
|
template<class M, typename F> |
|
|
@ -134,7 +125,11 @@ namespace transport |
|
|
|
#else |
|
|
|
#else |
|
|
|
/* miniupnpc 1.6 */ |
|
|
|
/* miniupnpc 1.6 */ |
|
|
|
int nerror = 0; |
|
|
|
int nerror = 0; |
|
|
|
|
|
|
|
#if MINIUPNPC_API_VERSION >= 15 |
|
|
|
|
|
|
|
m_Devlist = upnpDiscoverFunc(2000, m_MulticastIf, m_Minissdpdpath, 0, 0, 0, &nerror); |
|
|
|
|
|
|
|
#else |
|
|
|
m_Devlist = upnpDiscoverFunc(2000, m_MulticastIf, m_Minissdpdpath, 0, 0, &nerror); |
|
|
|
m_Devlist = upnpDiscoverFunc(2000, m_MulticastIf, m_Minissdpdpath, 0, 0, &nerror); |
|
|
|
|
|
|
|
#endif |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
int r; |
|
|
|
int r; |
|
|
|