amnezia-client/client/managementserver.h
pokamest c2a7d66cb4
Release 1.0 (#4)
* Crash fix in management server

* Openvpn scripts fixes
some refactoring

* deploy fix

* Scripts fix for macos

* OpenVpn runtime error codes handling

* MacOS deploy script fix

* easyrsa scripts for MacOS

* Refactoring
Ui improvements
Bug fixes

* new server page fix
2021-01-09 20:08:41 +03:00

45 lines
964 B
C++

#ifndef MANAGEMENTSERVER_H
#define MANAGEMENTSERVER_H
#include <QAbstractSocket>
#include <QPointer>
#include <QSharedPointer>
#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);
QPointer<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:
QSharedPointer<QTcpServer> m_tcpServer;
QPointer<QTcpSocket> m_socket;
};
#endif // MANAGEMENTSERVER_H