libktorrent  2.2.0
Classes | Public Member Functions | Protected Attributes | List of all members
bt::PeerInterface Class Referenceabstract

Interface for a Peer. More...

#include <peerinterface.h>

Inheritance diagram for bt::PeerInterface:
Inheritance graph
[legend]

Classes

struct  Stats
 

Public Member Functions

 PeerInterface (const PeerID &peer_id, Uint32 num_chunks)
 
bool areWeChoked () const
 Are we choked for the Peer.
 
bool areWeInterested () const
 Are we interested in the Peer.
 
virtual bt::Uint32 averageDownloadSpeed () const =0
 
virtual void chunkAllowed (bt::Uint32 chunk)=0
 Peer is allowed to download chunk (used for superseeding)
 
const BitSetgetBitSet () const
 Get the Peer's BitSet.
 
TimeStamp getChokeTime () const
 Get the time when this Peer choked us.
 
const PeerIDgetPeerID () const
 Get the Peer's ID.
 
const StatsgetStats () const
 Get the Peer's statistics.
 
TimeStamp getUnchokeTime () const
 Get the time when this Peer unchoked us.
 
virtual void handlePacket (const bt::Uint8 *packet, bt::Uint32 size)=0
 Handle a received packet.
 
bool isChoked () const
 Is the Peer choked.
 
bool isDHTSupported () const
 See if the peer supports DHT.
 
bool isInterested () const
 Is the Peer interested.
 
bool isKilled () const
 See if the peer has been killed.
 
bool isSeeder () const
 See if the peer is a seeder.
 
virtual void kill ()=0
 

Protected Attributes

bool killed
 
bool paused
 
PeerID peer_id
 
BitSet pieces
 
PeerInterface::Stats stats
 

Detailed Description

Author
Joris Guisson This is the interface for a Peer, it allows other classes to get statistics about a Peer, and provides some basic functionality provided by a Peer.

Definition at line 57 of file peerinterface.h.

Constructor & Destructor Documentation

◆ PeerInterface()

bt::PeerInterface::PeerInterface ( const PeerID peer_id,
Uint32  num_chunks 
)

Constructor, initialize the PeerID and the number of chunks

Parameters
peer_idThe PeerID
num_chunksThe number of chunks

Member Function Documentation

◆ averageDownloadSpeed()

virtual bt::Uint32 bt::PeerInterface::averageDownloadSpeed ( ) const
pure virtual

Get the average download speed since the last unchoke in bytes/sec

Implemented in bt::Peer.

◆ kill()

virtual void bt::PeerInterface::kill ( )
pure virtual

Kill the Peer, will ensure the PeerManager closes the connection, and cleans things up.

Implemented in bt::Peer.


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