mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-05-08 14:33:23 +00:00
44 lines
885 B
C++
44 lines
885 B
C++
#ifndef MANAGEMENTSERVER_H
|
|
#define MANAGEMENTSERVER_H
|
|
|
|
#include <QAbstractSocket>
|
|
#include <QString>
|
|
|
|
class QTcpServer;
|
|
class QTcpSocket;
|
|
|
|
class ManagementServer : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit ManagementServer(QObject *parent = nullptr);
|
|
~ManagementServer();
|
|
|
|
bool start(const QString& host, unsigned int port);
|
|
void stop();
|
|
bool isOpen() const;
|
|
|
|
QString readLine();
|
|
qint64 writeCommand(const QString& message);
|
|
|
|
QTcpSocket* socket() const;
|
|
|
|
signals:
|
|
void readyRead();
|
|
void serverStarted();
|
|
|
|
protected slots:
|
|
void onAcceptError(QAbstractSocket::SocketError socketError);
|
|
void onNewConnection();
|
|
void onReadyRead();
|
|
void onSocketDisconnected();
|
|
void onSocketError(QAbstractSocket::SocketError socketError);
|
|
|
|
protected:
|
|
QTcpServer* m_tcpServer;
|
|
QTcpSocket* m_socket;
|
|
};
|
|
|
|
#endif // MANAGEMENTSERVER_H
|