libktorrent
2.2.0
|
#include <rpcmsg.h>
Public Types | |
typedef QSharedPointer< RPCMsg > | Ptr |
Public Member Functions | |
RPCMsg (const QByteArray &mtid, Method m, Type type, const Key &id) | |
virtual void | apply (DHT *dh_table)=0 |
virtual void | encode (QByteArray &arr) const =0 |
const net::Address & | getDestination () const |
Get the origin. | |
const Key & | getID () const |
Get the id of the sender. | |
Method | getMethod () const |
Get the message it's method. | |
const QByteArray & | getMTID () const |
Get the MTID. | |
const net::Address & | getOrigin () const |
Get the origin. | |
Type | getType () const |
Get the type of the message. | |
virtual void | parse (bt::BDictNode *dict) |
virtual void | print ()=0 |
void | setDestination (const net::Address &o) |
Set the origin (i.e. where the message came from) | |
void | setMTID (const QByteArray &m) |
Set the MTID. | |
void | setOrigin (const net::Address &o) |
Set the origin (i.e. where the message came from) | |
Protected Attributes | |
Key | id |
Method | method |
QByteArray | mtid |
net::Address | origin |
Type | type |
|
pure virtual |
When this message arrives this function will be called upon the DHT. The message should then call the appropriate DHT function (double dispatch)
dh_table | Pointer to DHT |
Implemented in dht::GetPeersReq, dht::FindNodeRsp, dht::GetPeersRsp, dht::AnnounceReq, dht::FindNodeReq, dht::PingRsp, dht::AnnounceRsp, dht::ErrMsg, and dht::PingReq.
|
pure virtual |
BEncode the message.
arr | Data array |
Implemented in dht::GetPeersReq, dht::FindNodeRsp, dht::GetPeersRsp, dht::AnnounceReq, dht::FindNodeReq, dht::PingRsp, dht::AnnounceRsp, dht::ErrMsg, and dht::PingReq.
|
virtual |
Parse the message
dict | Data dictionary |
bt::Error | when something goes wrong |
Reimplemented in dht::GetPeersReq, dht::FindNodeRsp, dht::GetPeersRsp, dht::AnnounceReq, dht::FindNodeReq, dht::AnnounceRsp, and dht::ErrMsg.
|
pure virtual |
Print the message for debugging purposes.
Implemented in dht::GetPeersReq, dht::FindNodeRsp, dht::GetPeersRsp, dht::AnnounceReq, dht::FindNodeReq, dht::PingRsp, dht::AnnounceRsp, dht::ErrMsg, and dht::PingReq.