source: trunk/libtransmission/peer-mgr.h @ 3265

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

some cleanup... remove some dead/obsolete code

  • Property svn:keywords set to Date Rev Author Id
File size: 3.8 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.h 3265 2007-10-02 00:05:40Z charles $
11 */
12
13#ifndef TR_PEER_MGR_H
14#define TR_PEER_MGR_H
15
16#include <inttypes.h> /* uint16_t */
17#include <arpa/inet.h> /* struct in_addr */
18
19struct in_addr;
20struct tr_handle;
21struct tr_peer_stat;
22struct tr_torrent;
23typedef struct tr_peerMgr tr_peerMgr;
24
25typedef struct tr_pex
26{
27    struct in_addr in_addr;
28    uint16_t port;
29    uint8_t flags;
30}
31tr_pex;
32
33int tr_pexCompare( const void * a, const void * b );
34
35tr_peerMgr* tr_peerMgrNew( struct tr_handle * );
36
37void tr_peerMgrFree( tr_peerMgr * manager );
38
39void tr_peerMgrAddIncoming( tr_peerMgr      * manager,
40                            struct in_addr  * addr,
41                            uint16_t          port,
42                            int               socket );
43
44void tr_peerMgrAddPeers( tr_peerMgr     * manager,
45                         const uint8_t  * torrentHash,
46                         int              from,
47                         const uint8_t  * peerCompact,
48                         int              peerCount );
49
50void tr_peerMgrAddPex( tr_peerMgr     * manager,
51                       const uint8_t  * torrentHash,
52                       int              from,
53                       const tr_pex   * pex,
54                       int              pexCount );
55
56void tr_peerMgrSetBlame( tr_peerMgr     * manager,
57                         const uint8_t  * torrentHash,
58                         int              pieceIndex,
59                         int              success );
60
61int tr_peerMgrGetPeers( tr_peerMgr      * manager,
62                        const uint8_t   * torrentHash,
63                        tr_pex         ** setme_pex );
64
65void tr_peerMgrStartTorrent( tr_peerMgr     * manager,
66                             const uint8_t  * torrentHash );
67
68void tr_peerMgrStopTorrent( tr_peerMgr     * manager,
69                            const uint8_t  * torrentHash );
70
71void tr_peerMgrAddTorrent( tr_peerMgr         * manager,
72                           struct tr_torrent  * tor );
73
74void tr_peerMgrRemoveTorrent( tr_peerMgr     * manager,
75                               const uint8_t  * torrentHash );
76
77void tr_peerMgrTorrentAvailability( const tr_peerMgr * manager,
78                                    const uint8_t    * torrentHash,
79                                    int8_t           * tab,
80                                    int                tabCount );
81
82struct tr_bitfield* tr_peerMgrGetAvailable( const tr_peerMgr * manager,
83                                            const uint8_t    * torrentHash );
84
85void tr_peerMgrTorrentStats( const tr_peerMgr * manager,
86                             const uint8_t    * torrentHash,
87                             int              * setmePeersKnown,
88                             int              * setmePeersConnected,
89                             int              * setmePeersSendingToUs,
90                             int              * setmePeersGettingFromUs,
91                             int              * setmePeersFrom ); /* <-- array of TR_PEER_FROM__MAX */
92
93struct tr_peer_stat * tr_peerMgrPeerStats( const tr_peerMgr  * manager,
94                                           const uint8_t     * torrentHash,
95                                           int               * setmeCount );
96
97                             
98struct tr_bitfield *
99tr_peerMgrGenerateAllowedSet( const uint32_t         setCount,
100                              const uint32_t         pieceCount,
101                              const uint8_t          infohash[20],
102                              const struct in_addr * ip );
103
104
105
106#endif
Note: See TracBrowser for help on using the repository browser.