• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/transmission/transmission-2.73/libtransmission/
1/*
2 * This file Copyright (C) Mnemosyne LLC
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: announcer.h 12237 2011-03-26 10:22:25Z jordan $
11 */
12
13#ifndef __TRANSMISSION__
14#error only libtransmission should #include this header.
15#endif
16
17#ifndef _TR_ANNOUNCER_H_
18#define _TR_ANNOUNCER_H_
19
20#include "transmission.h"
21
22struct tr_announcer;
23struct tr_torrent_tiers;
24
25/**
26 * ***  Tracker Publish / Subscribe
27 * **/
28
29typedef enum
30{
31    TR_TRACKER_WARNING,
32    TR_TRACKER_ERROR,
33    TR_TRACKER_ERROR_CLEAR,
34    TR_TRACKER_PEERS
35}
36TrackerEventType;
37
38struct tr_pex;
39
40/** @brief Notification object to tell listeners about announce or scrape occurences */
41typedef struct
42{
43    /* what type of event this is */
44    TrackerEventType    messageType;
45
46    /* for TR_TRACKER_WARNING and TR_TRACKER_ERROR */
47    const char * text;
48    const char * tracker;
49
50    /* for TR_TRACKER_PEERS */
51    const struct tr_pex * pex;
52    size_t pexCount;
53
54    /* [0...100] for probability a peer is a seed. calculated by the leecher/seeder ratio */
55    int8_t           seedProbability;
56}
57tr_tracker_event;
58
59typedef void tr_tracker_callback ( tr_torrent              * tor,
60                                   const tr_tracker_event  * event,
61                                   void                    * client_data );
62
63/**
64***  Session ctor/dtor
65**/
66
67void tr_announcerInit( tr_session * );
68
69void tr_announcerClose( tr_session * );
70
71/**
72***  For torrent customers
73**/
74
75struct tr_torrent_tiers * tr_announcerAddTorrent( tr_torrent          * torrent,
76                                                  tr_tracker_callback * cb,
77                                                  void                * cbdata );
78
79bool tr_announcerHasBacklog( const struct tr_announcer * );
80
81void tr_announcerResetTorrent( struct tr_announcer*, tr_torrent* );
82
83void tr_announcerRemoveTorrent( struct tr_announcer * ,
84                                tr_torrent          * );
85
86void tr_announcerChangeMyPort( tr_torrent * );
87
88bool tr_announcerCanManualAnnounce( const tr_torrent * );
89
90void tr_announcerManualAnnounce( tr_torrent * );
91
92void tr_announcerTorrentStarted( tr_torrent * );
93void tr_announcerTorrentStopped( tr_torrent * );
94void tr_announcerTorrentCompleted( tr_torrent * );
95
96enum { TR_ANN_UP, TR_ANN_DOWN, TR_ANN_CORRUPT };
97void tr_announcerAddBytes( tr_torrent *, int up_down_or_corrupt, uint32_t byteCount );
98
99time_t tr_announcerNextManualAnnounce( const tr_torrent * );
100
101tr_tracker_stat * tr_announcerStats( const tr_torrent * torrent,
102                                     int              * setmeTrackerCount );
103
104void tr_announcerStatsFree( tr_tracker_stat * trackers,
105                            int               trackerCount );
106
107/***
108****
109***/
110
111void tr_tracker_udp_upkeep( tr_session * session );
112
113void tr_tracker_udp_close( tr_session * session );
114
115bool tr_tracker_udp_is_idle( const tr_session * session );
116
117
118
119#endif /* _TR_ANNOUNCER_H_ */
120