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

Last change on this file since 3105 was 3105, checked in by livings124, 16 years ago

merge encryption branch to trunk (xcode project is still out of date)

  • Property svn:keywords set to Date Rev Author Id
File size: 3.4 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 3105 2007-09-20 16:32:01Z livings124 $
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
39int tr_peerMgrIsAcceptingConnections( const tr_peerMgr * manager );
40
41void tr_peerMgrAddIncoming( tr_peerMgr      * manager,
42                            struct in_addr  * addr,
43                            int               socket );
44
45void tr_peerMgrAddPeers( tr_peerMgr     * manager,
46                         const uint8_t  * torrentHash,
47                         int              from,
48                         const uint8_t  * peerCompact,
49                         int              peerCount );
50
51void tr_peerMgrAddPex( tr_peerMgr     * manager,
52                       const uint8_t  * torrentHash,
53                       int              from,
54                       const tr_pex   * pex,
55                       int              pexCount );
56
57void tr_peerMgrSetBlame( tr_peerMgr     * manager,
58                         const uint8_t  * torrentHash,
59                         int              pieceIndex,
60                         int              success );
61
62int tr_peerMgrGetPeers( tr_peerMgr      * manager,
63                        const uint8_t   * torrentHash,
64                        tr_pex         ** setme_pex );
65
66void tr_peerMgrStartTorrent( tr_peerMgr     * manager,
67                             const uint8_t  * torrentHash );
68
69void tr_peerMgrStopTorrent( tr_peerMgr     * manager,
70                            const uint8_t  * torrentHash );
71
72void tr_peerMgrAddTorrent( tr_peerMgr         * manager,
73                           struct tr_torrent  * tor );
74
75void tr_peerMgrRemoveTorrent( tr_peerMgr     * manager,
76                               const uint8_t  * torrentHash );
77
78void tr_peerMgrTorrentAvailability( const tr_peerMgr * manager,
79                                    const uint8_t    * torrentHash,
80                                    int8_t           * tab,
81                                    int                tabCount );
82
83void tr_peerMgrTorrentStats( const tr_peerMgr * manager,
84                             const uint8_t    * torrentHash,
85                             int              * setmePeersTotal,
86                             int              * setmePeersConnected,
87                             int              * setmePeersSendingToUs,
88                             int              * setmePeersGettingFromUs,
89                             int              * setmePeersFrom ); /* <-- array of TR_PEER_FROM__MAX */
90
91struct tr_peer_stat * tr_peerMgrPeerStats( const tr_peerMgr  * manager,
92                                           const uint8_t     * torrentHash,
93                                           int               * setmeCount );
94
95
96
97
98
99#endif
Note: See TracBrowser for help on using the repository browser.