source: branches/encryption/libtransmission/transmission.h @ 2995

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

add an `isEncrypted' field to tr_peer_stat, so the GUI can show which connections are encrypted with a lock icon or something

  • Property svn:keywords set to Date Rev Author Id
File size: 26.5 KB
Line 
1/******************************************************************************
2 * $Id: transmission.h 2995 2007-09-09 01:52:14Z 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 tr_handle;
105typedef struct tr_handle tr_handle_t;
106tr_handle * tr_init( const char * tag );
107
108typedef struct tr_tracker_info_s tr_tracker_info_t;
109
110/***********************************************************************
111 * tr_setMessageLevel
112 ***********************************************************************
113 * Set the level of messages to be output or queued
114 **********************************************************************/
115#define TR_MSG_ERR 1
116#define TR_MSG_INF 2
117#define TR_MSG_DBG 3
118void tr_setMessageLevel( int );
119int tr_getMessageLevel( void );
120
121/***********************************************************************
122 * tr_setMessageQueuing
123 ***********************************************************************
124 * Enable or disable message queuing
125 **********************************************************************/
126typedef struct tr_msg_list_s tr_msg_list_t;
127void tr_setMessageQueuing( int );
128
129/***********************************************************************
130 * tr_getQueuedMessages
131 ***********************************************************************
132 * Return a list of queued messages
133 **********************************************************************/
134tr_msg_list_t * tr_getQueuedMessages( void );
135void tr_freeMessageList( tr_msg_list_t * list );
136
137/***********************************************************************
138 * tr_getPrefsDirectory
139 ***********************************************************************
140 * Returns the full path to a directory which can be used to store
141 * preferences. The string belongs to libtransmission, do not free it.
142 **********************************************************************/
143const char * tr_getPrefsDirectory( void );
144
145/***********************************************************************
146 * tr_setBindPort
147 ***********************************************************************
148 * Sets the port to listen for incoming peer connections.
149 * This can be safely called even with active torrents.
150 **********************************************************************/
151void tr_setBindPort( tr_handle *, int );
152
153int tr_getPublicPort( const tr_handle * );
154
155/***********************************************************************
156 * tr_natTraversalEnable
157 * tr_natTraversalDisable
158 ***********************************************************************
159 * Enable or disable NAT traversal using NAT-PMP or UPnP IGD.
160 **********************************************************************/
161void tr_natTraversalEnable( tr_handle *, int enable );
162
163/***********************************************************************
164 * tr_handleStatus
165 ***********************************************************************
166 * Returns some status info for the given handle.
167 **********************************************************************/
168typedef struct tr_handle_status tr_handle_status;
169typedef struct tr_handle_status tr_handle_status_t;
170tr_handle_status * tr_handleStatus( tr_handle * );
171
172
173/***********************************************************************
174 * tr_torrentCount
175 ***********************************************************************
176 * Returns the count of open torrents
177 **********************************************************************/
178int tr_torrentCount( tr_handle * h );
179
180
181/***********************************************************************
182 * tr_torrentIterate
183 ***********************************************************************
184 * Iterates on open torrents
185 **********************************************************************/
186typedef struct tr_torrent tr_torrent;
187typedef struct tr_torrent tr_torrent_t;
188typedef void (*tr_callback_t) ( tr_torrent *, void * );
189void tr_torrentIterate( tr_handle *, tr_callback_t, void * );
190
191
192/***********************************************************************
193*** Speed Limits
194**/
195
196enum { TR_UP, TR_DOWN };
197
198typedef enum
199{
200    TR_SPEEDLIMIT_GLOBAL,    /* only follow the overall speed limit */
201    TR_SPEEDLIMIT_SINGLE,    /* only follow the per-torrent limit */
202    TR_SPEEDLIMIT_UNLIMITED  /* no limits at all */
203}
204tr_speedlimit_t;
205
206void tr_torrentSetSpeedMode( tr_torrent     * tor,
207                             int              up_or_down,
208                             tr_speedlimit_t  mode );
209
210tr_speedlimit_t tr_torrentGetSpeedMode( const tr_torrent  * tor,
211                                        int                 up_or_down);
212
213void tr_torrentSetSpeedLimit( tr_torrent   * tor,
214                              int            up_or_down,
215                              int            single_KiB_sec );
216
217int tr_torrentGetSpeedLimit( const tr_torrent  * tor,
218                             int                 up_or_down );
219
220void tr_setUseGlobalSpeedLimit( tr_handle * handle,
221                                int           up_or_down,
222                                int           use_flag );
223
224void tr_setGlobalSpeedLimit( tr_handle * handle,
225                             int           up_or_down,
226                             int           global_KiB_sec );
227
228void tr_getGlobalSpeedLimit( tr_handle * handle,
229                             int           up_or_down,
230                             int         * setme_is_enabled,
231                             int         * setme_KiBsec );
232
233/***********************************************************************
234 * Torrent Priorities
235 **********************************************************************/
236
237enum
238{
239    TR_PRI_LOW    = -1,
240    TR_PRI_NORMAL =  0, /* since NORMAL is 0, memset initializes nicely */
241    TR_PRI_HIGH   =  1
242};
243
244typedef int8_t tr_priority_t;
245
246/* set a batch of files to a particular priority. */
247void tr_torrentSetFilePriorities( tr_torrent        * tor,
248                                  int               * files,
249                                  int                 fileCount,
250                                  tr_priority_t       priority );
251
252
253/* single-file form of tr_torrentPrioritizeFiles.
254 * priority must be one of TR_PRI_NORMAL, _HIGH, or _LOW */
255void tr_torrentSetFilePriority( tr_torrent *, int file, tr_priority_t priority );
256
257/* returns a malloc()ed array of tor->info.fileCount items,
258 * each holding a value of TR_PRI_NORMAL, _HIGH, or _LOW.
259   free the array when done. */
260tr_priority_t* tr_torrentGetFilePriorities( const tr_torrent * );
261
262/* single-file form of tr_torrentGetFilePriorities.
263 * returns one of TR_PRI_NORMAL, _HIGH, or _LOW. */
264tr_priority_t tr_torrentGetFilePriority( const tr_torrent *, int file );
265
266/* returns true if the file's `download' flag is set */
267int tr_torrentGetFileDL( const tr_torrent *, int file );
268
269/* set a batch of files to be downloaded or not. */
270void tr_torrentSetFileDLs ( tr_torrent   * tor,
271                            int            * files,
272                            int              fileCount,
273                            int              do_download );
274
275/* single-file form of tr_torrentSetFileDLs */
276void tr_torrentSetFileDL( tr_torrent *, int file, int do_download );
277
278/***********************************************************************
279 * tr_torrentRates
280 ***********************************************************************
281 * Gets the total download and upload rates
282 **********************************************************************/
283void tr_torrentRates( tr_handle *, float *, float * );
284
285/***********************************************************************
286 * tr_close
287 ***********************************************************************
288 * Frees memory allocated by tr_init.
289 **********************************************************************/
290void tr_close( tr_handle * );
291
292
293
294/**
295 *  Load all the torrents in tr_getTorrentsDirectory().
296 *  This can be used at startup to kickstart all the torrents
297 *  from the previous session.
298 */
299tr_torrent ** tr_loadTorrents ( tr_handle  * h,
300                                const char   * destination,
301                                int            flags,
302                                int          * setmeCount );
303
304
305/***********************************************************************
306 * tr_torrentInit
307 ***********************************************************************
308 * Opens and parses torrent file at 'path'. If the file exists and is
309 * a valid torrent file, returns an handle and adds it to the list of
310 * torrents (but doesn't start it). Returns NULL and sets *error
311 * otherwise. If hash is not NULL and the torrent is already loaded
312 * then it's 20-byte hash will be copied in. If the TR_FLAG_SAVE flag
313 * is passed then a copy of the torrent file will be saved.
314 **********************************************************************/
315#define TR_EINVALID     1
316#define TR_EUNSUPPORTED 2
317#define TR_EDUPLICATE   3
318#define TR_EOTHER       666
319tr_torrent * tr_torrentInit( tr_handle  * handle,
320                             const char   * metainfo_filename,
321                             const char   * destination,
322                             int            flags,
323                             int          * setme_error );
324
325typedef struct tr_info tr_info;
326typedef struct tr_info tr_info_t;
327
328/**
329 * Parses the specified metainfo file.
330 *
331 * Returns TR_OK if it parsed and can be added to Transmission.
332 * Returns TR_INVALID if it couldn't be parsed.
333 * Returns TR_EDUPLICATE if it parsed but can't be added.
334 *
335 * "destination" can be NULL if you don't need to know whether
336 * or not the torrent can be added.
337 *
338 " "setme_info" can be NULL if you don't need the information.
339 * If the metainfo can be parsed and setme_info is non-NULL,
340 * it will be filled with the metadata's info.  You'll need to
341 * call tr_metainfoFree( setme_info ) when done with it.
342 */
343int tr_torrentParse( const tr_handle  * handle,
344                     const char         * metainfo_filename,
345                     const char         * destination,
346                     tr_info_t          * setme_info );
347
348/**
349 * Parses the cached metainfo file that matches the given hash string.
350 * See tr_torrentParse() for a description of the arguments
351 */
352int
353tr_torrentParseHash( const tr_handle  * h,
354                     const char         * hashStr,
355                     const char         * destination,
356                     tr_info_t          * setme_info );
357
358
359/***********************************************************************
360 * tr_torrentInitData
361 ***********************************************************************
362 * Like tr_torrentInit, except the actual torrent data is passed in
363 * instead of the filename.
364 **********************************************************************/
365tr_torrent * tr_torrentInitData( tr_handle *,
366                                 const uint8_t * data, size_t size,
367                                 const char * destination,
368                                 int flags, int * error );
369
370/***********************************************************************
371 * tr_torrentInitSaved
372 ***********************************************************************
373 * Opens and parses a torrent file as with tr_torrentInit, only taking
374 * the hash string of a saved torrent file instead of a filename. There
375 * are currently no valid flags for this function.
376 **********************************************************************/
377tr_torrent * tr_torrentInitSaved( tr_handle *,
378                                  const char * hashStr,
379                                  const char * destination,
380                                  int flags, int * error );
381
382/***********************************************************************
383 * tr_torrentDisablePex
384 ***********************************************************************
385 * Disable or enable peer exchange for this torrent. Peer exchange is
386 * enabled by default, except for private torrents where pex is
387 * disabled and cannot be enabled.
388 **********************************************************************/
389void tr_torrentDisablePex( tr_torrent *, int disable );
390
391const tr_info_t * tr_torrentInfo( const tr_torrent * );
392
393#if 0
394/***********************************************************************
395 * tr_torrentScrape
396 ***********************************************************************
397 * Asks the tracker for the count of seeders and leechers. Returns 0
398 * and fills 's' and 'l' if successful. Otherwise returns 1 if the
399 * tracker doesn't support the scrape protocol, is unreachable or
400 * replied with some error. tr_torrentScrape may block up to 20 seconds
401 * before returning.
402 **********************************************************************/
403int tr_torrentScrape( tr_torrent *, int * s, int * l, int * d );
404#endif
405
406void   tr_torrentSetFolder( tr_torrent *, const char * );
407const char * tr_torrentGetFolder( const tr_torrent * );
408
409/***********************************************************************
410 * tr_torrentStart
411 ***********************************************************************
412 * Starts downloading. The download is launched in a seperate thread,
413 * therefore tr_torrentStart returns immediately.
414 **********************************************************************/
415void   tr_torrentStart( tr_torrent * );
416
417/***********************************************************************
418 * tr_torrentStop
419 ***********************************************************************
420 * Stops downloading and notices the tracker that we are leaving. The
421 * thread keeps running while doing so.
422 * The thread will eventually be joined, either:
423 * - by tr_torrentStat when the tracker has been successfully noticed,
424 * - by tr_torrentStat if the tracker could not be noticed within 60s,
425 * - by tr_torrentClose if you choose to remove the torrent without
426 *   waiting any further.
427 **********************************************************************/
428void tr_torrentStop( tr_torrent * );
429
430/***********************************************************************
431 * tr_getComplete, tr_getIncomplete and tr_getPartial
432 ***********************************************************************
433 * The first call after a torrent changed state returns 1. Returns 0
434 * in other cases.
435 **********************************************************************/
436int tr_getIncomplete( tr_torrent * tor );
437int tr_getDone( tr_torrent * tor );
438int tr_getComplete( tr_torrent * tor );
439
440
441/**
442 * MANUAL ANNOUNCE
443 *
444 * Trackers usually set an announce interval of 15 or 30 minutes.
445 * Users can send one-time announce requests that override this
446 * interval by calling tr_manualUpdate().
447 *
448 * The wait interval for tr_manualUpdate() is much smaller.
449 * You can test whether or not a manual update is possible
450 * (for example, to desensitize the button) by calling
451 * tr_torrentCanManualUpdate().
452 */
453
454void tr_manualUpdate( tr_torrent * );
455
456int tr_torrentCanManualUpdate( const tr_torrent * );
457
458/***********************************************************************
459 * tr_torrentStat
460 ***********************************************************************
461 * Returns a pointer to an tr_stat_t structure with updated information
462 * on the torrent. The structure belongs to libtransmission (do not
463 * free it) and is guaranteed to be unchanged until the next call to
464 * tr_torrentStat.
465 * The interface should call this function every second or so in order
466 * to update itself.
467 **********************************************************************/
468typedef struct tr_stat_s tr_stat_t;
469const tr_stat_t * tr_torrentStat( tr_torrent * );
470
471/***********************************************************************
472 * tr_torrentPeers
473 ***********************************************************************/
474typedef struct tr_peer_stat tr_peer_stat;
475typedef struct tr_peer_stat tr_peer_stat_t;
476tr_peer_stat * tr_torrentPeers( const tr_torrent *, int * peerCount );
477void tr_torrentPeersFree( tr_peer_stat *, int peerCount );
478
479typedef struct tr_file_stat_s tr_file_stat_t;
480tr_file_stat_t * tr_torrentFiles( const tr_torrent *, int * fileCount );
481void tr_torrentFilesFree( tr_file_stat_t *, int fileCount );
482
483
484/***********************************************************************
485 * tr_torrentAvailability
486 ***********************************************************************
487 * Use this to draw an advanced progress bar which is 'size' pixels
488 * wide. Fills 'tab' which you must have allocated: each byte is set
489 * to either -1 if we have the piece, otherwise it is set to the number
490 * of connected peers who have the piece.
491 **********************************************************************/
492void tr_torrentAvailability( const tr_torrent *, int8_t * tab, int size );
493
494void tr_torrentAmountFinished( const tr_torrent * tor, float * tab, int size );
495
496/***********************************************************************
497 * tr_torrentRemoveSaved
498 ***********************************************************************
499 * Removes the saved copy of a torrent file for torrents which the
500 * TR_FLAG_SAVE flag is set.
501 **********************************************************************/
502void tr_torrentRemoveSaved( tr_torrent * );
503
504void tr_torrentRecheck( tr_torrent * );
505
506/***********************************************************************
507 * tr_torrentClose
508 ***********************************************************************
509 * Frees memory allocated by tr_torrentInit. If the torrent was running,
510 * it is stopped first.
511 **********************************************************************/
512void tr_torrentClose( tr_torrent * );
513
514/***********************************************************************
515 * tr_info
516 **********************************************************************/
517
518typedef struct tr_file_s
519{
520    uint64_t length;                /* Length of the file, in bytes */
521    char     name[MAX_PATH_LENGTH]; /* Path to the file */
522    int8_t   priority;              /* TR_PRI_HIGH, _NORMAL, or _LOW */
523    int8_t   dnd;                   /* nonzero if the file shouldn't be downloaded */
524    int      firstPiece;            /* We need pieces [firstPiece... */
525    int      lastPiece;             /* ...lastPiece] to dl this file */
526    uint64_t offset;                /* file begins at the torrent's nth byte */
527}
528tr_file_t;
529
530typedef struct tr_piece_s
531{
532    uint8_t  hash[SHA_DIGEST_LENGTH];  /* pieces hash */
533    int8_t   priority;                 /* TR_PRI_HIGH, _NORMAL, or _LOW */
534    int8_t   dnd;                      /* nonzero if the piece shouldn't be downloaded */
535}
536tr_piece_t;
537   
538struct tr_info
539{
540    /* Path to torrent */
541    char                 torrent[MAX_PATH_LENGTH];
542
543    /* General info */
544    uint8_t              hash[SHA_DIGEST_LENGTH];
545    char                 hashString[2*SHA_DIGEST_LENGTH+1];
546    char                 name[MAX_PATH_LENGTH];
547
548    /* Flags */
549#define TR_FLAG_SAVE    0x01 /* save a copy of the torrent file */
550#define TR_FLAG_PRIVATE 0x02 /* do not share information for this torrent */
551#define TR_FLAG_PAUSED  0x04 /* don't start the torrent when adding it */
552    int                  flags;
553
554    /* Tracker info */
555    struct
556    {
557        tr_tracker_info_t * list;
558        int                 count;
559    }                  * trackerList;
560    int                  trackerTiers;
561    char               * primaryAddress;
562
563    /* Torrent info */
564    char                 comment[MAX_PATH_LENGTH];
565    char                 creator[MAX_PATH_LENGTH];
566    int                  dateCreated;
567
568    /* Pieces info */
569    int                  pieceSize;
570    int                  pieceCount;
571    uint64_t             totalSize;
572    tr_piece_t         * pieces;
573
574    /* Files info */
575    int                  multifile;
576    int                  fileCount;
577    tr_file_t          * files;
578};
579
580typedef enum
581{
582    TR_STATUS_CHECK_WAIT   = (1<<0), /* Waiting in queue to check files */
583    TR_STATUS_CHECK        = (1<<1), /* Checking files */
584    TR_STATUS_DOWNLOAD     = (1<<2), /* Downloading */
585    TR_STATUS_DONE         = (1<<3), /* not at 100% so can't tell the tracker
586                                        we're a seeder, but due to DND files
587                                        there's nothing we want right now */
588    TR_STATUS_SEED         = (1<<4), /* Seeding */
589    TR_STATUS_STOPPING     = (1<<5), /* Stopping -- closing connections, etc. */
590    TR_STATUS_STOPPED      = (1<<6)  /* Torrent is stopped */
591}
592torrent_status_t;
593
594#define TR_STATUS_ACTIVE \
595    (TR_STATUS_CHECK_WAIT|TR_STATUS_CHECK|TR_STATUS_DOWNLOAD|TR_STATUS_DONE|TR_STATUS_SEED)
596#define TR_STATUS_INACTIVE \
597    (TR_STATUS_STOPPING|TR_STATUS_STOPPED)
598
599typedef enum
600{
601    TR_CP_INCOMPLETE,   /* doesn't have all the desired pieces */
602    TR_CP_DONE,         /* has all the pieces but the DND ones */
603    TR_CP_COMPLETE      /* has every piece */
604}
605cp_status_t;
606
607/***********************************************************************
608 * tr_stat_s
609 **********************************************************************/
610struct tr_stat_s
611{
612    torrent_status_t    status;
613    cp_status_t         cpStatus;
614
615    int                 error;
616    char                errorString[128];
617
618    const tr_tracker_info_t * tracker;
619
620    float               recheckProgress;
621    float               percentComplete;
622    float               percentDone;
623    float               rateDownload;
624    float               rateUpload;
625    int                 eta;
626    int                 peersTotal;
627    int                 peersConnected;
628    int                 peersFrom[TR_PEER_FROM__MAX];
629    int                 peersSendingToUs;
630    int                 peersGettingFromUs;
631    int                 seeders;
632    int                 leechers;
633    int                 completedFromTracker;
634
635    uint64_t            left;
636    uint64_t            downloaded;
637    uint64_t            downloadedValid;
638    uint64_t            uploaded;
639    uint64_t            corrupt;
640    float               swarmspeed;
641
642#define TR_RATIO_NA  -1
643    float               ratio;
644   
645    uint64_t            startDate;
646    uint64_t            activityDate;
647};
648
649struct tr_file_stat_s
650{
651    uint64_t bytesCompleted;
652    float progress;
653    cp_status_t completionStatus;
654};
655
656struct tr_peer_stat
657{
658    char    addr[INET_ADDRSTRLEN];
659    const char * client;
660   
661    unsigned int isConnected   : 1;
662    unsigned int isEncrypted   : 1;
663    unsigned int isDownloading : 1;
664    unsigned int isUploading   : 1;
665
666    uint8_t  from;
667    uint16_t port;
668   
669    float progress;
670    float downloadFromRate;
671    float uploadToRate;
672};
673
674struct tr_msg_list_s
675{
676    int                    level;
677    time_t                 when;
678    char                 * message;
679    struct tr_msg_list_s * next;
680};
681
682struct tr_tracker_info_s
683{
684    char * address;
685    int    port;
686    char * announce;
687    char * scrape;
688};
689
690struct tr_handle_status
691{
692#define TR_NAT_TRAVERSAL_MAPPING        1
693#define TR_NAT_TRAVERSAL_MAPPED         2
694#define TR_NAT_TRAVERSAL_NOTFOUND       3
695#define TR_NAT_TRAVERSAL_ERROR          4
696#define TR_NAT_TRAVERSAL_UNMAPPING      5
697#define TR_NAT_TRAVERSAL_DISABLED       6
698#define TR_NAT_TRAVERSAL_IS_DISABLED( st ) \
699  ( TR_NAT_TRAVERSAL_DISABLED == (st) || TR_NAT_TRAVERSAL_UNMAPPING == (st) )
700    int natTraversalStatus;
701    int publicPort;
702};
703
704#ifdef __TRANSMISSION__
705#  include "internal.h"
706#endif
707
708#ifdef __cplusplus
709}
710#endif
711
712#endif
Note: See TracBrowser for help on using the repository browser.