24 #include <QSharedPointer>
25 #include <ktorrent_export.h>
26 #include <util/constants.h>
38 #define MAX_TOKEN_SIZE 40
59 const QByteArray TID = QByteArrayLiteral(
"t");
60 const QByteArray REQ =
"q";
61 const QByteArray RSP =
"r";
62 const QByteArray TYP =
"y";
63 const QByteArray ARG =
"a";
64 const QByteArray ERR_DHT =
"e";
73 RPCMsg(
const QByteArray & mtid, Method m, Type type,
const Key &
id);
76 typedef QSharedPointer<RPCMsg> Ptr;
94 virtual void encode(QByteArray & arr)
const = 0;
116 const QByteArray &
getMTID()
const {
return mtid;}
119 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