transmission/libtransmission/peer-mgr-private.h

80 lines
2.2 KiB
C
Raw Normal View History

/*
2008-01-01 17:20:20 +00:00
* This file Copyright (C) 2007-2008 Charles Kerr <charles@rebelbase.com>
*
* This file is licensed by the GPL version 2. Works owned by the
* Transmission project are granted a special exemption to clause 2(b)
* so that the bulk of its code can remain under the MIT license.
* This exemption does not extend to derived works not owned by
* the Transmission project.
*
* $Id$
*/
#ifndef TR_PEER_MGR_PRIVATE_H
#define TR_PEER_MGR_PRIVATE_H
#include <inttypes.h> /* uint16_t */
2008-01-10 18:52:46 +00:00
#ifdef WIN32
#include <winsock2.h> /* struct in_addr */
2008-01-10 18:52:46 +00:00
#else
#include <netinet/in.h> /* struct in_addr */
2008-01-10 18:52:46 +00:00
#endif
#include "publish.h" /* tr_publisher_tag */
struct tr_bitfield;
struct tr_peerIo;
struct tr_peermsgs;
2008-11-06 02:56:51 +00:00
struct tr_ratecontrol;
enum
{
ENCRYPTION_PREFERENCE_UNKNOWN,
ENCRYPTION_PREFERENCE_YES,
ENCRYPTION_PREFERENCE_NO
};
typedef struct tr_peer
{
2008-11-06 02:56:51 +00:00
unsigned int peerIsChoked : 1;
unsigned int peerIsInterested : 1;
unsigned int clientIsChoked : 1;
unsigned int clientIsInterested : 1;
unsigned int doPurge : 1;
/* number of bad pieces they've contributed to */
2008-11-06 02:56:51 +00:00
uint8_t strikes;
2008-11-06 02:56:51 +00:00
uint8_t encryption_preference;
uint16_t port;
struct in_addr in_addr;
struct tr_peerIo * io;
2008-11-06 02:56:51 +00:00
struct tr_bitfield * blame;
struct tr_bitfield * have;
/** how complete the peer's copy of the torrent is. [0.0...1.0] */
float progress;
/* the client name from the `v' string in LTEP's handshake dictionary */
2008-11-06 02:56:51 +00:00
char * client;
time_t peerSentPieceDataAt;
time_t chokeChangedAt;
time_t pieceDataActivityDate;
2008-11-06 02:56:51 +00:00
struct tr_peermsgs * msgs;
tr_publisher_tag msgsTag;
2008-11-06 02:56:51 +00:00
/* the rate at which pieces are being transferred between client and peer.
* protocol overhead is NOT included; this is only the piece data */
struct tr_ratecontrol * pieceSpeed[2];
}
tr_peer;
2008-11-06 02:56:51 +00:00
double tr_peerGetPieceSpeed( const tr_peer * peer,
tr_direction direction );
#endif