mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
Catch up for miniupnpc API 15
This commit is contained in:
parent
daad975f5d
commit
33494c4f4b
29
UPnP.cpp
29
UPnP.cpp
@ -24,22 +24,13 @@
|
||||
#include <miniupnpc/upnpcommands.h>
|
||||
|
||||
// These are per-process and are safe to reuse for all threads
|
||||
#ifndef UPNPDISCOVER_SUCCESS
|
||||
/* miniupnpc 1.5 */
|
||||
UPNPDev* (*upnpDiscoverFunc) (int, const char *, const char *, int);
|
||||
int (*UPNP_AddPortMappingFunc) (const char *, const char *, const char *, const char *,
|
||||
const char *, const char *, const char *, const char *);
|
||||
#else
|
||||
/* miniupnpc 1.6 */
|
||||
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 *);
|
||||
decltype(upnpDiscover) *upnpDiscoverFunc;
|
||||
decltype(UPNP_AddPortMapping) *UPNP_AddPortMappingFunc;
|
||||
decltype(UPNP_GetValidIGD) *UPNP_GetValidIGDFunc;
|
||||
decltype(UPNP_GetExternalIPAddress) *UPNP_GetExternalIPAddressFunc;
|
||||
decltype(UPNP_DeletePortMapping) *UPNP_DeletePortMappingFunc;
|
||||
decltype(freeUPNPDevlist) *freeUPNPDevlistFunc;
|
||||
decltype(FreeUPNPUrls) *FreeUPNPUrlsFunc;
|
||||
|
||||
// Nice approach http://stackoverflow.com/a/21517513/673826
|
||||
template<class M, typename F>
|
||||
@ -134,7 +125,11 @@ namespace transport
|
||||
#else
|
||||
/* miniupnpc 1.6 */
|
||||
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
|
||||
|
||||
int r;
|
||||
|
Loading…
Reference in New Issue
Block a user