Files
amnezia-client/ipc/ipcserver.h
T

51 lines
1.6 KiB
C++
Raw Normal View History

2021-02-02 01:47:40 +03:00
#ifndef IPCSERVER_H
#define IPCSERVER_H
2021-02-03 15:42:36 +03:00
#include <QLocalServer>
2021-02-02 01:47:40 +03:00
#include <QObject>
2021-06-01 18:18:09 +03:00
#include <QRemoteObjectNode>
2021-02-02 01:47:40 +03:00
#include "ipc.h"
#include "ipcserverprocess.h"
2021-09-15 08:03:28 -07:00
#include "rep_ipc_interface_source.h"
2021-02-02 01:47:40 +03:00
class IpcServer : public IpcInterfaceSource
{
public:
explicit IpcServer(QObject *parent = nullptr);
virtual int createPrivilegedProcess() override;
2021-02-18 15:00:41 +03:00
virtual int routeAddList(const QString &gw, const QStringList &ips) override;
virtual bool clearSavedRoutes() override;
2021-06-01 18:18:09 +03:00
virtual bool routeDeleteList(const QString &gw, const QStringList &ips) override;
2021-02-18 15:00:41 +03:00
virtual void flushDns() override;
2021-12-15 14:53:07 +03:00
virtual void resetIpStack() override;
2021-02-18 15:00:41 +03:00
virtual bool checkAndInstallDriver() override;
virtual QStringList getTapList() override;
2022-01-30 17:35:57 +03:00
virtual void cleanUp() override;
virtual void setLogsEnabled(bool enabled) override;
virtual bool copyWireguardConfig(const QString &sourcePath) override;
virtual bool isWireguardRunning() override;
virtual bool isWireguardConfigExists(const QString &configPath) override;
2021-02-18 15:00:41 +03:00
2021-02-02 01:47:40 +03:00
private:
int m_localpid = 0;
struct ProcessDescriptor {
ProcessDescriptor (QObject *parent = nullptr) {
serverNode = QSharedPointer<QRemoteObjectHost>(new QRemoteObjectHost(parent));
ipcProcess = QSharedPointer<IpcServerProcess>(new IpcServerProcess(parent));
2021-02-03 15:42:36 +03:00
localServer = QSharedPointer<QLocalServer>(new QLocalServer(parent));
2021-02-02 01:47:40 +03:00
}
2021-06-01 18:18:09 +03:00
2021-02-02 01:47:40 +03:00
QSharedPointer<IpcServerProcess> ipcProcess;
QSharedPointer<QRemoteObjectHost> serverNode;
2021-02-03 15:42:36 +03:00
QSharedPointer<QLocalServer> localServer;
2021-02-02 01:47:40 +03:00
};
QMap<int, ProcessDescriptor> m_processes;
};
#endif // IPCSERVER_H