source: trunk/libtransmission/peer-mgr-private.h @ 3320

Last change on this file since 3320 was 3320, checked in by charles, 15 years ago

ban peers that feed us too many bad blocks.

  • Property svn:keywords set to Date Rev Author Id
File size: 1.6 KB
Line 
1/*
2 * This file Copyright (C) 2007 Charles Kerr <charles@rebelbase.com>
3 *
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.
9 *
10 * $Id: peer-mgr-private.h 3320 2007-10-08 01:31:27Z charles $
11 */
12
13#ifndef TR_PEER_MGR_PRIVATE_H
14#define TR_PEER_MGR_PRIVATE_H
15
16#include <inttypes.h> /* uint16_t */
17#include <arpa/inet.h> /* struct in_addr */
18#include "publish.h" /* tr_publisher_tag */
19
20struct tr_bitfield;
21struct tr_peerIo;
22struct tr_peermsgs;
23
24enum
25{
26    ENCRYPTION_PREFERENCE_UNKNOWN,
27    ENCRYPTION_PREFERENCE_YES,
28    ENCRYPTION_PREFERENCE_NO
29};
30
31typedef struct tr_peer
32{
33    unsigned int  peerIsChoked : 1;
34    unsigned int  peerIsInterested : 1;
35    unsigned int  clientIsChoked : 1;
36    unsigned int  clientIsInterested : 1;
37    unsigned int  doPurge : 1;
38
39
40    /* number of bad pieces they've contributed to */
41    uint8_t strikes;
42
43    uint8_t encryption_preference;
44    uint16_t port;
45    struct in_addr in_addr;
46    struct tr_peerIo * io;
47
48    struct tr_bitfield * banned;
49    struct tr_bitfield * blame;
50    struct tr_bitfield * have;
51    float progress;
52
53    /* the client name from the `v' string in LTEP's handshake dictionary */
54    char * client;
55
56    time_t peerSentPieceDataAt;
57    time_t chokeChangedAt;
58    time_t pieceDataActivityDate;
59
60    struct tr_peermsgs * msgs;
61    tr_publisher_tag msgsTag;
62
63    struct tr_ratecontrol * rcToClient;
64    struct tr_ratecontrol * rcToPeer;
65
66    double rateToClient;
67    double rateToPeer;
68}
69tr_peer;
70
71#endif
Note: See TracBrowser for help on using the repository browser.