2009-09-25 21:05:59 +00:00
|
|
|
/*
|
2011-01-19 13:48:47 +00:00
|
|
|
* This file Copyright (C) Mnemosyne LLC
|
2009-09-25 21:05:59 +00:00
|
|
|
*
|
2010-12-27 19:18:17 +00:00
|
|
|
* This file is licensed by the GPL version 2. Works owned by the
|
2009-09-25 21:05:59 +00:00
|
|
|
* Transmission project are granted a special exemption to clause 2(b)
|
|
|
|
* so that the bulk of its code can remain under the MIT license.
|
|
|
|
* This exemption does not extend to derived works not owned by
|
|
|
|
* the Transmission project.
|
|
|
|
*
|
2010-10-01 13:33:39 +00:00
|
|
|
* $Id$
|
2009-09-25 21:05:59 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __TRANSMISSION__
|
|
|
|
#error only libtransmission should #include this header.
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _TR_ANNOUNCER_H_
|
|
|
|
#define _TR_ANNOUNCER_H_
|
|
|
|
|
|
|
|
#include "transmission.h"
|
|
|
|
|
|
|
|
struct tr_announcer;
|
|
|
|
struct tr_torrent_tiers;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* *** Tracker Publish / Subscribe
|
|
|
|
* **/
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
TR_TRACKER_WARNING,
|
|
|
|
TR_TRACKER_ERROR,
|
|
|
|
TR_TRACKER_ERROR_CLEAR,
|
|
|
|
TR_TRACKER_PEERS
|
|
|
|
}
|
|
|
|
TrackerEventType;
|
|
|
|
|
2010-01-19 19:37:00 +00:00
|
|
|
/** @brief Notification object to tell listeners about announce or scrape occurences */
|
2009-09-25 21:05:59 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
/* what type of event this is */
|
|
|
|
TrackerEventType messageType;
|
|
|
|
|
|
|
|
/* for TR_TRACKER_WARNING and TR_TRACKER_ERROR */
|
2010-05-19 19:02:25 +00:00
|
|
|
const char * text;
|
|
|
|
const char * tracker;
|
2009-09-25 21:05:59 +00:00
|
|
|
|
|
|
|
/* for TR_TRACKER_PEERS */
|
|
|
|
const uint8_t * compact;
|
|
|
|
int compactLen;
|
2010-04-20 21:54:03 +00:00
|
|
|
|
2010-12-27 19:18:17 +00:00
|
|
|
/* [0...100] for probability a peer is a seed. calculated by the leecher/seeder ratio */
|
2010-04-20 21:54:03 +00:00
|
|
|
int8_t seedProbability;
|
2009-09-25 21:05:59 +00:00
|
|
|
}
|
|
|
|
tr_tracker_event;
|
|
|
|
|
2010-06-19 14:33:10 +00:00
|
|
|
typedef void tr_tracker_callback ( tr_torrent * tor,
|
|
|
|
const tr_tracker_event * event,
|
|
|
|
void * client_data );
|
|
|
|
|
2009-09-25 21:05:59 +00:00
|
|
|
/**
|
|
|
|
*** Session ctor/dtor
|
|
|
|
**/
|
|
|
|
|
|
|
|
void tr_announcerInit( tr_session * );
|
|
|
|
|
|
|
|
void tr_announcerClose( tr_session * );
|
|
|
|
|
|
|
|
/**
|
|
|
|
*** For torrent customers
|
|
|
|
**/
|
|
|
|
|
2010-06-19 14:33:10 +00:00
|
|
|
struct tr_torrent_tiers * tr_announcerAddTorrent( struct tr_announcer *,
|
|
|
|
tr_torrent * torrent,
|
|
|
|
tr_tracker_callback * cb,
|
|
|
|
void * cbdata );
|
2009-09-25 21:05:59 +00:00
|
|
|
|
2009-12-02 05:30:46 +00:00
|
|
|
tr_bool tr_announcerHasBacklog( const struct tr_announcer * );
|
|
|
|
|
2009-10-02 04:54:02 +00:00
|
|
|
void tr_announcerResetTorrent( struct tr_announcer*, tr_torrent* );
|
|
|
|
|
2009-09-25 21:05:59 +00:00
|
|
|
void tr_announcerRemoveTorrent( struct tr_announcer * ,
|
|
|
|
tr_torrent * );
|
|
|
|
|
|
|
|
void tr_announcerChangeMyPort( tr_torrent * );
|
|
|
|
|
|
|
|
tr_bool tr_announcerCanManualAnnounce( const tr_torrent * );
|
|
|
|
|
|
|
|
void tr_announcerManualAnnounce( tr_torrent * );
|
|
|
|
|
|
|
|
void tr_announcerTorrentStarted( tr_torrent * );
|
|
|
|
void tr_announcerTorrentStopped( tr_torrent * );
|
|
|
|
void tr_announcerTorrentCompleted( tr_torrent * );
|
|
|
|
|
2010-02-08 16:47:30 +00:00
|
|
|
enum { TR_ANN_UP, TR_ANN_DOWN, TR_ANN_CORRUPT };
|
|
|
|
void tr_announcerAddBytes( tr_torrent *, int up_down_or_corrupt, uint32_t byteCount );
|
|
|
|
|
2009-09-25 21:05:59 +00:00
|
|
|
time_t tr_announcerNextManualAnnounce( const tr_torrent * );
|
|
|
|
|
|
|
|
tr_tracker_stat * tr_announcerStats( const tr_torrent * torrent,
|
|
|
|
int * setmeTrackerCount );
|
|
|
|
|
|
|
|
void tr_announcerStatsFree( tr_tracker_stat * trackers,
|
|
|
|
int trackerCount );
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* _TR_ANNOUNCER_H_ */
|