2 * This file Copyright (C) 2009-2010 Mnemosyne LLC
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.
10 * $Id: announcer.h 11280 2010-10-01 13:33:39Z charles $
13 #ifndef __TRANSMISSION__
14 #error only libtransmission should #include this header.
17 #ifndef _TR_ANNOUNCER_H_
18 #define _TR_ANNOUNCER_H_
20 #include "transmission.h"
23 struct tr_torrent_tiers
;
26 * *** Tracker Publish / Subscribe
33 TR_TRACKER_ERROR_CLEAR
,
38 /** @brief Notification object to tell listeners about announce or scrape occurences */
41 /* what type of event this is */
42 TrackerEventType messageType
;
44 /* for TR_TRACKER_WARNING and TR_TRACKER_ERROR */
48 /* for TR_TRACKER_PEERS */
49 const uint8_t * compact
;
52 /* [0...100] for probability a peer is a seed. calculated by the leecher/seeder ratio */
53 int8_t seedProbability
;
57 typedef void tr_tracker_callback ( tr_torrent
* tor
,
58 const tr_tracker_event
* event
,
65 void tr_announcerInit( tr_session
* );
67 void tr_announcerClose( tr_session
* );
70 *** For torrent customers
73 struct tr_torrent_tiers
* tr_announcerAddTorrent( struct tr_announcer
*,
75 tr_tracker_callback
* cb
,
78 tr_bool
tr_announcerHasBacklog( const struct tr_announcer
* );
80 void tr_announcerResetTorrent( struct tr_announcer
*, tr_torrent
* );
82 void tr_announcerRemoveTorrent( struct tr_announcer
* ,
85 void tr_announcerChangeMyPort( tr_torrent
* );
87 tr_bool
tr_announcerCanManualAnnounce( const tr_torrent
* );
89 void tr_announcerManualAnnounce( tr_torrent
* );
91 void tr_announcerTorrentStarted( tr_torrent
* );
92 void tr_announcerTorrentStopped( tr_torrent
* );
93 void tr_announcerTorrentCompleted( tr_torrent
* );
95 enum { TR_ANN_UP
, TR_ANN_DOWN
, TR_ANN_CORRUPT
};
96 void tr_announcerAddBytes( tr_torrent
*, int up_down_or_corrupt
, uint32_t byteCount
);
98 time_t tr_announcerNextManualAnnounce( const tr_torrent
* );
100 tr_tracker_stat
* tr_announcerStats( const tr_torrent
* torrent
,
101 int * setmeTrackerCount
);
103 void tr_announcerStatsFree( tr_tracker_stat
* trackers
,
107 #endif /* _TR_ANNOUNCER_H_ */