mirror of
https://github.com/QuasarApp/Snake.git
synced 2025-04-27 10:14:39 +00:00
44 lines
869 B
C++
44 lines
869 B
C++
#ifndef CONNECTIONINFO_H
|
|
#define CONNECTIONINFO_H
|
|
|
|
#include "rsakeyspool.h"
|
|
|
|
|
|
class QTcpSocket;
|
|
namespace ClientProtocol {
|
|
|
|
#define NOT_VALID_CARMA 0xFF
|
|
#define DEFAULT_KARMA 100
|
|
#define RESTORE_KARMA 20
|
|
#define BANED_KARMA 0
|
|
|
|
class Connectioninfo {
|
|
|
|
QTcpSocket *sct = nullptr;
|
|
int karma = DEFAULT_KARMA;
|
|
RSAKeyPair RSAKey;
|
|
|
|
public:
|
|
void disconnect();
|
|
|
|
void ban();
|
|
bool isBaned() const;
|
|
void unBan();
|
|
|
|
bool isValid() const;
|
|
|
|
Connectioninfo(QTcpSocket * tcp = nullptr,
|
|
int kar = NOT_VALID_CARMA,
|
|
RSAKeyPair keys = RSAKeyPair());
|
|
~Connectioninfo();
|
|
|
|
int getKarma() const;
|
|
void setKarma(int value);
|
|
RSAKeyPair getRSAKey() const;
|
|
void setRSAKey(const RSAKeyPair &value);
|
|
QTcpSocket *getSct() const;
|
|
void setSct(QTcpSocket *value);
|
|
};
|
|
}
|
|
#endif // CONNECTIONINFO_H
|