libktorrent  2.2.0
errmsg.h
1 /***************************************************************************
2  * Copyright (C) 2012 by Joris Guisson *
3  * joris.guisson@gmail.com *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19  ***************************************************************************/
20 
21 #ifndef DHT_ERRMSG_H
22 #define DHT_ERRMSG_H
23 
24 #include "rpcmsg.h"
25 
26 namespace dht
27 {
28 
32  class KTORRENT_EXPORT ErrMsg : public RPCMsg
33  {
34  public:
35  ErrMsg();
36  ErrMsg(const QByteArray& mtid, const dht::Key& id, const QString& msg);
37  ~ErrMsg() override;
38 
39  void apply(DHT* dh_table) override;
40  void print() override;
41  void encode(QByteArray & arr) const override;
42  void parse(bt::BDictNode* dict) override;
43 
45  const QString & message() const {return msg;}
46 
47  typedef QSharedPointer<ErrMsg> Ptr;
48  private:
49  QString msg;
50  };
51 }
52 
53 #endif // DHT_ERRMSG_H
dht::ErrMsg
Definition: errmsg.h:33
dht::ErrMsg::print
void print() override
dht::ErrMsg::encode
void encode(QByteArray &arr) const override
dht::ErrMsg::parse
void parse(bt::BDictNode *dict) override
dht::Key
Key in the distributed hash table.
Definition: key.h:39
dht::ErrMsg::message
const QString & message() const
Get the error message.
Definition: errmsg.h:45
dht::ErrMsg::apply
void apply(DHT *dh_table) override
dht::RPCMsg
Definition: rpcmsg.h:70
bt::BDictNode
Represents a dictionary in bencoded data.
Definition: bnode.h:101
dht::DHT
Definition: dht.h:63