libktorrent  2.2.0
Public Member Functions | List of all members
dht::DHT Class Reference

#include <dht.h>

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

Public Member Functions

void addDHTNode (const QString &host, bt::Uint16 hport) override
 
void announce (const AnnounceReq &r)
 
AnnounceTaskannounce (const bt::SHA1Hash &info_hash, bt::Uint16 port) override
 
void bootstrap ()
 Bootstrap from well-known nodes.
 
bool canStartTask () const
 See if it is possible to start a task.
 
void error (const ErrMsg &r)
 
NodeLookupfindNode (const dht::Key &id)
 
void findNode (const FindNodeReq &r)
 
NodeLookupfindOwnNode ()
 Do a findNode for our node id.
 
QMap< QString, int > getClosestGoodNodes (int maxNodes) override
 
void getPeers (const GetPeersReq &r)
 
void ping (const PingReq &r)
 
void portReceived (const QString &ip, bt::Uint16 port) override
 
NodeLookuprefreshBucket (const dht::Key &id, KBucket &bucket)
 
void response (const RPCMsg &r)
 
void start (const QString &table, const QString &key_file, bt::Uint16 port) override
 
void stop () override
 
void timeout (RPCMsg::Ptr r)
 
- Public Member Functions inherited from dht::DHTBase
bt::Uint16 getPort () const
 Get the DHT port.
 
const dht::StatsgetStats () const
 Get statistics about the DHT.
 
bool isRunning () const
 
virtual void update ()=0
 

Additional Inherited Members

- Signals inherited from dht::DHTBase
void started ()
 
void stopped ()
 
- Protected Attributes inherited from dht::DHTBase
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

Definition at line 62 of file dht.h.

Member Function Documentation

◆ addDHTNode()

void dht::DHT::addDHTNode ( const QString &  host,
bt::Uint16  hport 
)
overridevirtual

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

Parameters
hostThe hostname or ip
hportThe port of the host

Implements dht::DHTBase.

◆ announce()

AnnounceTask* dht::DHT::announce ( const bt::SHA1Hash info_hash,
bt::Uint16  port 
)
overridevirtual

Do an announce on the DHT network

Parameters
info_hashThe info_hash
portThe port
Returns
The task which handles this

Implements dht::DHTBase.

◆ findNode()

NodeLookup* dht::DHT::findNode ( const dht::Key id)

Do a NodeLookup.

Parameters
idThe id of the key to search

◆ getClosestGoodNodes()

QMap<QString, int> dht::DHT::getClosestGoodNodes ( int  maxNodes)
overridevirtual

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.

Implements dht::DHTBase.

◆ portReceived()

void dht::DHT::portReceived ( const QString &  ip,
bt::Uint16  port 
)
overridevirtual

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

Implements dht::DHTBase.

◆ refreshBucket()

NodeLookup* dht::DHT::refreshBucket ( const dht::Key id,
KBucket bucket 
)

Refresh a bucket using a find node task.

Parameters
idThe id
bucketThe bucket to refresh

◆ start()

void dht::DHT::start ( const QString &  table,
const QString &  key_file,
bt::Uint16  port 
)
overridevirtual

Start the DHT

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

Implements dht::DHTBase.

◆ stop()

void dht::DHT::stop ( )
overridevirtual

Stop the DHT

Implements dht::DHTBase.


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