diff options
| author | Sebastian | 2010-05-12 19:42:27 +0200 |
|---|---|---|
| committer | Sebastian | 2010-05-12 19:42:27 +0200 |
| commit | ce3329047d378a14006ce74ec273ac59e3375303 (patch) | |
| tree | 782430f270b4c7aca1b35d5b7813518e3797c555 /src/net/pvsClientConnection.h | |
| download | pvs-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.h | 67 |
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 |
