libktorrent  2.1.1
Signals | Public Member Functions | Protected Attributes | List of all members
dht::DHTBase Class Referenceabstract

#include <dhtbase.h>

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

Signals

void started ()
 
void stopped ()
 

Public Member Functions

virtual void addDHTNode (const QString &host, bt::Uint16 hport)=0
 
virtual AnnounceTaskannounce (const bt::SHA1Hash &info_hash, bt::Uint16 port)=0
 
virtual QMap< QString, int > getClosestGoodNodes (int maxNodes)=0
 
bt::Uint16 getPort () const
 Get the DHT port.
 
const dht::StatsgetStats () const
 Get statistics about the DHT.
 
bool isRunning () const
 
virtual void portReceived (const QString &ip, bt::Uint16 port)=0
 
virtual void start (const QString &table, const QString &key_file, bt::Uint16 port)=0
 
virtual void stop ()=0
 
virtual void update ()=0
 

Protected Attributes

bt::Uint16 port
 
bool running
 
dht::Stats stats
 

Detailed Description

Author
Joris Guisson joris.nosp@m..gui.nosp@m.sson@.nosp@m.gmai.nosp@m.l.com

Interface for DHT class, this is to keep other things separate from the inner workings of the DHT.

Definition at line 52 of file dhtbase.h.

Member Function Documentation

◆ addDHTNode()

virtual void dht::DHTBase::addDHTNode ( const QString &  host,
bt::Uint16  hport 
)
pure virtual

Add a DHT node. This node shall be pinged immediately.

Parameters
hostThe hostname or ip
hportThe port of the host

Implemented in dht::DHT.

◆ announce()

virtual AnnounceTask* dht::DHTBase::announce ( const bt::SHA1Hash info_hash,
bt::Uint16  port 
)
pure virtual

Do an announce on the DHT network

Parameters
info_hashThe info_hash
portThe port
Returns
The task which handles this

Implemented in dht::DHT.

◆ getClosestGoodNodes()

virtual QMap<QString, int> dht::DHTBase::getClosestGoodNodes ( int  maxNodes)
pure virtual

Returns maxNodes number of <IP address, port> nodes that are closest to ourselves and are good.

Parameters
maxNodesmaximum nr of nodes in QMap to return.

Implemented in dht::DHT.

◆ isRunning()

bool dht::DHTBase::isRunning ( ) const
inline

See if the DHT is running.

Definition at line 96 of file dhtbase.h.

◆ portReceived()

virtual void dht::DHTBase::portReceived ( const QString &  ip,
bt::Uint16  port 
)
pure virtual

A Peer has received a PORT message, and uses this function to alert the DHT of it.

Parameters
ipThe IP of the peer
portThe port in the PORT message

Implemented in dht::DHT.

◆ start()

virtual void dht::DHTBase::start ( const QString &  table,
const QString &  key_file,
bt::Uint16  port 
)
pure virtual

Start the DHT

Parameters
tableFile where the save table is located
key_fileWhere our DHT key is stored
portThe port to use

Implemented in dht::DHT.

◆ stop()

virtual void dht::DHTBase::stop ( )
pure virtual

Stop the DHT

Implemented in dht::DHT.

◆ update()

virtual void dht::DHTBase::update ( )
pure virtual

Update the DHT


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