24 #include <QSharedPointer>
25 #include <ktorrent_export.h>
26 #include <util/constants.h>
56 const QByteArray TID = QByteArrayLiteral(
"t");
57 const QByteArray REQ =
"q";
58 const QByteArray RSP =
"r";
59 const QByteArray TYP =
"y";
60 const QByteArray ARG =
"a";
61 const QByteArray ERR_DHT =
"e";
70 RPCMsg(
const QByteArray & mtid, Method m, Type type,
const Key &
id);
73 typedef QSharedPointer<RPCMsg> Ptr;
91 virtual void encode(QByteArray & arr)
const = 0;
113 const QByteArray &
getMTID()
const {
return mtid;}
116 void setMTID(
const QByteArray & m) {mtid = m;}
Type getType() const
Get the type of the message.
const QByteArray & getMTID() const
Get the MTID.
Method getMethod() const
Get the message it's method.
const net::Address & getDestination() const
Get the origin.
Key in the distributed hash table.
const net::Address & getOrigin() const
Get the origin.
void setMTID(const QByteArray &m)
Set the MTID.
virtual void encode(QByteArray &arr) const =0
void setOrigin(const net::Address &o)
Set the origin (i.e. where the message came from)
Represents a dictionary in bencoded data.
const Key & getID() const
Get the id of the sender.
void setDestination(const net::Address &o)
Set the origin (i.e. where the message came from)
virtual void parse(bt::BDictNode *dict)
virtual void apply(DHT *dh_table)=0