2007-08-16 20:00:06 +00:00
|
|
|
/*
|
2009-01-10 23:09:07 +00:00
|
|
|
* This file Copyright (C) 2007-2009 Charles Kerr <charles@transmissionbt.com>
|
2006-07-16 19:39:23 +00:00
|
|
|
*
|
2007-08-16 20:00:06 +00:00
|
|
|
* This file is licensed by the GPL version 2. Works owned by the
|
|
|
|
* Transmission project are granted a special exemption to clause 2(b)
|
2008-09-23 19:11:04 +00:00
|
|
|
* so that the bulk of its code can remain under the MIT license.
|
2007-08-16 20:00:06 +00:00
|
|
|
* This exemption does not extend to derived works not owned by
|
|
|
|
* the Transmission project.
|
2007-08-18 17:05:51 +00:00
|
|
|
*
|
2007-08-18 17:19:49 +00:00
|
|
|
* $Id$
|
2007-08-16 20:00:06 +00:00
|
|
|
*/
|
|
|
|
|
2008-11-24 20:17:36 +00:00
|
|
|
#ifndef __TRANSMISSION__
|
|
|
|
#error only libtransmission should #include this header.
|
|
|
|
#endif
|
|
|
|
|
2007-08-16 20:00:06 +00:00
|
|
|
#ifndef _TR_TRACKER_H_
|
|
|
|
#define _TR_TRACKER_H_
|
|
|
|
|
|
|
|
#include <inttypes.h> /* for uint8_t */
|
|
|
|
#include "transmission.h"
|
|
|
|
#include "publish.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
*** Locating a tracker
|
|
|
|
**/
|
|
|
|
|
2007-10-17 18:59:58 +00:00
|
|
|
typedef struct tr_tracker tr_tracker;
|
2007-08-16 20:00:06 +00:00
|
|
|
|
2007-10-17 18:59:58 +00:00
|
|
|
tr_tracker * tr_trackerNew( const tr_torrent * );
|
|
|
|
|
2008-09-23 19:11:04 +00:00
|
|
|
void tr_trackerFree( tr_tracker * );
|
2007-08-16 20:00:06 +00:00
|
|
|
|
2009-02-04 16:58:52 +00:00
|
|
|
/**
|
|
|
|
***
|
|
|
|
**/
|
|
|
|
|
|
|
|
void tr_trackerSessionInit( tr_session * );
|
|
|
|
|
2008-12-14 11:21:11 +00:00
|
|
|
void tr_trackerSessionClose( tr_session * );
|
2007-11-29 02:31:21 +00:00
|
|
|
|
2007-08-16 20:00:06 +00:00
|
|
|
/**
|
|
|
|
*** Tracker Publish / Subscribe
|
|
|
|
**/
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
TR_TRACKER_WARNING,
|
|
|
|
TR_TRACKER_ERROR,
|
2007-09-25 18:39:58 +00:00
|
|
|
TR_TRACKER_ERROR_CLEAR,
|
2007-10-04 19:58:30 +00:00
|
|
|
TR_TRACKER_PEERS
|
2007-08-16 20:00:06 +00:00
|
|
|
}
|
|
|
|
TrackerEventType;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
/* what type of event this is */
|
2008-09-23 19:11:04 +00:00
|
|
|
TrackerEventType messageType;
|
2007-08-16 20:00:06 +00:00
|
|
|
|
|
|
|
/* for TR_TRACKER_WARNING and TR_TRACKER_ERROR */
|
2008-09-23 19:11:04 +00:00
|
|
|
const char * text;
|
2007-08-16 20:00:06 +00:00
|
|
|
|
|
|
|
/* for TR_TRACKER_PEERS */
|
2008-09-23 19:11:04 +00:00
|
|
|
const uint8_t * compact;
|
|
|
|
int compactLen;
|
|
|
|
int allAreSeeds;
|
2007-08-16 20:00:06 +00:00
|
|
|
}
|
2007-10-17 18:59:58 +00:00
|
|
|
tr_tracker_event;
|
2007-08-16 20:00:06 +00:00
|
|
|
|
2008-09-23 19:11:04 +00:00
|
|
|
tr_publisher_tag tr_trackerSubscribe( struct tr_tracker * tag,
|
|
|
|
tr_delivery_func func,
|
|
|
|
void * user );
|
2007-08-16 20:00:06 +00:00
|
|
|
|
2008-09-23 19:11:04 +00:00
|
|
|
void tr_trackerUnsubscribe( struct tr_tracker * tracker,
|
|
|
|
tr_publisher_tag tag );
|
2007-08-16 20:00:06 +00:00
|
|
|
|
|
|
|
/***
|
|
|
|
****
|
|
|
|
***/
|
|
|
|
|
2008-09-23 19:11:04 +00:00
|
|
|
void tr_trackerStat( const tr_tracker * tracker,
|
|
|
|
struct tr_stat * setme );
|
2008-02-21 07:29:39 +00:00
|
|
|
|
2008-09-23 19:11:04 +00:00
|
|
|
void tr_trackerStart( struct tr_tracker * );
|
2007-08-16 20:00:06 +00:00
|
|
|
|
2008-09-23 19:11:04 +00:00
|
|
|
void tr_trackerCompleted( struct tr_tracker * );
|
2007-08-16 20:00:06 +00:00
|
|
|
|
2008-09-23 19:11:04 +00:00
|
|
|
void tr_trackerStop( struct tr_tracker * );
|
2007-08-16 20:00:06 +00:00
|
|
|
|
2008-09-23 19:11:04 +00:00
|
|
|
void tr_trackerReannounce( struct tr_tracker * );
|
2007-08-16 20:00:06 +00:00
|
|
|
|
2008-09-23 19:11:04 +00:00
|
|
|
void tr_trackerChangeMyPort( struct tr_tracker * );
|
2007-08-16 20:00:06 +00:00
|
|
|
|
2009-01-03 23:11:29 +00:00
|
|
|
const tr_tracker_info * tr_trackerGetAddress( struct tr_tracker *, const tr_torrent * tor );
|
2007-08-16 20:00:06 +00:00
|
|
|
|
2008-12-02 18:24:26 +00:00
|
|
|
int tr_trackerCanManualAnnounce( const struct tr_tracker * );
|
|
|
|
|
|
|
|
time_t tr_trackerGetManualAnnounceTime( const struct tr_tracker * );
|
|
|
|
|
|
|
|
void tr_trackerGetCounts( const struct tr_tracker *,
|
|
|
|
int * setme_completedCount,
|
|
|
|
int * setme_leecherCount,
|
2008-12-02 19:46:51 +00:00
|
|
|
int * setme_seederCount,
|
|
|
|
int * setme_downloaderCount );
|
2006-07-16 19:39:23 +00:00
|
|
|
|
|
|
|
#endif
|