mirror of https://github.com/PurpleI2P/i2pd.git
I2P: End-to-End encrypted and anonymous Internet
https://i2pd.website/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.1 KiB
64 lines
1.1 KiB
10 years ago
|
#ifndef __UPNP_H__
|
||
|
#define __UPNP_H__
|
||
|
|
||
|
#ifdef USE_UPNP
|
||
|
#include <string>
|
||
|
#include <thread>
|
||
|
|
||
|
#include <miniupnpc/miniwget.h>
|
||
|
#include <miniupnpc/miniupnpc.h>
|
||
|
#include <miniupnpc/upnpcommands.h>
|
||
|
#include <miniupnpc/upnperrors.h>
|
||
11 years ago
|
|
||
|
#include <boost/asio.hpp>
|
||
|
|
||
10 years ago
|
#include "util/util.h"
|
||
10 years ago
|
|
||
|
#define I2P_UPNP_TCP 1
|
||
|
#define I2P_UPNP_UDP 2
|
||
|
|
||
11 years ago
|
namespace i2p
|
||
|
{
|
||
10 years ago
|
namespace transport
|
||
10 years ago
|
{
|
||
10 years ago
|
class UPnP
|
||
|
{
|
||
|
public:
|
||
10 years ago
|
|
||
10 years ago
|
UPnP ();
|
||
|
~UPnP ();
|
||
10 years ago
|
void Close ();
|
||
|
|
||
|
void Start ();
|
||
|
void Stop ();
|
||
|
|
||
10 years ago
|
void Discover ();
|
||
|
void TryPortMapping (int type, int port);
|
||
|
void CloseMapping (int type, int port);
|
||
|
private:
|
||
|
void Run ();
|
||
10 years ago
|
|
||
|
std::thread * m_Thread;
|
||
|
struct UPNPUrls m_upnpUrls;
|
||
|
struct IGDdatas m_upnpData;
|
||
|
|
||
|
// For miniupnpc
|
||
|
char * m_MulticastIf = 0;
|
||
|
char * m_Minissdpdpath = 0;
|
||
|
struct UPNPDev * m_Devlist = 0;
|
||
|
char m_NetworkAddr[64];
|
||
|
char m_externalIPAddress[40];
|
||
|
bool m_IsModuleLoaded;
|
||
10 years ago
|
#ifndef _WIN32
|
||
10 years ago
|
void *m_Module;
|
||
10 years ago
|
#else
|
||
10 years ago
|
HINSTANCE m_Module;
|
||
10 years ago
|
#endif
|
||
10 years ago
|
};
|
||
11 years ago
|
}
|
||
10 years ago
|
}
|
||
|
|
||
|
#endif
|
||
11 years ago
|
|
||
|
#endif
|