Files

62 lines
1.4 KiB
C++
Raw Permalink Normal View History

2021-05-18 23:10:33 +02:00
#ifndef REMOTERUNNER_H
#define REMOTERUNNER_H
#include <QThread>
2021-05-19 12:08:57 +02:00
class Message;
2021-05-18 23:10:33 +02:00
class RemoteRunnerPrivate : public QThread
{
Q_OBJECT
public:
explicit RemoteRunnerPrivate(int inputId);
void closeConnection();
signals:
void receivedMessage(QByteArray data);
protected:
void run();
private:
int m_inputId;
};
2021-08-14 17:13:41 +02:00
/**
2024-02-15 21:33:28 +01:00
* This is part of the biggest chunk of the server. Running at the user,
* communicating with the server that is priviledged via the pipes.
2021-08-14 17:13:41 +02:00
*
2024-02-15 21:33:28 +01:00
* The SecurityManager and the RemoteRunner are this server process (user owned)
* and priviledged there is the Runner class which actually starts the applications.
* A RemoteRunner instance is used to send messages to the priviledged process
* requesting the setup of the namespaces and actually starting the app in there.
2021-08-14 17:13:41 +02:00
*
2024-02-15 21:33:28 +01:00
* Notice that the communication is bi-directional, we have 2 pipes for that.
* Commands go in one direction and (error) messages come back.
2021-08-14 17:13:41 +02:00
*
* As an implementation detail; we use a blocking read (2) to wait for incoming data,
* which is done in a private thread. This class uses Qt signals to keep
* everything thread-safe.
2021-05-18 23:10:33 +02:00
*/
class RemoteRunner : public QObject
{
Q_OBJECT
public:
RemoteRunner(int inputId, int outputId);
~RemoteRunner();
2024-05-17 11:39:44 +02:00
void runRemote(const Message &message) const;
2021-05-19 12:08:57 +02:00
2021-05-18 23:10:33 +02:00
signals:
void receivedMessage(QByteArray data);
private:
RemoteRunnerPrivate m_thread;
int m_outputId;
};
#endif