summaryrefslogtreecommitdiffstats
path: root/src/net/pvsClientConnection.h
diff options
context:
space:
mode:
authorSebastian2010-05-12 19:42:27 +0200
committerSebastian2010-05-12 19:42:27 +0200
commitce3329047d378a14006ce74ec273ac59e3375303 (patch)
tree782430f270b4c7aca1b35d5b7813518e3797c555 /src/net/pvsClientConnection.h
downloadpvs-ce3329047d378a14006ce74ec273ac59e3375303.tar.gz
pvs-ce3329047d378a14006ce74ec273ac59e3375303.tar.xz
pvs-ce3329047d378a14006ce74ec273ac59e3375303.zip
initial import of latest svn version
Diffstat (limited to 'src/net/pvsClientConnection.h')
-rw-r--r--src/net/pvsClientConnection.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/net/pvsClientConnection.h b/src/net/pvsClientConnection.h
new file mode 100644
index 0000000..cfbf98e
--- /dev/null
+++ b/src/net/pvsClientConnection.h
@@ -0,0 +1,67 @@
+/**
+ * PVSClientConnection
+ *
+ * holds and maintains a Connection made from/to a PVSServerConnection (or derivate)
+ * PVSClientConnections are created by the PVSListenServer if a PVSCLientConnection is accepted
+ *
+ */
+
+#include "pvsMsg.h"
+
+#include <QtNetwork/QSslSocket>
+
+
+#ifndef _PVSCLIENTCONNECTION_H_
+#define _PVSCLIENTCONNECTION_H_
+
+class PVSListenServer;
+
+class PVSClientConnection : public QObject
+{
+ Q_OBJECT
+
+public:
+ //C'Tor
+ PVSClientConnection(PVSListenServer* server, QSslSocket* sock = NULL);
+ // D'Tor
+ ~PVSClientConnection();
+
+ void closeConnection();
+ bool isConnected()
+ {
+ return _socket != NULL && _socket->state() == QAbstractSocket::ConnectedState;
+ }
+ time_t lastData()
+ {
+ return _lastData;
+ }
+
+ //void push_back_receive(PVSMsg newMsg);
+ bool push_back_send(PVSMsg newMsg);
+ QSslSocket* getSocket();
+
+ int getID() { return _id; }
+ void setID(unsigned int id);
+ void setServerID(unsigned int id) { _serverId = id; }
+
+ QString getAddress();
+ void setUsername(QString username);
+ QString getNameUser();
+ void ping();
+
+private Q_SLOTS:
+ void sock_dataArrival();
+ void sock_closed();
+ void sock_error(QAbstractSocket::SocketError errcode);
+
+private:
+ QSslSocket *_socket;
+ int _id;
+ unsigned int _serverId;
+ PVSMsg *_incomplete;
+ PVSListenServer *_server;
+ bool _toldDisconnect;
+ time_t _lastData;
+};
+
+#endif