Browse Source

Catch up for miniupnpc API 15

pull/406/head
Mikhail Titov 9 years ago
parent
commit
33494c4f4b
  1. 29
      UPnP.cpp

29
UPnP.cpp

@ -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;
m_Devlist = upnpDiscoverFunc (2000, m_MulticastIf, m_Minissdpdpath, 0, 0, &nerror); #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);
#endif
#endif #endif
int r; int r;

Loading…
Cancel
Save