2007-09-20 16:32:01 +00:00
|
|
|
/*
|
2008-01-01 17:20:20 +00:00
|
|
|
* This file Copyright (C) 2007-2008 Charles Kerr <charles@rebelbase.com>
|
2007-09-20 16:32:01 +00:00
|
|
|
*
|
|
|
|
* This file is licensed by the GPL version 2. Works owned by the
|
|
|
|
* Transmission project are granted a special exemption to clause 2(b)
|
2008-09-23 19:11:04 +00:00
|
|
|
* so that the bulk of its code can remain under the MIT license.
|
2007-09-20 16:32:01 +00:00
|
|
|
* This exemption does not extend to derived works not owned by
|
|
|
|
* the Transmission project.
|
|
|
|
*
|
|
|
|
* $Id$
|
|
|
|
*/
|
|
|
|
|
2008-11-24 20:17:36 +00:00
|
|
|
#ifndef __TRANSMISSION__
|
|
|
|
#error only libtransmission should #include this header.
|
|
|
|
#endif
|
|
|
|
|
2007-09-20 16:32:01 +00:00
|
|
|
#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
|
2008-09-23 19:11:04 +00:00
|
|
|
#include <winsock2.h> /* struct in_addr */
|
2008-01-10 18:52:46 +00:00
|
|
|
#endif
|
|
|
|
|
2007-09-20 16:32:01 +00:00
|
|
|
#include "publish.h" /* tr_publisher_tag */
|
|
|
|
|
2008-11-25 21:35:17 +00:00
|
|
|
struct tr_bandwidth;
|
2007-09-20 16:32:01 +00:00
|
|
|
struct tr_bitfield;
|
|
|
|
struct tr_peerIo;
|
|
|
|
struct tr_peermsgs;
|
|
|
|
|
2007-09-29 00:46:41 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
ENCRYPTION_PREFERENCE_UNKNOWN,
|
|
|
|
ENCRYPTION_PREFERENCE_YES,
|
|
|
|
ENCRYPTION_PREFERENCE_NO
|
|
|
|
};
|
|
|
|
|
2008-12-11 17:02:34 +00:00
|
|
|
/**
|
|
|
|
* State information about a connected peer.
|
|
|
|
*
|
|
|
|
* @see struct peer_atom
|
|
|
|
* @see tr_peermsgs
|
|
|
|
*/
|
2007-09-20 16:32:01 +00:00
|
|
|
typedef struct tr_peer
|
|
|
|
{
|
2008-11-28 22:11:41 +00:00
|
|
|
tr_bool peerIsChoked;
|
|
|
|
tr_bool peerIsInterested;
|
|
|
|
tr_bool clientIsChoked;
|
|
|
|
tr_bool clientIsInterested;
|
|
|
|
tr_bool doPurge;
|
2007-09-20 16:32:01 +00:00
|
|
|
|
2007-10-08 01:31:27 +00:00
|
|
|
/* number of bad pieces they've contributed to */
|
2008-11-06 02:56:51 +00:00
|
|
|
uint8_t strikes;
|
2007-10-08 01:31:27 +00:00
|
|
|
|
2008-11-06 02:56:51 +00:00
|
|
|
uint8_t encryption_preference;
|
2008-12-01 20:51:01 +00:00
|
|
|
tr_port port;
|
2008-12-02 03:41:58 +00:00
|
|
|
tr_address addr;
|
2008-11-06 02:56:51 +00:00
|
|
|
struct tr_peerIo * io;
|
2007-09-20 16:32:01 +00:00
|
|
|
|
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;
|
2007-09-20 16:32:01 +00:00
|
|
|
|
|
|
|
/* the client name from the `v' string in LTEP's handshake dictionary */
|
2008-11-06 02:56:51 +00:00
|
|
|
char * client;
|
|
|
|
|
|
|
|
time_t chokeChangedAt;
|
2007-09-20 16:32:01 +00:00
|
|
|
|
2008-11-06 02:56:51 +00:00
|
|
|
struct tr_peermsgs * msgs;
|
|
|
|
tr_publisher_tag msgsTag;
|
2007-09-20 16:32:01 +00:00
|
|
|
|
2008-11-25 21:35:17 +00:00
|
|
|
struct tr_bandwidth * bandwidth;
|
2007-09-20 16:32:01 +00:00
|
|
|
}
|
|
|
|
tr_peer;
|
|
|
|
|
2008-11-06 02:56:51 +00:00
|
|
|
double tr_peerGetPieceSpeed( const tr_peer * peer,
|
|
|
|
tr_direction direction );
|
|
|
|
|
2007-09-20 16:32:01 +00:00
|
|
|
#endif
|