-
Notifications
You must be signed in to change notification settings - Fork 0
/
portmanager.h
53 lines (47 loc) · 1.07 KB
/
portmanager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef PORTMANAGER_H
#define PORTMANAGER_H
#include <QObject>
#include <miniupnpc/upnpcommands.h>
#include <miniupnpc/miniupnpc.h>
#ifdef Q_OS_WIN
#include <winsock2.h>
#endif
class PortManager : public QObject
{
Q_OBJECT
public:
explicit PortManager(QObject *parent = nullptr);
virtual ~PortManager();
public slots:
void discover();
void openPort();
void closePort();
signals:
void discoveryFinished(int);
void openingFinished(int);
void closingFinished(int);
private:
char lanaddr[64] = "unset";
const char * multicastif = 0;
const char * minissdpdpath = 0;
const char * description = "RVGL Companion";
#ifdef UPNP_LOCAL_PORT_ANY
int localport = UPNP_LOCAL_PORT_ANY;
#else
int localport = 0;
#endif
int error = 0;
int ipv6 = 0;
const char * port = "2310";
const char * protocol = "UDP";
int timeout = 2000;
unsigned char ttl = 2;
struct UPNPDev * devlist = 0;
struct UPNPUrls urls;
struct IGDdatas data;
#ifdef Q_OS_WIN
WSADATA wsaData;
int nResult;
#endif
};
#endif // PORTMANAGER_H