kopete/protocols/messenger/libpapillon
messengercoreprotocol.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef MESSANGERCOREPROTOCOL_H
00020 #define MESSANGERCOREPROTOCOL_H
00021
00022 #include <QtCore/QObject>
00023 #include <QtCore/QByteArray>
00024
00025 #include <Papillon/Macros>
00026
00027 class QDataStream;
00028
00029 namespace Papillon
00030 {
00031
00032 class NetworkMessage;
00033
00044 class PAPILLON_EXPORT MessengerCoreProtocol : public QObject
00045 {
00046 Q_OBJECT
00047 public:
00051 enum State
00052 {
00056 NeedMore,
00060 Available,
00064 NoData,
00068 WaitForPayload
00069 };
00070
00074 MessengerCoreProtocol();
00078 virtual ~MessengerCoreProtocol();
00079
00083 void reset();
00084
00091 void addIncomingData(const QByteArray &incomingBytes);
00092
00098 NetworkMessage *incomingNetworkMessage();
00099
00105 void outgoingNetworkMessage(NetworkMessage *outgoing);
00106
00112 int state();
00113
00114 signals:
00119 void outgoingData(const QByteArray &data);
00120
00124 void incomingData();
00125
00126 protected:
00131 bool okToProceed(const QDataStream &din);
00137 int rawToNetworkMessage(const QByteArray &raw);
00138
00143 bool isPayloadCommand(const QString &command);
00144
00145 private:
00146 class Private;
00147 Private *d;
00148 };
00149
00150 }
00151
00152 #endif // MESSANGERCOREPROTOCOL_H