-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathnetproxysettings.h
62 lines (52 loc) · 1.43 KB
/
netproxysettings.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
54
55
56
57
58
59
60
61
62
#ifndef NETPROXYSETTINGS_H
#define NETPROXYSETTINGS_H
#include "settings.h"
#include <QDialog>
#include <QTcpServer>
#include <QTcpSocket>
#include <QUdpSocket>
namespace Ui
{
class NetProxySettings;
}
class NetProxySettings : public QDialog
{
Q_OBJECT
public:
enum en_led { LED_UDP_EN, LED_UDP_TX, LED_UDP_RX, LED_TCP_EN, LED_TCP_TX, LED_TCP_RX, NUMBER_OF_LEDS };
explicit NetProxySettings(Settings *settings, QWidget *parent = 0);
~NetProxySettings();
signals:
void sendCmd(QByteArray);
void ledSetValue(NetProxySettings::en_led, bool);
void udpStatus(bool, QString);
void tcpStatus(bool, QString);
public slots:
void proxyCmd(QByteArray); /* data netproxy plugin -> UDP */
void bindUdp();
void unbindUdp();
void startTcpServer();
void stopTcpServer();
private slots:
void formClose();
void recvUDP();
void addTcpClient();
void removeTcpClient();
void recvTCP();
void errorUdpSocket(QAbstractSocket::SocketError);
void errorTcpSocket(QAbstractSocket::SocketError);
private:
Settings *m_settings;
Ui::NetProxySettings *ui;
QUdpSocket *m_udp;
QHostAddress m_udp_remote_addr;
qint16 m_udp_remote_port;
QTcpServer *m_tcp;
QList<QTcpSocket *> m_tcpClients;
void helpMsgUdp(void);
void helpMsgTcp(void);
void getLocalIp();
bool CheckIpAddress(QHostAddress *addr);
bool CheckPort(quint16 port);
};
#endif // NETPROXYSETTINGS_H