summaryrefslogtreecommitdiff
path: root/sapsocket.h
diff options
context:
space:
mode:
Diffstat (limited to 'sapsocket.h')
-rw-r--r--sapsocket.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/sapsocket.h b/sapsocket.h
new file mode 100644
index 0000000..e1a9214
--- /dev/null
+++ b/sapsocket.h
@@ -0,0 +1,45 @@
+#ifndef SAPSOCKET_H
+#define SAPSOCKET_H
+
+#include <QtCore/QObject>
+#include <QtCore/QQueue>
+
+class SAPConnection;
+class SAPPeer;
+
+class SAPSocket : public QObject
+{
+ Q_OBJECT
+
+ SAPSocket(SAPConnection *conn, int sessionId);
+
+public:
+ SAPPeer *peer();
+ SAPConnection *connection();
+
+ 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:
+ int _sessionId;
+ bool _open;
+ QQueue<QByteArray> _in;
+
+ friend class SAPPeer;
+};
+
+#endif // SAPSOCKET_H