12 #ifndef CXSOCKETCONNECTION_H
13 #define CXSOCKETCONNECTION_H
19 #include "boost/shared_ptr.hpp"
37 #define assertRunningInObjectThread() \
39 if (QThread::currentThread()!=this->thread()) \
42 << QString("Method should be called in the object's thread [%1] only, current thread = [%2]") \
43 .arg(this->thread()->objectName()) \
44 .arg(QThread::currentThread()->objectName()); \
68 bool isServer()
const;
69 bool isClient()
const;
70 bool isLocalhostConnection()
const;
71 QString getDescription()
const;
82 virtual void requestConnect();
83 virtual void requestDisconnect();
86 bool sendData(
const char* data, qint64 maxSize);
89 void connectionInfoChanged();
96 void internalConnected();
97 void internalDisconnected();
98 void internalError(QAbstractSocket::SocketError socketError);
99 virtual void internalDataAvailable() = 0;
102 virtual void setProtocol(QString protocolname) = 0;
104 bool socketIsConnected();
105 bool enoughBytesAvailableOnSocket(
int bytes)
const;
106 bool socketReceive(
void *packPointer,
int packSize)
const;
107 QStringList getAllServerHostnames();
108 void setCurrentConnectionInfo();
124 #endif // CXSOCKETCONNECTION_H