From ce3329047d378a14006ce74ec273ac59e3375303 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 12 May 2010 19:42:27 +0200 Subject: initial import of latest svn version --- src/net/pvsClientConnection.h | 67 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 src/net/pvsClientConnection.h (limited to 'src/net/pvsClientConnection.h') 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 + + +#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 -- cgit v1.2.3-55-g7522