blob: 38d83ea6503850be29648ba08e38b56e40ecbae3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#ifndef SAPSOCKET_H
#define SAPSOCKET_H
#include <QtCore/QObject>
#include <QtCore/QQueue>
#include "sapchannelinfo.h"
class SAPConnection;
class SAPPeer;
class SAPSocket : public QObject
{
Q_OBJECT
SAPSocket(SAPConnection *conn, int sessionId, const SAPChannelInfo &chanInfo);
public:
SAPPeer *peer();
SAPConnection *connection();
SAPChannelInfo channelInfo() const;
bool isOpen() const;
bool messageAvailable() const;
QByteArray receive();
bool send(const QByteArray &data);
signals:
void connected();
void disconnected();
void messageReceived();
protected:
void setOpen(bool open);
void acceptIncomingData(const QByteArray &data);
int sessionId() const;
private:
bool isReliable() const;
bool isWithSeqNum() const;
private:
const int _sessionId;
const SAPChannelInfo _info;
bool _open;
QQueue<QByteArray> _in;
quint16 _seqNum;
quint16 _expectedSeqNum;
friend class SAPPeer;
};
#endif // SAPSOCKET_H
|