2018-03-03 14:09:29 +08:00
|
|
|
|
#ifndef FILETRANSFERPROTOCOL_H
|
2017-10-17 21:45:34 +08:00
|
|
|
|
#define FILETRANSFERPROTOCOL_H
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
#include <qqtmessage.h>
|
|
|
|
|
#include <qqtprotocol.h>
|
|
|
|
|
|
2017-11-12 21:04:23 +08:00
|
|
|
|
class FiletransferMessage: public QQtMessage
|
2017-10-17 21:45:34 +08:00
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
2018-03-03 14:09:29 +08:00
|
|
|
|
explicit FiletransferMessage ( QObject* parent = 0 ) : QQtMessage ( parent ) {}
|
2017-10-17 21:45:34 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// QQTMessage interface
|
|
|
|
|
public:
|
2018-03-03 14:09:29 +08:00
|
|
|
|
virtual void parser ( const QByteArray& l ) override {
|
2017-10-17 21:45:34 +08:00
|
|
|
|
}
|
2018-03-03 14:09:29 +08:00
|
|
|
|
virtual void packer ( QByteArray& l ) const override {
|
2017-10-17 21:45:34 +08:00
|
|
|
|
}
|
|
|
|
|
private:
|
|
|
|
|
quint16 header;
|
|
|
|
|
QByteArray body;
|
|
|
|
|
quint32 tail;
|
|
|
|
|
};
|
|
|
|
|
|
2017-11-12 21:04:23 +08:00
|
|
|
|
class FiletransferProtocol : public QQtProtocol
|
2017-10-17 21:45:34 +08:00
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
2018-03-03 14:09:29 +08:00
|
|
|
|
explicit FiletransferProtocol ( QObject* parent = nullptr );
|
2017-10-17 21:45:34 +08:00
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // FILETRANSFERPROTOCOL_H
|