source: trunk/libtransmission/announcer.h @ 10141

Last change on this file since 10141 was 10141, checked in by charles, 11 years ago

(trunk) per-tier up/down/corrupt byte counts for announcing to trackers

File size: 2.9 KB
Line 
1/*
2 * This file Copyright (C) 2009-2010 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:$
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#include "publish.h"
22
23struct tr_announcer;
24struct tr_torrent_tiers;
25
26/**
27 * ***  Tracker Publish / Subscribe
28 * **/
29
30typedef enum
31{
32    TR_TRACKER_WARNING,
33    TR_TRACKER_ERROR,
34    TR_TRACKER_ERROR_CLEAR,
35    TR_TRACKER_PEERS
36}
37TrackerEventType;
38
39/** @brief Notification object to tell listeners about announce or scrape occurences */
40typedef struct
41{
42    /* what type of event this is */
43    TrackerEventType    messageType;
44
45    /* for TR_TRACKER_WARNING and TR_TRACKER_ERROR */
46    const char *  text;
47
48    /* for TR_TRACKER_PEERS */
49    const uint8_t *  compact;
50    int              compactLen;
51    int              allAreSeeds;
52}
53tr_tracker_event;
54
55/**
56***  Session ctor/dtor
57**/
58
59void tr_announcerInit( tr_session * );
60
61void tr_announcerClose( tr_session * );
62
63/**
64***  For torrent customers
65**/
66
67struct tr_torrent_tiers * tr_announcerAddTorrent( struct tr_announcer  *,
68                                                  tr_torrent           * );
69
70tr_bool tr_announcerHasBacklog( const struct tr_announcer * );
71
72void tr_announcerResetTorrent( struct tr_announcer*, tr_torrent* );
73
74tr_publisher_tag tr_announcerSubscribe( struct tr_torrent_tiers  * tiers,
75                                        tr_delivery_func           func,
76                                        void                     * userData );
77
78void tr_announcerUnsubscribe( struct tr_torrent_tiers  * tiers,
79                              tr_publisher_tag           tag );
80
81void tr_announcerRemoveTorrent( struct tr_announcer * ,
82                                tr_torrent          * );
83
84void tr_announcerChangeMyPort( tr_torrent * );
85
86tr_bool tr_announcerCanManualAnnounce( const tr_torrent * );
87
88void tr_announcerManualAnnounce( tr_torrent * );
89
90void tr_announcerTorrentStarted( tr_torrent * );
91void tr_announcerTorrentStopped( tr_torrent * );
92void tr_announcerTorrentCompleted( tr_torrent * );
93
94enum { TR_ANN_UP, TR_ANN_DOWN, TR_ANN_CORRUPT };
95void tr_announcerAddBytes( tr_torrent *, int up_down_or_corrupt, uint32_t byteCount );
96void tr_announcerSubtractBytes( tr_torrent *, int up_down_or_corrupt, uint32_t byteCount );
97
98time_t tr_announcerNextManualAnnounce( const tr_torrent * );
99
100tr_tracker_stat * tr_announcerStats( const tr_torrent * torrent,
101                                     int              * setmeTrackerCount );
102
103void tr_announcerStatsFree( tr_tracker_stat * trackers,
104                            int               trackerCount );
105
106
107#endif /* _TR_ANNOUNCER_H_ */
Note: See TracBrowser for help on using the repository browser.