source: trunk/libtransmission/announcer.h @ 14241

Last change on this file since 14241 was 14241, checked in by jordan, 7 years ago

Copyedit the license's revised text: (1) remove unnecessary repitition use of the word 'license' from the top of the header and source files (2) add the standard 'we hope it's useful, but no warranty' clause to COPYING (3) make explicit that linking OpenSSL is allowed (see https://people.gnome.org/~markmc/openssl-and-the-gpl.html for background) (4) sync the Qt and GTK+ clients' license popups with COPYING's revised text

  • Property svn:keywords set to Date Rev Author Id
File size: 2.8 KB
Line 
1/*
2 * This file Copyright (C) 2010-2014 Mnemosyne LLC
3 *
4 * It may be used under the GNU GPL versions 2 or 3
5 * or any future license endorsed by Mnemosyne LLC.
6 *
7 * $Id: announcer.h 14241 2014-01-21 03:10:30Z jordan $
8 */
9
10#ifndef __TRANSMISSION__
11#error only libtransmission should #include this header.
12#endif
13
14#ifndef _TR_ANNOUNCER_H_
15#define _TR_ANNOUNCER_H_
16
17#include "transmission.h"
18
19struct tr_announcer;
20struct tr_torrent_tiers;
21
22/**
23 * ***  Tracker Publish / Subscribe
24 * **/
25
26typedef enum
27{
28    TR_TRACKER_WARNING,
29    TR_TRACKER_ERROR,
30    TR_TRACKER_ERROR_CLEAR,
31    TR_TRACKER_PEERS
32}
33TrackerEventType;
34
35struct tr_pex;
36
37/** @brief Notification object to tell listeners about announce or scrape occurences */
38typedef struct
39{
40    /* what type of event this is */
41    TrackerEventType    messageType;
42
43    /* for TR_TRACKER_WARNING and TR_TRACKER_ERROR */
44    const char * text;
45    const char * tracker;
46
47    /* for TR_TRACKER_PEERS */
48    const struct tr_pex * pex;
49    size_t pexCount;
50
51    /* [0...100] for probability a peer is a seed. calculated by the leecher/seeder ratio */
52    int8_t           seedProbability;
53}
54tr_tracker_event;
55
56typedef void (*tr_tracker_callback) (tr_torrent              * tor,
57                                     const tr_tracker_event  * event,
58                                     void                    * client_data);
59
60/**
61***  Session ctor/dtor
62**/
63
64void tr_announcerInit (tr_session *);
65
66void tr_announcerClose (tr_session *);
67
68/**
69***  For torrent customers
70**/
71
72struct tr_torrent_tiers * tr_announcerAddTorrent (tr_torrent          * torrent,
73                                                  tr_tracker_callback   cb,
74                                                  void                * cbdata);
75
76bool tr_announcerHasBacklog (const struct tr_announcer *);
77
78void tr_announcerResetTorrent (struct tr_announcer*, tr_torrent*);
79
80void tr_announcerRemoveTorrent (struct tr_announcer * ,
81                                tr_torrent          *);
82
83void tr_announcerChangeMyPort (tr_torrent *);
84
85bool tr_announcerCanManualAnnounce (const tr_torrent *);
86
87void tr_announcerManualAnnounce (tr_torrent *);
88
89void tr_announcerTorrentStarted (tr_torrent *);
90void tr_announcerTorrentStopped (tr_torrent *);
91void tr_announcerTorrentCompleted (tr_torrent *);
92
93enum { TR_ANN_UP, TR_ANN_DOWN, TR_ANN_CORRUPT };
94void tr_announcerAddBytes (tr_torrent *, int up_down_or_corrupt, uint32_t byteCount);
95
96time_t tr_announcerNextManualAnnounce (const tr_torrent *);
97
98tr_tracker_stat * tr_announcerStats (const tr_torrent * torrent,
99                                     int              * setmeTrackerCount);
100
101void tr_announcerStatsFree (tr_tracker_stat * trackers,
102                            int               trackerCount);
103
104/***
105****
106***/
107
108void tr_tracker_udp_upkeep (tr_session * session);
109
110void tr_tracker_udp_close (tr_session * session);
111
112bool tr_tracker_udp_is_idle (const tr_session * session);
113
114
115
116#endif /* _TR_ANNOUNCER_H_ */
Note: See TracBrowser for help on using the repository browser.