source: trunk/libtransmission/announcer.h

Last change on this file was 14724, checked in by jordan, 5 years ago

use '#pragma once' instead of #ifndef..#define..#endif guards

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