Files
amnezia-client/service/server/router_win.h
T

75 lines
1.7 KiB
C++
Raw Normal View History

2021-02-21 09:44:53 -08:00
#ifndef ROUTERWIN_H
#define ROUTERWIN_H
#include <QTimer>
#include <QString>
#include <QSettings>
#include <QHash>
#include <QDebug>
#include <QObject>
#include <QNetworkInterface>
2021-02-21 09:44:53 -08:00
2024-03-27 11:02:34 +00:00
#include "../client/platforms/windows/daemon/dnsutilswindows.h"
2021-02-21 09:44:53 -08:00
#include <WinSock2.h> //includes Windows.h
#include <WS2tcpip.h>
#include <iphlpapi.h>
#include <IcmpAPI.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
2021-06-01 18:18:09 +03:00
//typedef uint8_t u8_t ;
2021-02-21 09:44:53 -08:00
2021-06-01 18:18:09 +03:00
//#ifndef WIN32_LEAN_AND_MEAN
//#define WIN32_LEAN_AND_MEAN
//#endif
2021-02-21 09:44:53 -08:00
/**
* @brief The Router class - General class for handling ip routing
*/
class RouterWin : public QObject
{
Q_OBJECT
public:
static RouterWin& Instance();
int routeAddList(const QString &gw, const QStringList &ips);
bool clearSavedRoutes();
2021-06-01 18:18:09 +03:00
int routeDeleteList(const QString &gw, const QStringList &ips);
2025-11-30 18:49:16 -08:00
bool flushDns();
2021-12-15 14:53:07 +03:00
void resetIpStack();
2021-02-21 09:44:53 -08:00
2025-11-30 18:49:16 -08:00
bool StartRoutingIpv6();
bool StopRoutingIpv6();
2024-03-27 11:02:34 +00:00
bool createTun(const QString &dev, const QString &subnet);
2021-06-01 18:18:09 +03:00
void suspendWcmSvc(bool suspend);
2024-03-27 11:02:34 +00:00
bool updateResolvers(const QString& ifname, const QList<QHostAddress>& resolvers);
2025-10-02 14:58:53 +02:00
bool restoreResolvers();
2021-02-21 09:44:53 -08:00
private:
static QList<QString> kIpv6Subnets;
2021-02-21 09:44:53 -08:00
RouterWin(RouterWin const &) = delete;
RouterWin& operator= (RouterWin const&) = delete;
2021-06-01 18:18:09 +03:00
DWORD GetServicePid(LPCWSTR serviceName);
BOOL ListProcessThreads(DWORD dwOwnerPID);
BOOL EnableDebugPrivilege();
BOOL InitNtFunctions();
BOOL SuspendProcess(BOOL fSuspend, DWORD dwProcessId);
QNetworkInterface findLoopbackIface();
2021-06-01 18:18:09 +03:00
private:
2024-03-27 11:02:34 +00:00
RouterWin() {m_dnsUtil = new DnsUtilsWindows(this);}
QMultiMap<QString, MIB_IPFORWARDROW> m_ipForwardRows;
2021-06-01 18:18:09 +03:00
bool m_suspended = false;
2024-03-27 11:02:34 +00:00
DnsUtilsWindows *m_dnsUtil;
2021-02-21 09:44:53 -08:00
};
#endif // ROUTERWIN_H