summaryrefslogtreecommitdiffstats
path: root/src/client/net/serverconnection.h
diff options
context:
space:
mode:
authorsr2013-02-04 19:50:31 +0100
committersr2013-02-04 19:50:31 +0100
commit1a5709501f94014d41987b956338bb6424b9f90c (patch)
treed3b93fe8dc406bca56aff147ef5cc4cbf9ed6be0 /src/client/net/serverconnection.h
parentTest (diff)
downloadpvs2-1a5709501f94014d41987b956338bb6424b9f90c.tar.gz
pvs2-1a5709501f94014d41987b956338bb6424b9f90c.tar.xz
pvs2-1a5709501f94014d41987b956338bb6424b9f90c.zip
Initial commit
Diffstat (limited to 'src/client/net/serverconnection.h')
-rw-r--r--src/client/net/serverconnection.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/client/net/serverconnection.h b/src/client/net/serverconnection.h
new file mode 100644
index 0000000..afb8204
--- /dev/null
+++ b/src/client/net/serverconnection.h
@@ -0,0 +1,62 @@
+#ifndef _PVSSERVERCONNECTION_H_
+#define _PVSSERVERCONNECTION_H_
+
+#include <QSslSocket>
+#include "../../shared/networkmessage.h"
+#include "../connectwindow/connectwindow.h"
+
+class BlankScreen;
+
+class ServerConnection : public QObject
+{
+Q_OBJECT
+
+private:
+ QSslSocket *_socket;
+ BlankScreen *_blank;
+ int _timerId;
+ int _jpegQuality;
+ int _authed;
+
+ NetworkMessage _fromServer, _toServer;
+ QByteArray _expectedFingerprint;
+ QString _passwd;
+ QByteArray _myChallenge;
+ QByteArray _sessionName;
+ QByteArray _certHash;
+
+ void handleMsg();
+
+public:
+ ServerConnection(const QString& host, const quint16 port, const QByteArray& sessionName, const QByteArray& certHash);
+ void disconnectFromServer();
+ ~ServerConnection();
+ const inline bool isConnected() const
+ {
+ return _socket != NULL && _socket->state() == QAbstractSocket::ConnectedState;
+ }
+
+ void sendMessage(NetworkMessage& message);
+
+protected:
+ void timerEvent(QTimerEvent *event);
+
+private slots:
+ void sslErrors(const QList<QSslError> & errors); // triggered for errors that occur during SSL negotiation
+ void sock_dataArrival(); // triggered if data is available for reading
+ void sock_closed(); // triggered if the socket is closed
+ void sock_error(QAbstractSocket::SocketError errcode); // triggered if an error occurs on the socket
+ void sock_connected(); // triggered if the connection is established and ready to use
+
+ void onVncServerStartStop(int port, QString& ropass, QString& rwpass); // triggered if the local vnc server was started
+
+ void onVncViewerStartStop(const bool started, const int clientId);
+
+signals:
+ void openVnc(const QString& host, int port, const QString& passwd, bool ro, bool fullscreen, const QString& caption, const int clientId);
+ void closeVnc();
+ void stateChange(ConnectWindow::ConnectionState state);
+
+};
+
+#endif