File indexing completed on 2025-01-05 04:37:10

0001 /*
0002     SPDX-FileCopyrightText: 2012 Joris Guisson <joris.guisson@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef DHT_ERRMSG_H
0008 #define DHT_ERRMSG_H
0009 
0010 #include "rpcmsg.h"
0011 
0012 namespace dht
0013 {
0014 /**
0015  * Error message in the DHT protocol
0016  */
0017 class KTORRENT_EXPORT ErrMsg : public RPCMsg
0018 {
0019 public:
0020     ErrMsg();
0021     ErrMsg(const QByteArray &mtid, const dht::Key &id, const QString &msg);
0022     ~ErrMsg() override;
0023 
0024     void apply(DHT *dh_table) override;
0025     void print() override;
0026     void encode(QByteArray &arr) const override;
0027     void parse(bt::BDictNode *dict) override;
0028 
0029     /// Get the error message
0030     const QString &message() const
0031     {
0032         return msg;
0033     }
0034 
0035     typedef QSharedPointer<ErrMsg> Ptr;
0036 
0037 private:
0038     QString msg;
0039 };
0040 }
0041 
0042 #endif // DHT_ERRMSG_H