source: trunk/libtransmission/announcer.h @ 14225

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

Licensing changes:

  1. add the option the code to be used under GPLv2 or GPLv3; previously only GPLv2 was allowed
  1. add the "proxy option" as described in GPLv3 so we can add future licenses without having to bulk-edit everything again :)
  1. remove the awkward "exception for MIT code in Mac client" clause; it was unnecessary and confusing.
  • Property svn:keywords set to Date Rev Author Id
File size: 2.9 KB
Line 
1/*
2 * This file Copyright (C) 2010-2014 Mnemosyne LLC
3 *
4 * It may be used under the GNU Public License v2 or v3 licenses,
5 * or any future license endorsed by Mnemosyne LLC.
6 *
7 * $Id: announcer.h 14225 2014-01-19 01:09:44Z 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.