20 #ifndef BTPEERINTERFACE_H
21 #define BTPEERINTERFACE_H
23 #include <ktorrent_export.h>
24 #include <util/constants.h>
25 #include <util/bitset.h>
26 #include <peer/peerid.h>
106 QString
address()
const {
return hostname.isEmpty() ? ip_address : hostname;}
141 bool areWeChoked()
const {
return !stats.has_upload_slot || paused;}
159 virtual void handlePacket(
const bt::Uint8* packet, bt::Uint32 size) = 0;
Simple implementation of a BitSet.
bt::Uint64 bytes_downloaded
Amount of data downloaded.
bool isInterested() const
Is the Peer interested.
bt::TransportProtocol transport_protocol
The transport protocol used by the peer.
QString address() const
Get the address of the peer (hostname if it is valid, IP otherwise)
bool extension_protocol
Whether or not the peer supports the extension protocol.
bt::Uint32 max_request_queue
Max number of outstanding requests (reqq in extended protocol handshake)
bool local
Is this a peer on the local network.
bool areWeInterested() const
Are we interested in the Peer.
float perc_of_file
Percentage of file which the peer has.
bool am_interested
Am I interested in the peer.
const BitSet & getBitSet() const
Get the Peer's BitSet.
bt::Uint32 download_rate
Download rate (bytes/s)
bool encrypted
Whether or not this connection is encrypted.
bt::Uint32 upload_rate
Upload rate (bytes/s)
double aca_score
Advanced choke algorithm score.
bool snubbed
Snubbed or not (i.e. we haven't received a piece for a minute)
bool isDHTSupported() const
See if the peer supports DHT.
TimeStamp time_unchoked
Time the peer unchoked us.
bool dht_support
Does this peer support DHT.
TimeStamp getUnchokeTime() const
Get the time when this Peer unchoked us.
PeerInterface(const PeerID &peer_id, Uint32 num_chunks)
QString client
The client (Azureus, BitComet, ...)
bool interested
Is the peer interested.
bool isKilled() const
See if the peer has been killed.
bool partial_seed
Is this a partial seed.
bt::Uint32 num_down_requests
Number of outstanding download requests queued.
bool fast_extensions
Supports the fast extensions.
bt::Uint64 bytes_uploaded
Amount of data uploaded.
TimeStamp getChokeTime() const
Get the time when this Peer choked us.
virtual void chunkAllowed(bt::Uint32 chunk)=0
Peer is allowed to download chunk (used for superseeding)
bool has_upload_slot
Flag to indicate if this peer has an upload slot.
const PeerID & getPeerID() const
Get the Peer's ID.
const Stats & getStats() const
Get the Peer's statistics.
bool isSeeder() const
See if the peer is a seeder.
QString ip_address
IP address of peer (dotted notation)
TimeStamp time_choked
Time the peer choked us.
bool areWeChoked() const
Are we choked for the Peer.
QString hostname
Host name of the peer.
bool isChoked() const
Is the Peer choked.
virtual bt::Uint32 averageDownloadSpeed() const =0
bt::Uint32 num_up_requests
Number of upload requests queued.
bool choked
Choked or not.
virtual void handlePacket(const bt::Uint8 *packet, bt::Uint32 size)=0
Handle a received packet.