2
* This file Copyright (C) 2007-2008 Charles Kerr <charles@rebelbase.com>
4
* This file is licensed by the GPL version 2. Works owned by the
5
* Transmission project are granted a special exemption to clause 2(b)
6
* so that the bulk of its code can remain under the MIT license.
7
* This exemption does not extend to derived works not owned by
8
* the Transmission project.
10
* $Id: peer-mgr-private.h 5179 2008-03-01 14:32:35Z charles $
13
#ifndef TR_PEER_MGR_PRIVATE_H
14
#define TR_PEER_MGR_PRIVATE_H
16
#include <inttypes.h> /* uint16_t */
19
#include <winsock2.h> /* struct in_addr */
21
#include <netinet/in.h> /* struct in_addr */
24
#include "publish.h" /* tr_publisher_tag */
32
ENCRYPTION_PREFERENCE_UNKNOWN,
33
ENCRYPTION_PREFERENCE_YES,
34
ENCRYPTION_PREFERENCE_NO
38
*** The "SWIFT" system is described by Karthik Tamilmani,
39
*** Vinay Pai, and Alexander Mohr of Stony Brook University
40
*** in their paper "SWIFT: A System With Incentives For Trading"
41
*** http://citeseer.ist.psu.edu/tamilmani04swift.html
43
*** More SWIFT constants are defined in peer-mgr.c
49
static const int SWIFT_ENABLED = 0;
52
* For every byte the peer uploads to us,
53
* allow them to download this many bytes from us
55
static const double SWIFT_REPAYMENT_RATIO = 1.33;
58
typedef struct tr_peer
60
unsigned int peerIsChoked : 1;
61
unsigned int peerIsInterested : 1;
62
unsigned int clientIsChoked : 1;
63
unsigned int clientIsInterested : 1;
64
unsigned int doPurge : 1;
66
/* number of bad pieces they've contributed to */
69
uint8_t encryption_preference;
71
struct in_addr in_addr;
72
struct tr_peerIo * io;
74
struct tr_bitfield * blame;
75
struct tr_bitfield * have;
78
/* the client name from the `v' string in LTEP's handshake dictionary */
81
time_t peerSentPieceDataAt;
82
time_t chokeChangedAt;
83
time_t pieceDataActivityDate;
85
struct tr_peermsgs * msgs;
86
tr_publisher_tag msgsTag;
88
struct tr_ratecontrol * rcToClient;
89
struct tr_ratecontrol * rcToPeer;