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

Last change on this file since 7125 was 7125, checked in by charles, 12 years ago

(libT) better possible fix for #1468: Speed display is very jumpy

  • Property svn:keywords set to Date Rev Author Id
File size: 2.3 KB
Line 
1/*
2 * This file Copyright (C) 2007-2008 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 7125 2008-11-17 04:00:57Z 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
18#ifdef WIN32
19 #include <winsock2.h> /* struct in_addr */
20#else
21 #include <netinet/in.h> /* struct in_addr */
22#endif
23
24#include "publish.h" /* tr_publisher_tag */
25
26struct tr_bitfield;
27struct tr_peerIo;
28struct tr_peermsgs;
29struct tr_ratecontrol;
30
31enum
32{
33    ENCRYPTION_PREFERENCE_UNKNOWN,
34    ENCRYPTION_PREFERENCE_YES,
35    ENCRYPTION_PREFERENCE_NO
36};
37
38typedef struct tr_peer
39{
40    unsigned int             peerIsChoked       : 1;
41    unsigned int             peerIsInterested   : 1;
42    unsigned int             clientIsChoked     : 1;
43    unsigned int             clientIsInterested : 1;
44    unsigned int             doPurge            : 1;
45
46    /* number of bad pieces they've contributed to */
47    uint8_t                  strikes;
48
49    uint8_t                  encryption_preference;
50    uint16_t                 port;
51    struct in_addr           in_addr;
52    struct tr_peerIo       * io;
53
54    struct tr_bitfield     * blame;
55    struct tr_bitfield     * have;
56
57    /** how complete the peer's copy of the torrent is. [0.0...1.0] */
58    float                    progress;
59
60    /* the client name from the `v' string in LTEP's handshake dictionary */
61    char                   * client;
62
63    time_t                   peerSentPieceDataAt;
64    time_t                   chokeChangedAt;
65    time_t                   pieceDataActivityDate;
66
67    struct tr_peermsgs     * msgs;
68    tr_publisher_tag         msgsTag;
69
70    /* the rate at which pieces are being transferred between client and peer.
71     * protocol overhead is NOT included; this is only the piece data */
72    struct tr_ratecontrol  * pieceSpeed[2];
73
74    /* the rate at which all data is being transferred between client and peer. */
75    struct tr_ratecontrol  * rawSpeed[2];
76}
77tr_peer;
78
79double tr_peerGetPieceSpeed( const tr_peer    * peer,
80                             tr_direction       direction );
81
82#endif
Note: See TracBrowser for help on using the repository browser.