source: trunk/libtransmission/transmission.h @ 2891

Last change on this file since 2891 was 2891, checked in by charles, 15 years ago

added support for `corrupt' announce tag s.t. corrupted bytes don't count towards your download ratio

  • Property svn:keywords set to Date Rev Author Id
File size: 26.4 KB
Line 
1/******************************************************************************
2 * $Id: transmission.h 2891 2007-08-21 15:17:02Z charles $
3 *
4 * Copyright (c) 2005-2007 Transmission authors and contributors
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *****************************************************************************/
24
25#ifndef TR_TRANSMISSION_H
26#define TR_TRANSMISSION_H 1
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32#include "version.h"
33
34#include <inttypes.h>
35#ifndef PRId64
36# define PRId64 "lld"
37#endif
38#ifndef PRIu64
39# define PRIu64 "llu"
40#endif
41#include <time.h>
42
43#define SHA_DIGEST_LENGTH 20
44#ifdef __BEOS__
45# include <StorageDefs.h>
46# define MAX_PATH_LENGTH  B_FILE_NAME_LENGTH
47#else
48# define MAX_PATH_LENGTH  1024
49#endif
50
51#ifndef INET_ADDRSTRLEN
52#define INET_ADDRSTRLEN 16
53#endif
54
55#if defined(WIN32)
56#define TR_PATH_DELIMITER '\\'
57#define TR_PATH_DELIMITER_STR "\\"
58#else
59#define TR_PATH_DELIMITER '/'
60#define TR_PATH_DELIMITER_STR "/"
61#endif
62
63#define TR_DEFAULT_PORT   9090
64
65#define TR_PEER_FROM__MAX       4
66#define TR_PEER_FROM_INCOMING   0 /* connections made to the listening port */
67#define TR_PEER_FROM_TRACKER    1 /* peers received from a tracker */
68#define TR_PEER_FROM_CACHE      2 /* peers read from the peer cache */
69#define TR_PEER_FROM_PEX        3 /* peers discovered via PEX */
70
71/***********************************************************************
72 * Error codes
73 **********************************************************************/
74/* General errors */
75#define TR_OK                       0x00000000
76#define TR_ERROR                    0x81000000
77#define TR_ERROR_ASSERT             0x82000000
78/* I/O errors */
79#define TR_ERROR_IO_MASK            0x000000FF
80#define TR_ERROR_IO_PARENT          0x80000001
81#define TR_ERROR_IO_PERMISSIONS     0x80000002
82#define TR_ERROR_IO_SPACE           0x80000004
83#define TR_ERROR_IO_FILE_TOO_BIG    0x80000008
84#define TR_ERROR_IO_OPEN_FILES      0x80000010
85#define TR_ERROR_IO_DUP_DOWNLOAD    0x80000020
86#define TR_ERROR_IO_OTHER           0x80000040
87/* Misc */
88#define TR_ERROR_TC_MASK            0x00000F00
89#define TR_ERROR_TC_ERROR           0x80000100
90#define TR_ERROR_TC_WARNING         0x80000200
91
92#define TR_ERROR_ISSET( num, code ) ( (code) == ( (code) & (num) ) )
93
94/***********************************************************************
95 * tr_init
96 ***********************************************************************
97 * Initializes a libtransmission instance. Returns a obscure handle to
98 * be passed to all functions below. The tag argument is a short string
99 * unique to the program invoking tr_init(), it is currently used as
100 * part of saved torrent files' names to prevent one frontend from
101 * deleting a torrent used by another. The following tags are used:
102 *   beos cli daemon gtk macosx
103 **********************************************************************/
104typedef struct tr_handle_s tr_handle_t;
105tr_handle_t * tr_init( const char * tag );
106
107typedef struct tr_tracker_info_s tr_tracker_info_t;
108
109/***********************************************************************
110 * tr_setMessageLevel
111 ***********************************************************************
112 * Set the level of messages to be output or queued
113 **********************************************************************/
114#define TR_MSG_ERR 1
115#define TR_MSG_INF 2
116#define TR_MSG_DBG 3
117void tr_setMessageLevel( int );
118int tr_getMessageLevel( void );
119
120/***********************************************************************
121 * tr_setMessageQueuing
122 ***********************************************************************
123 * Enable or disable message queuing
124 **********************************************************************/
125typedef struct tr_msg_list_s tr_msg_list_t;
126void tr_setMessageQueuing( int );
127
128/***********************************************************************
129 * tr_getQueuedMessages
130 ***********************************************************************
131 * Return a list of queued messages
132 **********************************************************************/
133tr_msg_list_t * tr_getQueuedMessages( void );
134void tr_freeMessageList( tr_msg_list_t * list );
135
136/***********************************************************************
137 * tr_getPrefsDirectory
138 ***********************************************************************
139 * Returns the full path to a directory which can be used to store
140 * preferences. The string belongs to libtransmission, do not free it.
141 **********************************************************************/
142const char * tr_getPrefsDirectory( void );
143
144/***********************************************************************
145 * tr_setBindPort
146 ***********************************************************************
147 * Sets the port to listen for incoming peer connections.
148 * This can be safely called even with active torrents.
149 **********************************************************************/
150void tr_setBindPort( tr_handle_t *, int );
151
152/***********************************************************************
153 * tr_natTraversalEnable
154 * tr_natTraversalDisable
155 ***********************************************************************
156 * Enable or disable NAT traversal using NAT-PMP or UPnP IGD.
157 **********************************************************************/
158void tr_natTraversalEnable( tr_handle_t *, int enable );
159
160/***********************************************************************
161 * tr_handleStatus
162 ***********************************************************************
163 * Returns some status info for the given handle.
164 **********************************************************************/
165typedef struct tr_handle_status_s tr_handle_status_t;
166tr_handle_status_t * tr_handleStatus( tr_handle_t * );
167
168
169/***********************************************************************
170 * tr_torrentCount
171 ***********************************************************************
172 * Returns the count of open torrents
173 **********************************************************************/
174int tr_torrentCount( tr_handle_t * h );
175
176
177/***********************************************************************
178 * tr_torrentIterate
179 ***********************************************************************
180 * Iterates on open torrents
181 **********************************************************************/
182typedef struct tr_torrent_s tr_torrent_t;
183typedef void (*tr_callback_t) ( tr_torrent_t *, void * );
184void tr_torrentIterate( tr_handle_t *, tr_callback_t, void * );
185
186
187/***********************************************************************
188*** Speed Limits
189**/
190
191enum { TR_UP, TR_DOWN };
192
193typedef enum
194{
195    TR_SPEEDLIMIT_GLOBAL,    /* only follow the overall speed limit */
196    TR_SPEEDLIMIT_SINGLE,    /* only follow the per-torrent limit */
197    TR_SPEEDLIMIT_UNLIMITED  /* no limits at all */
198}
199tr_speedlimit_t;
200
201void tr_torrentSetSpeedMode( tr_torrent_t     * tor,
202                             int                up_or_down,
203                             tr_speedlimit_t    mode );
204
205tr_speedlimit_t tr_torrentGetSpeedMode( const tr_torrent_t * tor,
206                                        int                  up_or_down);
207
208void tr_torrentSetSpeedLimit( tr_torrent_t   * tor,
209                              int              up_or_down,
210                              int              single_KiB_sec );
211
212int tr_torrentGetSpeedLimit( const tr_torrent_t  * tor,
213                             int                   up_or_down );
214
215void tr_setUseGlobalSpeedLimit( tr_handle_t * handle,
216                                int           up_or_down,
217                                int           use_flag );
218
219void tr_setGlobalSpeedLimit( tr_handle_t * handle,
220                             int           up_or_down,
221                             int           global_KiB_sec );
222
223void tr_getGlobalSpeedLimit( tr_handle_t * handle,
224                             int           up_or_down,
225                             int         * setme_is_enabled,
226                             int         * setme_KiBsec );
227
228/***********************************************************************
229 * Torrent Priorities
230 **********************************************************************/
231
232enum
233{
234    TR_PRI_LOW    = -1,
235    TR_PRI_NORMAL =  0, /* since NORMAL is 0, memset initializes nicely */
236    TR_PRI_HIGH   =  1
237};
238
239typedef int8_t tr_priority_t;
240
241/* set a batch of files to a particular priority. */
242void tr_torrentSetFilePriorities( tr_torrent_t        * tor,
243                                  int                 * files,
244                                  int                   fileCount,
245                                  tr_priority_t         priority );
246
247
248/* single-file form of tr_torrentPrioritizeFiles.
249 * priority must be one of TR_PRI_NORMAL, _HIGH, or _LOW */
250void tr_torrentSetFilePriority( tr_torrent_t *, int file, tr_priority_t priority );
251
252/* returns a malloc()ed array of tor->info.fileCount items,
253 * each holding a value of TR_PRI_NORMAL, _HIGH, or _LOW.
254   free the array when done. */
255tr_priority_t* tr_torrentGetFilePriorities( const tr_torrent_t * );
256
257/* single-file form of tr_torrentGetFilePriorities.
258 * returns one of TR_PRI_NORMAL, _HIGH, or _LOW. */
259tr_priority_t tr_torrentGetFilePriority( const tr_torrent_t *, int file );
260
261/* returns true if the file's `download' flag is set */
262int tr_torrentGetFileDL( const tr_torrent_t *, int file );
263
264/* set a batch of files to be downloaded or not. */
265void tr_torrentSetFileDLs ( tr_torrent_t   * tor,
266                            int            * files,
267                            int              fileCount,
268                            int              do_download );
269
270/* single-file form of tr_torrentSetFileDLs */
271void tr_torrentSetFileDL( tr_torrent_t *, int file, int do_download );
272
273/***********************************************************************
274 * tr_torrentRates
275 ***********************************************************************
276 * Gets the total download and upload rates
277 **********************************************************************/
278void tr_torrentRates( tr_handle_t *, float *, float * );
279
280/***********************************************************************
281 * tr_close
282 ***********************************************************************
283 * Frees memory allocated by tr_init.
284 **********************************************************************/
285void tr_close( tr_handle_t * );
286
287
288
289/**
290 *  Load all the torrents in tr_getTorrentsDirectory().
291 *  This can be used at startup to kickstart all the torrents
292 *  from the previous session.
293 */
294tr_torrent_t ** tr_loadTorrents ( tr_handle_t  * h,
295                                  const char   * destination,
296                                  int            flags,
297                                  int          * setmeCount );
298
299
300/***********************************************************************
301 * tr_torrentInit
302 ***********************************************************************
303 * Opens and parses torrent file at 'path'. If the file exists and is
304 * a valid torrent file, returns an handle and adds it to the list of
305 * torrents (but doesn't start it). Returns NULL and sets *error
306 * otherwise. If hash is not NULL and the torrent is already loaded
307 * then it's 20-byte hash will be copied in. If the TR_FLAG_SAVE flag
308 * is passed then a copy of the torrent file will be saved.
309 **********************************************************************/
310#define TR_EINVALID     1
311#define TR_EUNSUPPORTED 2
312#define TR_EDUPLICATE   3
313#define TR_EOTHER       666
314tr_torrent_t * tr_torrentInit( tr_handle_t  * handle,
315                               const char   * metainfo_filename,
316                               const char   * destination,
317                               int            flags,
318                               int          * setme_error );
319
320typedef struct tr_info_s tr_info_t;
321
322/**
323 * Parses the specified metainfo file.
324 *
325 * Returns TR_OK if it parsed and can be added to Transmission.
326 * Returns TR_INVALID if it couldn't be parsed.
327 * Returns TR_EDUPLICATE if it parsed but can't be added.
328 *
329 * "destination" can be NULL if you don't need to know whether
330 * or not the torrent can be added.
331 *
332 " "setme_info" can be NULL if you don't need the information.
333 * If the metainfo can be parsed and setme_info is non-NULL,
334 * it will be filled with the metadata's info.  You'll need to
335 * call tr_metainfoFree( setme_info ) when done with it.
336 */
337int tr_torrentParse( const tr_handle_t  * handle,
338                     const char         * metainfo_filename,
339                     const char         * destination,
340                     tr_info_t          * setme_info );
341
342/**
343 * Parses the cached metainfo file that matches the given hash string.
344 * See tr_torrentParse() for a description of the arguments
345 */
346int
347tr_torrentParseHash( const tr_handle_t  * h,
348                     const char         * hashStr,
349                     const char         * destination,
350                     tr_info_t          * setme_info );
351
352
353/***********************************************************************
354 * tr_torrentInitData
355 ***********************************************************************
356 * Like tr_torrentInit, except the actual torrent data is passed in
357 * instead of the filename.
358 **********************************************************************/
359tr_torrent_t * tr_torrentInitData( tr_handle_t *,
360                                   const uint8_t * data, size_t size,
361                                   const char * destination,
362                                   int flags, int * error );
363
364/***********************************************************************
365 * tr_torrentInitSaved
366 ***********************************************************************
367 * Opens and parses a torrent file as with tr_torrentInit, only taking
368 * the hash string of a saved torrent file instead of a filename. There
369 * are currently no valid flags for this function.
370 **********************************************************************/
371tr_torrent_t * tr_torrentInitSaved( tr_handle_t *,
372                                    const char * hashStr,
373                                    const char * destination,
374                                    int flags, int * error );
375
376/***********************************************************************
377 * tr_torrentDisablePex
378 ***********************************************************************
379 * Disable or enable peer exchange for this torrent. Peer exchange is
380 * enabled by default, except for private torrents where pex is
381 * disabled and cannot be enabled.
382 **********************************************************************/
383void tr_torrentDisablePex( tr_torrent_t *, int disable );
384
385const tr_info_t * tr_torrentInfo( const tr_torrent_t * );
386
387#if 0
388/***********************************************************************
389 * tr_torrentScrape
390 ***********************************************************************
391 * Asks the tracker for the count of seeders and leechers. Returns 0
392 * and fills 's' and 'l' if successful. Otherwise returns 1 if the
393 * tracker doesn't support the scrape protocol, is unreachable or
394 * replied with some error. tr_torrentScrape may block up to 20 seconds
395 * before returning.
396 **********************************************************************/
397int tr_torrentScrape( tr_torrent_t *, int * s, int * l, int * d );
398#endif
399
400void   tr_torrentSetFolder( tr_torrent_t *, const char * );
401const char * tr_torrentGetFolder( const tr_torrent_t * );
402
403/***********************************************************************
404 * tr_torrentStart
405 ***********************************************************************
406 * Starts downloading. The download is launched in a seperate thread,
407 * therefore tr_torrentStart returns immediately.
408 **********************************************************************/
409void   tr_torrentStart( tr_torrent_t * );
410
411/***********************************************************************
412 * tr_torrentStop
413 ***********************************************************************
414 * Stops downloading and notices the tracker that we are leaving. The
415 * thread keeps running while doing so.
416 * The thread will eventually be joined, either:
417 * - by tr_torrentStat when the tracker has been successfully noticed,
418 * - by tr_torrentStat if the tracker could not be noticed within 60s,
419 * - by tr_torrentClose if you choose to remove the torrent without
420 *   waiting any further.
421 **********************************************************************/
422void tr_torrentStop( tr_torrent_t * );
423
424/***********************************************************************
425 * tr_getComplete, tr_getIncomplete and tr_getPartial
426 ***********************************************************************
427 * The first call after a torrent changed state returns 1. Returns 0
428 * in other cases.
429 **********************************************************************/
430int tr_getIncomplete( tr_torrent_t * tor );
431int tr_getDone( tr_torrent_t * tor );
432int tr_getComplete( tr_torrent_t * tor );
433
434
435/**
436 * MANUAL ANNOUNCE
437 *
438 * Trackers usually set an announce interval of 15 or 30 minutes.
439 * Users can send one-time announce requests that override this
440 * interval by calling tr_manualUpdate().
441 *
442 * The wait interval for tr_manualUpdate() is much smaller.
443 * You can test whether or not a manual update is possible
444 * (for example, to desensitize the button) by calling
445 * tr_torrentCanManualUpdate().
446 */
447
448void tr_manualUpdate( tr_torrent_t * );
449
450int tr_torrentCanManualUpdate( const tr_torrent_t * );
451
452/***********************************************************************
453 * tr_torrentStat
454 ***********************************************************************
455 * Returns a pointer to an tr_stat_t structure with updated information
456 * on the torrent. The structure belongs to libtransmission (do not
457 * free it) and is guaranteed to be unchanged until the next call to
458 * tr_torrentStat.
459 * The interface should call this function every second or so in order
460 * to update itself.
461 **********************************************************************/
462typedef struct tr_stat_s tr_stat_t;
463const tr_stat_t * tr_torrentStat( tr_torrent_t * );
464
465/***********************************************************************
466 * tr_torrentPeers
467 ***********************************************************************/
468typedef struct tr_peer_stat_s tr_peer_stat_t;
469tr_peer_stat_t * tr_torrentPeers( const tr_torrent_t *, int * peerCount );
470void tr_torrentPeersFree( tr_peer_stat_t *, int peerCount );
471
472typedef struct tr_file_stat_s tr_file_stat_t;
473tr_file_stat_t * tr_torrentFiles( const tr_torrent_t *, int * fileCount );
474void tr_torrentFilesFree( tr_file_stat_t *, int fileCount );
475
476
477/***********************************************************************
478 * tr_torrentAvailability
479 ***********************************************************************
480 * Use this to draw an advanced progress bar which is 'size' pixels
481 * wide. Fills 'tab' which you must have allocated: each byte is set
482 * to either -1 if we have the piece, otherwise it is set to the number
483 * of connected peers who have the piece.
484 **********************************************************************/
485void tr_torrentAvailability( const tr_torrent_t *, int8_t * tab, int size );
486
487void tr_torrentAmountFinished( const tr_torrent_t * tor, float * tab, int size );
488
489/***********************************************************************
490 * tr_torrentRemoveSaved
491 ***********************************************************************
492 * Removes the saved copy of a torrent file for torrents which the
493 * TR_FLAG_SAVE flag is set.
494 **********************************************************************/
495void tr_torrentRemoveSaved( tr_torrent_t * );
496
497void tr_torrentRecheck( tr_torrent_t * );
498
499/***********************************************************************
500 * tr_torrentClose
501 ***********************************************************************
502 * Frees memory allocated by tr_torrentInit. If the torrent was running,
503 * it is stopped first.
504 **********************************************************************/
505void tr_torrentClose( tr_torrent_t * );
506
507/***********************************************************************
508 * tr_info_s
509 **********************************************************************/
510
511typedef struct tr_file_s
512{
513    uint64_t length;                /* Length of the file, in bytes */
514    char     name[MAX_PATH_LENGTH]; /* Path to the file */
515    int8_t   priority;              /* TR_PRI_HIGH, _NORMAL, or _LOW */
516    int8_t   dnd;                   /* nonzero if the file shouldn't be downloaded */
517    int      firstPiece;            /* We need pieces [firstPiece... */
518    int      lastPiece;             /* ...lastPiece] to dl this file */
519    uint64_t offset;                /* file begins at the torrent's nth byte */
520}
521tr_file_t;
522
523typedef struct tr_piece_s
524{
525    uint8_t  hash[SHA_DIGEST_LENGTH];  /* pieces hash */
526    int8_t   priority;                 /* TR_PRI_HIGH, _NORMAL, or _LOW */
527    int8_t   dnd;                      /* nonzero if the piece shouldn't be downloaded */
528}
529tr_piece_t;
530   
531struct tr_info_s
532{
533    /* Path to torrent */
534    char                 torrent[MAX_PATH_LENGTH];
535
536    /* General info */
537    uint8_t              hash[SHA_DIGEST_LENGTH];
538    char                 hashString[2*SHA_DIGEST_LENGTH+1];
539    char                 name[MAX_PATH_LENGTH];
540
541    /* Flags */
542#define TR_FLAG_SAVE    0x01 /* save a copy of the torrent file */
543#define TR_FLAG_PRIVATE 0x02 /* do not share information for this torrent */
544#define TR_FLAG_PAUSED  0x04 /* don't start the torrent when adding it */
545    int                  flags;
546
547    /* Tracker info */
548    struct
549    {
550        tr_tracker_info_t * list;
551        int                 count;
552    }                  * trackerList;
553    int                  trackerTiers;
554    char               * primaryAddress;
555
556    /* Torrent info */
557    char                 comment[MAX_PATH_LENGTH];
558    char                 creator[MAX_PATH_LENGTH];
559    int                  dateCreated;
560
561    /* Pieces info */
562    int                  pieceSize;
563    int                  pieceCount;
564    uint64_t             totalSize;
565    tr_piece_t         * pieces;
566
567    /* Files info */
568    int                  multifile;
569    int                  fileCount;
570    tr_file_t          * files;
571};
572
573typedef enum
574{
575    TR_STATUS_CHECK_WAIT   = (1<<0), /* Waiting in queue to check files */
576    TR_STATUS_CHECK        = (1<<1), /* Checking files */
577    TR_STATUS_DOWNLOAD     = (1<<2), /* Downloading */
578    TR_STATUS_DONE         = (1<<3), /* not at 100% so can't tell the tracker
579                                        we're a seeder, but due to DND files
580                                        there's nothing we want right now */
581    TR_STATUS_SEED         = (1<<4), /* Seeding */
582    TR_STATUS_STOPPING     = (1<<5), /* Stopping -- closing connections, etc. */
583    TR_STATUS_STOPPED      = (1<<6)  /* Torrent is stopped */
584}
585torrent_status_t;
586
587#define TR_STATUS_ACTIVE \
588    (TR_STATUS_CHECK_WAIT|TR_STATUS_CHECK|TR_STATUS_DOWNLOAD|TR_STATUS_DONE|TR_STATUS_SEED)
589#define TR_STATUS_INACTIVE \
590    (TR_STATUS_STOPPING|TR_STATUS_STOPPED)
591
592typedef enum
593{
594    TR_CP_INCOMPLETE,   /* doesn't have all the desired pieces */
595    TR_CP_DONE,         /* has all the pieces but the DND ones */
596    TR_CP_COMPLETE      /* has every piece */
597}
598cp_status_t;
599
600/***********************************************************************
601 * tr_stat_s
602 **********************************************************************/
603struct tr_stat_s
604{
605    torrent_status_t    status;
606    cp_status_t         cpStatus;
607
608    int                 error;
609    char                errorString[128];
610
611    const tr_tracker_info_t * tracker;
612
613    float               recheckProgress;
614    float               percentComplete;
615    float               percentDone;
616    float               rateDownload;
617    float               rateUpload;
618    int                 eta;
619    int                 peersTotal;
620    int                 peersConnected;
621    int                 peersFrom[TR_PEER_FROM__MAX];
622    int                 peersSendingToUs;
623    int                 peersGettingFromUs;
624    int                 seeders;
625    int                 leechers;
626    int                 completedFromTracker;
627
628    uint64_t            left;
629    uint64_t            downloaded;
630    uint64_t            downloadedValid;
631    uint64_t            uploaded;
632    uint64_t            corrupt;
633    float               swarmspeed;
634
635#define TR_RATIO_NA  -1
636    float               ratio;
637   
638    uint64_t            startDate;
639    uint64_t            activityDate;
640};
641
642struct tr_file_stat_s
643{
644    uint64_t bytesCompleted;
645    float progress;
646    cp_status_t completionStatus;
647};
648
649struct tr_peer_stat_s
650{
651    char    addr[INET_ADDRSTRLEN];
652    const char * client;
653   
654    int     isConnected;
655    int     from;
656    float   progress;
657    int     port;
658   
659    int     isDownloading;
660    int     isUploading;
661    float   downloadFromRate;
662    float   uploadToRate;
663};
664
665struct tr_msg_list_s
666{
667    int                    level;
668    time_t                 when;
669    char                 * message;
670    struct tr_msg_list_s * next;
671};
672
673struct tr_tracker_info_s
674{
675    char * address;
676    int    port;
677    char * announce;
678    char * scrape;
679};
680
681struct tr_handle_status_s
682{
683#define TR_NAT_TRAVERSAL_MAPPING        1
684#define TR_NAT_TRAVERSAL_MAPPED         2
685#define TR_NAT_TRAVERSAL_NOTFOUND       3
686#define TR_NAT_TRAVERSAL_ERROR          4
687#define TR_NAT_TRAVERSAL_UNMAPPING      5
688#define TR_NAT_TRAVERSAL_DISABLED       6
689#define TR_NAT_TRAVERSAL_IS_DISABLED( st ) \
690  ( TR_NAT_TRAVERSAL_DISABLED == (st) || TR_NAT_TRAVERSAL_UNMAPPING == (st) )
691    int natTraversalStatus;
692    int publicPort;
693};
694
695#ifdef __TRANSMISSION__
696#  include "internal.h"
697#endif
698
699#ifdef __cplusplus
700}
701#endif
702
703#endif
Note: See TracBrowser for help on using the repository browser.