This repository has been archived on 2026-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
2018-08-09 22:20:59 +02:00

49 lines
1.1 KiB
C++

#ifndef PROXYSERVER_H
#define PROXYSERVER_H
#include <QUuid>
#include <QHash>
#include <QObject>
#include "proxyclient.h"
#include "jsonrpcserver.h"
#include "transportinterface.h"
namespace remoteproxy {
class ProxyServer : public QObject
{
Q_OBJECT
public:
explicit ProxyServer(QObject *parent = nullptr);
~ProxyServer();
void registerTransportInterface(TransportInterface *interface);
private:
JsonRpcServer *m_jsonRpcServer = nullptr;
QList<TransportInterface *> m_transportInterfaces;
QHash<QUuid, ProxyClient *> m_proxyClients;
QHash<QString, ProxyClient *> m_authenticatedClients;
void sendResponse(TransportInterface *interface, const QUuid &clientId, const QVariantMap &response = QVariantMap());
private slots:
void onClientConnected(const QUuid &clientId);
void onClientDisconnected(const QUuid &clientId);
void onClientDataAvailable(const QUuid &clientId, const QByteArray &data);
void onProxyClientAuthenticated();
void onProxyClientTunnelConnected();
public slots:
void startServer();
void stopServer();
};
}
#endif // PROXYSERVER_H