libktorrent  2.2.0
Public Types | Public Member Functions | Protected Attributes | List of all members
dht::RPCMsg Class Referenceabstract

#include <rpcmsg.h>

Inheritance diagram for dht::RPCMsg:
Inheritance graph
[legend]

Public Types

typedef QSharedPointer< RPCMsgPtr
 

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::AddressgetDestination () const
 Get the origin.
 
const KeygetID () 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::AddressgetOrigin () 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
 

Detailed Description

Base class for all RPC messages.

Definition at line 69 of file rpcmsg.h.

Member Function Documentation

◆ apply()

virtual void dht::RPCMsg::apply ( DHT dh_table)
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)

Parameters
dh_tablePointer to DHT

Implemented in dht::GetPeersReq, dht::FindNodeRsp, dht::GetPeersRsp, dht::AnnounceReq, dht::FindNodeReq, dht::PingRsp, dht::AnnounceRsp, dht::ErrMsg, and dht::PingReq.

◆ encode()

virtual void dht::RPCMsg::encode ( QByteArray &  arr) const
pure virtual

◆ parse()

virtual void dht::RPCMsg::parse ( bt::BDictNode dict)
virtual

Parse the message

Parameters
dictData dictionary
Exceptions
bt::Errorwhen something goes wrong

Reimplemented in dht::GetPeersReq, dht::FindNodeRsp, dht::GetPeersRsp, dht::AnnounceReq, dht::FindNodeReq, dht::AnnounceRsp, and dht::ErrMsg.

◆ print()

virtual void dht::RPCMsg::print ( )
pure virtual

The documentation for this class was generated from the following file: