Changeset 6795 for trunk/libtransmission/transmission.h
- Timestamp:
- Sep 23, 2008, 7:11:04 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/transmission.h
r6782 r6795 41 41 #include <inttypes.h> /* uintN_t */ 42 42 #ifndef PRId64 43 #define PRId64 "lld"43 #define PRId64 "lld" 44 44 #endif 45 45 #ifndef PRIu64 46 #define PRIu64 "llu"46 #define PRIu64 "llu" 47 47 #endif 48 48 #include <time.h> /* time_t */ … … 51 51 52 52 #ifdef __BEOS__ 53 #include <StorageDefs.h>54 #define MAX_PATH_LENGTH B_FILE_NAME_LENGTH53 #include <StorageDefs.h> 54 #define MAX_PATH_LENGTH B_FILE_NAME_LENGTH 55 55 #else 56 #define MAX_PATH_LENGTH 102456 #define MAX_PATH_LENGTH 1024 57 57 #endif 58 58 … … 97 97 typedef enum 98 98 { 99 TR_PROXY_HTTP,100 TR_PROXY_SOCKS4,101 TR_PROXY_SOCKS599 TR_PROXY_HTTP, 100 TR_PROXY_SOCKS4, 101 TR_PROXY_SOCKS5 102 102 } 103 103 tr_proxy_type; 104 104 105 105 /** @see tr_sessionInitFull */ 106 #define TR_DEFAULT_CONFIG_DIR tr_getDefaultConfigDir( )106 #define TR_DEFAULT_CONFIG_DIR tr_getDefaultConfigDir( ) 107 107 /** @see tr_sessionInitFull */ 108 108 #define TR_DEFAULT_PEX_ENABLED 1 … … 219 219 * Verbosity level of libtransmission's logging mechanism. 220 220 * Must be one of #TR_MSG_ERR, #TR_MSG_INF, #TR_MSG_DBG. 221 * 221 * 222 222 * @param isMessageQueueingEnabled 223 223 * If true, then messages will build up in a queue until … … 227 227 * If true, then Transmission will not allow peer connections 228 228 * to the IP addressess specified in the blocklist. 229 * 229 * 230 230 * @param peerSocketTOS 231 231 * … … 249 249 * @see tr_sessionClose() 250 250 */ 251 tr_handle * tr_sessionInitFull( const char *configDir,252 const char *tag,253 const char *downloadDir,254 int 255 int 256 int 257 tr_encryption_mode 258 int 259 int 260 int 261 int 262 int 263 int 264 int 265 int 266 int 267 int 268 int 269 int 270 const char *rpcAccessControlList,271 int 272 const char *rpcUsername,273 const char * rpcPassword,274 int 275 const char *proxy,276 int 277 tr_proxy_type 278 int 279 const char *proxyUsername,280 const char *proxyPassword );251 tr_handle * tr_sessionInitFull( const char * configDir, 252 const char * tag, 253 const char * downloadDir, 254 int isPexEnabled, 255 int isPortForwardingEnabled, 256 int publicPort, 257 tr_encryption_mode encryptionMode, 258 int useLazyBitfield, 259 int useUploadLimit, 260 int uploadLimit, 261 int useDownloadLimit, 262 int downloadLimit, 263 int peerLimit, 264 int messageLevel, 265 int isMessageQueueingEnabled, 266 int isBlocklistEnabled, 267 int peerSocketTOS, 268 int rpcIsEnabled, 269 int rpcPort, 270 const char * rpcAccessControlList, 271 int rpcPasswordIsEnabled, 272 const char * rpcUsername, 273 const char * rpcPassword, 274 int proxyIsEnabled, 275 const char * proxy, 276 int proxyPort, 277 tr_proxy_type proxyType, 278 int proxyAuthIsEnabled, 279 const char * proxyUsername, 280 const char * proxyPassword ); 281 281 282 282 283 283 /** @brief Shorter form of tr_sessionInitFull() 284 @deprecated Use tr_sessionInitFull() instead. */ 285 tr_handle * tr_sessionInit( const char * configDir,286 const char * downloadDir,287 const char * tag );284 @deprecated Use tr_sessionInitFull() instead. */ 285 tr_handle * tr_sessionInit( const char * configDir, 286 const char * downloadDir, 287 const char * tag ); 288 288 289 289 /** @brief End a libtransmission session 290 290 @see tr_sessionInitFull() */ 291 void tr_sessionClose( tr_handle * );291 void tr_sessionClose( tr_handle * ); 292 292 293 293 /** … … 305 305 * @see tr_ctorSetDownloadDir() 306 306 */ 307 void tr_sessionSetDownloadDir( tr_handle *, const char * downloadDir ); 308 309 /** 307 void tr_sessionSetDownloadDir( 308 tr_handle *, 309 const char * 310 downloadDir ); 311 312 /** 310 313 * @brief Get the default download folder for new torrents. 311 314 * … … 318 321 * @brief Set whether or not RPC calls are allowed in this session. 319 322 * 320 * @details If true, libtransmission will open a server socket to listen 323 * @details If true, libtransmission will open a server socket to listen 321 324 * for incoming http RPC requests as described in docs/rpc-spec.txt. 322 325 * … … 324 327 * queried by tr_sessionIsRPCEnabled(). 325 328 */ 326 void tr_sessionSetRPCEnabled( tr_handle *, int isEnabled ); 329 void tr_sessionSetRPCEnabled( tr_handle *, 330 int isEnabled ); 327 331 328 332 /** @brief Get whether or not RPC calls are allowed in this session. 329 333 @see tr_sessionInitFull() 330 334 @see tr_sessionSetRPCEnabled() */ 331 int tr_sessionIsRPCEnabled( const tr_handle * handle );335 int tr_sessionIsRPCEnabled( const tr_handle * handle ); 332 336 333 337 /** @brief Specify which port to listen for RPC requests on. 334 338 @see tr_sessionInitFull() 335 339 @see tr_sessionGetRPCPort */ 336 void tr_sessionSetRPCPort( tr_handle *, int port ); 340 void tr_sessionSetRPCPort( tr_handle *, 341 int port ); 337 342 338 343 /** @brief Get which port to listen for RPC requests on. 339 344 @see tr_sessionInitFull() 340 345 @see tr_sessionSetRPCPort */ 341 int tr_sessionGetRPCPort( const tr_handle * );346 int tr_sessionGetRPCPort( const tr_handle * ); 342 347 343 348 /** 344 349 * @brief test an ACL's syntax without modifying the RPC settings. 345 * 350 * 346 351 * ACL is a comma separated list of IP subnets, each subnet is prepended 347 352 * by a '+' or '-' sign to denote 'allow' or 'deny'. If the subnet mask … … 362 367 * @return 0 on success, -1 on failure due to an unparseable ACL. 363 368 */ 364 int tr_sessionTestRPCACL( const tr_handle 365 const char *acl,366 char **allocme_errmsg );369 int tr_sessionTestRPCACL( const tr_handle * session, 370 const char * acl, 371 char ** allocme_errmsg ); 367 372 368 373 /** 369 374 * @brief Specify access control list (ACL). 370 ACL is a comma separated list375 ACL is a comma separated list 371 376 * of IP subnets, each subnet is prepended by a '-' or '+' sign. 372 377 * Plus means allow, minus means deny. If the subnet mask is omitted, … … 384 389 * @see tr_sessionGetRPCACL 385 390 */ 386 int tr_sessionSetRPCACL( tr_session* session,387 const char* acl,388 char **allocme_errmsg );391 int tr_sessionSetRPCACL( tr_session * session, 392 const char * acl, 393 char ** allocme_errmsg ); 389 394 390 395 /** @brief get the Access Control List for allowing/denying RPC requests. … … 394 399 char* tr_sessionGetRPCACL( const tr_session * ); 395 400 396 void tr_sessionSetRPCPassword( tr_session 397 const char 398 399 void tr_sessionSetRPCUsername( tr_session 400 const char 401 void tr_sessionSetRPCPassword( tr_session * session, 402 const char * password ); 403 404 void tr_sessionSetRPCUsername( tr_session * session, 405 const char * username ); 401 406 402 407 /** @brief get the password used to restrict RPC requests. … … 409 414 410 415 void tr_sessionSetRPCPasswordEnabled( tr_session * session, 411 int isEnabled );416 int isEnabled ); 412 417 413 418 int tr_sessionIsRPCPasswordEnabled( const tr_session * session ); … … 434 439 * need to keep the torrent alive long enough to cleanly close 435 440 * some resources in another thread. */ 436 TR_RPC_NOREMOVE = ( 1<<1)441 TR_RPC_NOREMOVE = ( 1 << 1 ) 437 442 } 438 443 tr_rpc_callback_status; 439 444 440 typedef tr_rpc_callback_status ( *tr_rpc_func )( tr_session * handle, 441 tr_rpc_callback_type type, 442 struct tr_torrent * tor_or_null, 443 void * user_data ); 444 445 void tr_sessionSetRPCCallback( tr_session * handle, 446 tr_rpc_func func, 447 void * user_data ); 445 typedef tr_rpc_callback_status ( *tr_rpc_func )( tr_session * 446 handle, 447 tr_rpc_callback_type type, 448 struct tr_torrent * 449 tor_or_null, 450 void * 451 user_data ); 452 453 void tr_sessionSetRPCCallback( tr_session * handle, 454 tr_rpc_func func, 455 void * user_data ); 448 456 449 457 /** … … 451 459 **/ 452 460 453 int tr_sessionIsProxyEnabled ( const tr_session * ); 454 int tr_sessionIsProxyAuthEnabled ( const tr_session * ); 455 const char* tr_sessionGetProxy ( const tr_session * ); 456 int tr_sessionGetProxyPort ( const tr_session * ); 457 tr_proxy_type tr_sessionGetProxyType ( const tr_session * ); 458 const char* tr_sessionGetProxyUsername ( const tr_session * ); 459 const char* tr_sessionGetProxyPassword ( const tr_session * ); 460 void tr_sessionSetProxyEnabled ( tr_session *, int isEnabled ); 461 void tr_sessionSetProxyAuthEnabled ( tr_session *, int isEnabled ); 462 void tr_sessionSetProxy ( tr_session *, const char * proxy ); 463 void tr_sessionSetProxyPort ( tr_session *, int port ); 464 void tr_sessionSetProxyType ( tr_session *, tr_proxy_type ); 465 void tr_sessionSetProxyUsername ( tr_session *, const char * username ); 466 void tr_sessionSetProxyPassword ( tr_session *, const char * password ); 461 int tr_sessionIsProxyEnabled( const tr_session * ); 462 463 int tr_sessionIsProxyAuthEnabled( const tr_session * ); 464 465 const char* tr_sessionGetProxy( const tr_session * ); 466 467 int tr_sessionGetProxyPort( const tr_session * ); 468 469 tr_proxy_type tr_sessionGetProxyType( const tr_session * ); 470 471 const char* tr_sessionGetProxyUsername( const tr_session * ); 472 473 const char* tr_sessionGetProxyPassword( const tr_session * ); 474 475 void tr_sessionSetProxyEnabled( tr_session *, 476 int isEnabled ); 477 478 void tr_sessionSetProxyAuthEnabled( tr_session *, 479 int isEnabled ); 480 481 void tr_sessionSetProxy( 482 tr_session *, 483 const char * 484 proxy ); 485 486 void tr_sessionSetProxyPort( tr_session *, 487 int port ); 488 489 void tr_sessionSetProxyType( tr_session *, 490 tr_proxy_type ); 491 492 void tr_sessionSetProxyUsername( 493 tr_session *, 494 const char * 495 username ); 496 497 void tr_sessionSetProxyPassword( 498 tr_session *, 499 const char * 500 password ); 467 501 468 502 /** … … 472 506 typedef struct tr_session_stats 473 507 { 474 float ratio;/* TR_RATIO_INF, TR_RATIO_NA, or total up/down */475 uint64_t uploadedBytes;/* total up */476 uint64_t downloadedBytes; /* total down */477 uint64_t filesAdded;/* number of files added */478 uint64_t sessionCount;/* program started N times */479 uint64_t secondsActive;/* how long Transmisson's been running */508 float ratio; /* TR_RATIO_INF, TR_RATIO_NA, or total up/down */ 509 uint64_t uploadedBytes; /* total up */ 510 uint64_t downloadedBytes; /* total down */ 511 uint64_t filesAdded; /* number of files added */ 512 uint64_t sessionCount; /* program started N times */ 513 uint64_t secondsActive; /* how long Transmisson's been running */ 480 514 } 481 515 tr_session_stats; 482 516 483 517 /* stats from the current session. */ 484 void tr_sessionGetStats( const tr_session* session,485 tr_session_stats* setme );518 void tr_sessionGetStats( const tr_session * session, 519 tr_session_stats * setme ); 486 520 487 521 /* stats from the current and past sessions. */ 488 void tr_sessionGetCumulativeStats( const tr_session* session,489 tr_session_stats* setme );490 491 void tr_sessionClearStats( tr_session * session );522 void tr_sessionGetCumulativeStats( const tr_session * session, 523 tr_session_stats * setme ); 524 525 void tr_sessionClearStats( tr_session * session ); 492 526 493 527 /** … … 496 530 * In public torrents, PEX is enabled by default. 497 531 */ 498 void tr_sessionSetPexEnabled( tr_session *, int isEnabled ); 499 500 int tr_sessionIsPexEnabled( const tr_session * ); 501 502 void tr_sessionSetLazyBitfieldEnabled( tr_handle * handle, int enabled ); 503 504 int tr_sessionIsLazyBitfieldEnabled( const tr_handle * handle ); 532 void tr_sessionSetPexEnabled( tr_session *, 533 int isEnabled ); 534 535 int tr_sessionIsPexEnabled( const tr_session * ); 536 537 void tr_sessionSetLazyBitfieldEnabled( tr_handle * handle, 538 int enabled ); 539 540 int tr_sessionIsLazyBitfieldEnabled( 541 const tr_handle * handle ); 505 542 506 543 tr_encryption_mode tr_sessionGetEncryption( tr_session * ); 507 544 508 void tr_sessionSetEncryption( tr_session *, tr_encryption_mode mode ); 545 void tr_sessionSetEncryption( 546 tr_session *, 547 tr_encryption_mode mode ); 509 548 510 549 … … 513 552 */ 514 553 515 void tr_sessionSetPortForwardingEnabled( tr_handle *, int enable ); 516 517 int tr_sessionIsPortForwardingEnabled( const tr_handle * ); 518 519 void tr_sessionSetPeerPort( tr_handle *, int ); 520 521 int tr_sessionGetPeerPort( const tr_handle * ); 554 void tr_sessionSetPortForwardingEnabled( 555 tr_handle *, 556 int enable ); 557 558 int tr_sessionIsPortForwardingEnabled( const tr_handle * ); 559 560 void tr_sessionSetPeerPort( tr_handle *, 561 int ); 562 563 int tr_sessionGetPeerPort( const tr_handle * ); 522 564 523 565 typedef enum … … 533 575 tr_port_forwarding tr_sessionGetPortForwarding( const tr_handle * ); 534 576 535 int tr_sessionCountTorrents( const tr_handle * h );577 int tr_sessionCountTorrents( const tr_handle * h ); 536 578 537 579 typedef enum … … 542 584 tr_direction; 543 585 544 void tr_sessionSetSpeedLimitEnabled( tr_handle * session, 545 tr_direction direction, 546 int isEnabled ); 547 548 void tr_sessionGetSpeed( const tr_handle * session, 549 float * overall_down_KiBs, 550 float * overall_up_KiBs ); 551 552 int tr_sessionIsSpeedLimitEnabled( const tr_handle * session, 553 tr_direction direction ); 554 555 void tr_sessionSetSpeedLimit( tr_handle * session, 556 tr_direction direction, 557 int KiB_sec ); 558 559 int tr_sessionGetSpeedLimit( const tr_handle * session, 560 tr_direction direction ); 561 562 void tr_sessionSetPeerLimit( tr_handle * handle, 563 uint16_t maxGlobalPeers ); 564 565 uint16_t tr_sessionGetPeerLimit( const tr_handle * handle ); 586 void tr_sessionSetSpeedLimitEnabled( tr_handle * session, 587 tr_direction direction, 588 int isEnabled ); 589 590 void tr_sessionGetSpeed( const tr_handle * session, 591 float * overall_down_KiBs, 592 float * overall_up_KiBs ); 593 594 int tr_sessionIsSpeedLimitEnabled( 595 const tr_handle * session, 596 tr_direction 597 direction ); 598 599 void tr_sessionSetSpeedLimit( tr_handle * session, 600 tr_direction direction, 601 int KiB_sec ); 602 603 int tr_sessionGetSpeedLimit( const tr_handle * session, 604 tr_direction direction ); 605 606 void tr_sessionSetPeerLimit( tr_handle * handle, 607 uint16_t maxGlobalPeers ); 608 609 uint16_t tr_sessionGetPeerLimit( const tr_handle * handle ); 566 610 567 611 … … 571 615 * from the previous session. 572 616 */ 573 tr_torrent ** tr_sessionLoadTorrents ( tr_handle * h, 574 tr_ctor * ctor, 575 int * setmeCount ); 576 577 617 tr_torrent ** tr_sessionLoadTorrents( tr_handle * h, 618 tr_ctor * ctor, 619 int * setmeCount ); 578 620 579 621 … … 584 626 *** 585 627 **/ 586 587 628 588 629 … … 598 639 }; 599 640 void tr_setMessageLevel( int ); 600 int tr_getMessageLevel( void ); 641 642 int tr_getMessageLevel( void ); 601 643 602 644 typedef struct tr_msg_list 603 645 { 604 646 /* TR_MSG_ERR, TR_MSG_INF, or TR_MSG_DBG */ 605 uint8_t level;647 uint8_t level; 606 648 607 649 /* The line number in the source file where this message originated */ 608 int line;650 int line; 609 651 610 652 /* Time the message was generated */ 611 time_t when;653 time_t when; 612 654 613 655 /* The torrent associated with this message, 614 656 * or a module name such as "Port Forwarding" for non-torrent messages, 615 657 * or NULL. */ 616 char * name;658 char * name; 617 659 618 660 /* The message */ 619 char * message;661 char * message; 620 662 621 663 /* The source file where this message originated */ 622 const char * file;664 const char * file; 623 665 624 666 /* linked list of messages */ … … 627 669 tr_msg_list; 628 670 629 void tr_setMessageQueuing( int enable );671 void tr_setMessageQueuing( int enable ); 630 672 631 673 tr_msg_list * tr_getQueuedMessages( void ); 632 void tr_freeMessageList( tr_msg_list * freeme ); 674 675 void tr_freeMessageList( tr_msg_list * freeme ); 633 676 634 677 /** @addtogroup Blocklists 635 678 @{ */ 636 679 637 680 /** 638 681 * Specify a range of IPs for Transmission to block. … … 652 695 * Passing NULL for a filename will clear the blocklist. 653 696 */ 654 int tr_blocklistSetContent ( tr_session* session,655 const char* filename );656 657 int tr_blocklistGetRuleCount( const tr_session * session );658 659 int tr_blocklistExists( const tr_session * session );660 661 int tr_blocklistIsEnabled( const tr_session * session );662 663 void tr_blocklistSetEnabled ( tr_session* session,664 intisEnabled );697 int tr_blocklistSetContent( tr_session * session, 698 const char * filename ); 699 700 int tr_blocklistGetRuleCount( const tr_session * session ); 701 702 int tr_blocklistExists( const tr_session * session ); 703 704 int tr_blocklistIsEnabled( const tr_session * session ); 705 706 void tr_blocklistSetEnabled( tr_session * session, 707 int isEnabled ); 665 708 666 709 … … 668 711 669 712 670 671 713 /** @addtogroup tr_ctor Torrent Instantiation 672 @{ 714 @{ 673 715 674 716 Instantiating a tr_torrent had gotten more complicated as features were 675 717 added. At one point there were four functions to check metainfo and five 676 718 to create tr_torrent. 677 719 678 720 To remedy this, a Torrent Constructor (struct tr_ctor) has been introduced: 679 721 - Simplifies the API to two functions: tr_torrentParse() and tr_torrentNew() … … 681 723 - You can specify whether or not your fields should supercede resume's. 682 724 - We can add new features to tr_ctor without breaking tr_torrentNew()'s API. 683 684 All the tr_ctor{Get,Set}*() functions with a return value return 725 726 All the tr_ctor{Get,Set}*() functions with a return value return 685 727 an error number, or zero if no error occurred. 686 728 687 729 You must call one of the SetMetainfo() functions before creating 688 730 a torrent with a tr_ctor. The other functions are optional. 689 731 690 732 You can reuse a single tr_ctor to create a batch of torrents -- 691 733 just call one of the SetMetainfo() functions between each 692 734 tr_torrentNew() call. 693 735 694 736 Every call to tr_ctorSetMetainfo*() frees the previous metainfo. 695 737 */ … … 707 749 struct tr_benc; 708 750 709 tr_ctor* tr_ctorNew ( const tr_handle * handle);710 711 void tr_ctorFree ( tr_ctor* ctor );712 713 void tr_ctorSetSave ( tr_ctor* ctor,714 intsaveMetadataInOurTorrentsDir );715 716 void tr_ctorSetDeleteSource ( tr_ctor* ctor,717 uint8_tdoDelete );718 719 int tr_ctorSetMetainfo ( tr_ctor *ctor,720 const uint8_t* metainfo,721 size_tlen );722 723 int tr_ctorSetMetainfoFromFile ( tr_ctor *ctor,724 const char* filename );725 726 int tr_ctorSetMetainfoFromHash ( tr_ctor *ctor,727 const char* hashString );751 tr_ctor* tr_ctorNew( const tr_handle * handle ); 752 753 void tr_ctorFree( tr_ctor * ctor ); 754 755 void tr_ctorSetSave( tr_ctor * ctor, 756 int saveMetadataInOurTorrentsDir ); 757 758 void tr_ctorSetDeleteSource( tr_ctor * ctor, 759 uint8_t doDelete ); 760 761 int tr_ctorSetMetainfo( tr_ctor * ctor, 762 const uint8_t * metainfo, 763 size_t len ); 764 765 int tr_ctorSetMetainfoFromFile( tr_ctor * ctor, 766 const char * filename ); 767 768 int tr_ctorSetMetainfoFromHash( tr_ctor * ctor, 769 const char * hashString ); 728 770 729 771 /** Set the maximum number of peers this torrent can connect to. 730 772 (Default: 50) */ 731 void tr_ctorSetPeerLimit ( tr_ctor *ctor,732 tr_ctorModemode,733 uint16_tpeerLimit );734 735 /** Set the download folder for the torrent being added with this ctor. 773 void tr_ctorSetPeerLimit( tr_ctor * ctor, 774 tr_ctorMode mode, 775 uint16_t peerLimit ); 776 777 /** Set the download folder for the torrent being added with this ctor. 736 778 @see tr_ctorSetDownloadDir() 737 779 @see tr_sessionInitFull() */ 738 void tr_ctorSetDownloadDir ( tr_ctor *ctor,739 tr_ctorModemode,740 const char* directory );780 void tr_ctorSetDownloadDir( tr_ctor * ctor, 781 tr_ctorMode mode, 782 const char * directory ); 741 783 742 784 /** Set whether or not the torrent begins downloading/seeding when created. 743 785 (Default: not paused) */ 744 void tr_ctorSetPaused ( tr_ctor *ctor,745 tr_ctorModemode,746 uint8_tisPaused );747 748 int tr_ctorGetPeerLimit ( const tr_ctor* ctor,749 tr_ctorModemode,750 uint16_t *setmeCount );751 752 int tr_ctorGetPaused ( const tr_ctor* ctor,753 tr_ctorModemode,754 uint8_t *setmeIsPaused );755 756 int tr_ctorGetDownloadDir ( const tr_ctor* ctor,757 tr_ctorModemode,758 const char **setmeDownloadDir );759 760 int tr_ctorGetMetainfo ( const tr_ctor *ctor,761 762 763 int tr_ctorGetSave ( const tr_ctor* ctor );764 765 int tr_ctorGetDeleteSource ( const tr_ctor* ctor,766 uint8_t *setmeDoDelete );786 void tr_ctorSetPaused( tr_ctor * ctor, 787 tr_ctorMode mode, 788 uint8_t isPaused ); 789 790 int tr_ctorGetPeerLimit( const tr_ctor * ctor, 791 tr_ctorMode mode, 792 uint16_t * setmeCount ); 793 794 int tr_ctorGetPaused( const tr_ctor * ctor, 795 tr_ctorMode mode, 796 uint8_t * setmeIsPaused ); 797 798 int tr_ctorGetDownloadDir( const tr_ctor * ctor, 799 tr_ctorMode mode, 800 const char ** setmeDownloadDir ); 801 802 int tr_ctorGetMetainfo( const tr_ctor * ctor, 803 const struct tr_benc ** setme ); 804 805 int tr_ctorGetSave( const tr_ctor * ctor ); 806 807 int tr_ctorGetDeleteSource( const tr_ctor * ctor, 808 uint8_t * setmeDoDelete ); 767 809 768 810 /* returns NULL if tr_ctorSetMetainfoFromFile() wasn't used */ 769 const char* tr_ctorGetSourceFile ( const tr_ctor* ctor );811 const char* tr_ctorGetSourceFile( const tr_ctor * ctor ); 770 812 771 813 #define TR_EINVALID 1 … … 776 818 * Returns TR_OK if it parsed and can be added to Transmission. 777 819 * Returns TR_EINVALID if it couldn't be parsed. 778 * Returns TR_EDUPLICATE if it parsed but can't be added. 820 * Returns TR_EDUPLICATE if it parsed but can't be added. 779 821 * "download-dir" must be set to test for TR_EDUPLICATE. 780 822 * … … 784 826 * caller via tr_metainfoFree(). 785 827 */ 786 int tr_torrentParse( const tr_handle* handle,787 const tr_ctor *ctor,788 tr_info *setme_info_or_NULL );789 790 /** Instantiate a single torrent. 828 int tr_torrentParse( const tr_handle * handle, 829 const tr_ctor * ctor, 830 tr_info * setme_info_or_NULL ); 831 832 /** Instantiate a single torrent. 791 833 @return 0 on success, 792 834 TR_EINVALID if the torrent couldn't be parsed, or 793 835 TR_EDUPLICATE if there's already a matching torrent object. */ 794 tr_torrent * tr_torrentNew( tr_handle *handle,795 const tr_ctor 796 int *setmeError );836 tr_torrent * tr_torrentNew( tr_handle * handle, 837 const tr_ctor * ctor, 838 int * setmeError ); 797 839 798 840 /** @} */ 799 841 800 842 /*********************************************************************** 801 ***802 *** TORRENTS803 **/843 *** 844 *** TORRENTS 845 **/ 804 846 805 847 /** @addtogroup tr_torrent Torrents … … 808 850 /** @brief Frees memory allocated by tr_torrentNew(). 809 851 Running torrents are stopped first. */ 810 void tr_torrentFree( tr_torrent * );852 void tr_torrentFree( tr_torrent * ); 811 853 812 854 /** @brief Removes our .torrent and .resume files for 813 855 this torrent, then calls tr_torrentFree(). */ 814 void tr_torrentRemove( tr_torrent * );856 void tr_torrentRemove( tr_torrent * ); 815 857 816 858 /** @brief Start a torrent */ 817 void tr_torrentStart( tr_torrent * );859 void tr_torrentStart( tr_torrent * ); 818 860 819 861 /** @brief Stop (pause) a torrent */ 820 void tr_torrentStop( tr_torrent * );862 void tr_torrentStop( tr_torrent * ); 821 863 822 864 /** … … 825 867 * Pass in a NULL pointer to get the first torrent. 826 868 */ 827 tr_torrent* tr_torrentNext( tr_handle * session, tr_torrent * ); 869 tr_torrent* tr_torrentNext( tr_handle * session, 870 tr_torrent * ); 828 871 829 872 /** … … 834 877 * tr_info.hashString. 835 878 */ 836 int tr_torrentId( const tr_torrent * );879 int tr_torrentId( const tr_torrent * ); 837 880 838 881 /**** … … 848 891 tr_speedlimit; 849 892 850 void tr_torrentSetSpeedMode( tr_torrent *tor,851 tr_directionup_or_down,852 tr_speedlimitmode );853 854 tr_speedlimit tr_torrentGetSpeedMode( const tr_torrent 855 tr_direction 856 857 void tr_torrentSetSpeedLimit( tr_torrent* tor,858 tr_directionup_or_down,859 intKiB_sec );860 861 int tr_torrentGetSpeedLimit( const tr_torrent* tor,862 tr_directiondirection );893 void tr_torrentSetSpeedMode( tr_torrent * tor, 894 tr_direction up_or_down, 895 tr_speedlimit mode ); 896 897 tr_speedlimit tr_torrentGetSpeedMode( const tr_torrent * tor, 898 tr_direction direction ); 899 900 void tr_torrentSetSpeedLimit( tr_torrent * tor, 901 tr_direction up_or_down, 902 int KiB_sec ); 903 904 int tr_torrentGetSpeedLimit( const tr_torrent * tor, 905 tr_direction direction ); 863 906 864 907 /**** … … 866 909 ****/ 867 910 868 void tr_torrentSetPeerLimit( tr_torrent* tor,869 uint16_tpeerLimit );870 871 uint16_t tr_torrentGetPeerLimit( const tr_torrent* tor );911 void tr_torrentSetPeerLimit( tr_torrent * tor, 912 uint16_t peerLimit ); 913 914 uint16_t tr_torrentGetPeerLimit( const tr_torrent * tor ); 872 915 873 916 /**** … … 889 932 * @param priority must be one of TR_PRI_NORMAL, _HIGH, or _LOW 890 933 */ 891 void tr_torrentSetFilePriorities( tr_torrent *tor,892 tr_file_index_t 893 tr_file_index_t 894 tr_priority_t 934 void tr_torrentSetFilePriorities( tr_torrent * tor, 935 tr_file_index_t * files, 936 tr_file_index_t fileCount, 937 tr_priority_t priority ); 895 938 896 939 /** … … 901 944 * It's the caller's responsibility to free() this. 902 945 */ 903 tr_priority_t* tr_torrentGetFilePriorities( const tr_torrent * );946 tr_priority_t* tr_torrentGetFilePriorities( const tr_torrent * ); 904 947 905 948 /** … … 907 950 * @return TR_PRI_NORMAL, TR_PRI_HIGH, or TR_PRI_LOW. 908 951 */ 909 tr_priority_t tr_torrentGetFilePriority( consttr_torrent *,910 tr_file_index_t file );952 tr_priority_t tr_torrentGetFilePriority( const tr_torrent *, 953 tr_file_index_t file ); 911 954 912 955 /** … … 914 957 * @return true if the file's `download' flag is set. 915 958 */ 916 int tr_torrentGetFileDL( const tr_torrent *, tr_file_index_t file ); 959 int tr_torrentGetFileDL( const tr_torrent *, 960 tr_file_index_t file ); 917 961 918 962 /** @brief Set a batch of files to be downloaded or not. */ 919 void tr_torrentSetFileDLs ( tr_torrent *tor,920 tr_file_index_t * files,921 tr_file_index_t fileCount,922 int do_download );963 void tr_torrentSetFileDLs( tr_torrent * tor, 964 tr_file_index_t * files, 965 tr_file_index_t fileCount, 966 int do_download ); 923 967 924 968 925 969 const tr_info * tr_torrentInfo( const tr_torrent * ); 926 970 927 void tr_torrentSetDownloadDir( tr_torrent *, const char * ); 928 929 const char * tr_torrentGetDownloadDir( const tr_torrent * ); 971 void tr_torrentSetDownloadDir( tr_torrent *, 972 const char * ); 973 974 const char * tr_torrentGetDownloadDir( const tr_torrent * ); 930 975 931 976 /** 932 977 *** 933 978 **/ 934 979 935 980 typedef struct tr_tracker_info 936 981 { 937 int tier;938 char * announce;939 char * scrape;982 int tier; 983 char * announce; 984 char * scrape; 940 985 } 941 986 tr_tracker_info; … … 953 998 * @param trackerCount size of the `trackers' array 954 999 */ 955 void tr_torrentSetAnnounceList( tr_torrent *torrent,956 const tr_tracker_info 957 int trackerCount );1000 void tr_torrentSetAnnounceList( tr_torrent * torrent, 1001 const tr_tracker_info * trackers, 1002 int trackerCount ); 958 1003 959 1004 … … 970 1015 cp_status_t; 971 1016 972 typedef void ( tr_torrent_status_func)(tr_torrent* torrent,973 cp_status_tstatus,974 void *user_data );1017 typedef void ( tr_torrent_status_func )( tr_torrent * torrent, 1018 cp_status_t status, 1019 void * user_data ); 975 1020 976 1021 /** … … 982 1027 * and shouldn't modify client-level memory without using a mutex! 983 1028 */ 984 void tr_torrentSetStatusCallback( tr_torrent *torrent,985 tr_torrent_status_func 986 void *user_data );1029 void tr_torrentSetStatusCallback( tr_torrent * torrent, 1030 tr_torrent_status_func func, 1031 void * user_data ); 987 1032 988 1033 void tr_torrentClearStatusCallback( tr_torrent * torrent ); … … 1004 1049 void tr_torrentManualUpdate( tr_torrent * ); 1005 1050 1006 int tr_torrentCanManualUpdate( const tr_torrent * );1051 int tr_torrentCanManualUpdate( const tr_torrent * ); 1007 1052 1008 1053 /*********************************************************************** 1009 1010 1054 * tr_torrentPeers 1055 ***********************************************************************/ 1011 1056 1012 1057 typedef struct tr_peer_stat 1013 1058 { 1014 unsigned int isEncrypted: 1;1015 unsigned int isDownloadingFrom: 1;1016 unsigned int isUploadingTo: 1;1017 1018 unsigned int peerIsChoked: 1;1019 unsigned int peerIsInterested: 1;1020 unsigned int clientIsChoked: 1;1021 unsigned int clientIsInterested : 1;1022 unsigned int isIncoming: 1;1023 1024 uint8_t from;1025 uint16_t port;1026 1027 char addr[16];1028 char client[80];1029 char flagStr[32];1030 1031 float progress;1032 float rateToPeer;1033 float rateToClient;1059 unsigned int isEncrypted : 1; 1060 unsigned int isDownloadingFrom : 1; 1061 unsigned int isUploadingTo : 1; 1062 1063 unsigned int peerIsChoked : 1; 1064 unsigned int peerIsInterested : 1; 1065 unsigned int clientIsChoked : 1; 1066 unsigned int clientIsInterested : 1; 1067 unsigned int isIncoming : 1; 1068 1069 uint8_t from; 1070 uint16_t port; 1071 1072 char addr[16]; 1073 char client[80]; 1074 char flagStr[32]; 1075 1076 float progress; 1077 float rateToPeer; 1078 float rateToClient; 1034 1079 } 1035 1080 tr_peer_stat; 1036 1081 1037 1082 tr_peer_stat * tr_torrentPeers( const tr_torrent * torrent, 1038 int *peerCount );1039 1040 void tr_torrentPeersFree( tr_peer_stat *peerStats,1041 intpeerCount );1083 int * peerCount ); 1084 1085 void tr_torrentPeersFree( tr_peer_stat * peerStats, 1086 int peerCount ); 1042 1087 1043 1088 /** … … 1051 1096 * NOTE: always free this array with tr_free() when you're done with it. 1052 1097 */ 1053 float* tr_torrentWebSpeeds( const tr_torrent * tor );1098 float* tr_torrentWebSpeeds( const tr_torrent * tor ); 1054 1099 1055 1100 typedef struct tr_file_stat 1056 1101 { 1057 uint64_t bytesCompleted;1058 float progress;1102 uint64_t bytesCompleted; 1103 float progress; 1059 1104 } 1060 1105 tr_file_stat; 1061 1106 1062 1107 tr_file_stat * tr_torrentFiles( const tr_torrent * tor, 1063 tr_file_index_t *fileCount );1064 1065 void tr_torrentFilesFree( tr_file_stat *stat,1066 tr_file_index_tfileCount );1108 tr_file_index_t * fileCount ); 1109 1110 void tr_torrentFilesFree( tr_file_stat * stat, 1111 tr_file_index_t fileCount ); 1067 1112 1068 1113 … … 1075 1120 * of connected peers who have the piece. 1076 1121 **********************************************************************/ 1077 void tr_torrentAvailability( const tr_torrent *, int8_t * tab, int size ); 1078 1079 void tr_torrentAmountFinished( const tr_torrent * tor, float * tab, int size ); 1122 void tr_torrentAvailability( const tr_torrent *, 1123 int8_t * tab, 1124 int size ); 1125 1126 void tr_torrentAmountFinished( const tr_torrent * tor, 1127 float * tab, 1128 int size ); 1080 1129 1081 1130 void tr_torrentVerify( tr_torrent * ); … … 1087 1136 typedef struct tr_file 1088 1137 { 1089 uint64_t length; /* Length of the file, in bytes */ 1090 char * name; /* Path to the file */ 1091 int8_t priority; /* TR_PRI_HIGH, _NORMAL, or _LOW */ 1092 int8_t dnd; /* nonzero if the file shouldn't be downloaded */ 1093 tr_piece_index_t firstPiece; /* We need pieces [firstPiece... */ 1094 tr_piece_index_t lastPiece; /* ...lastPiece] to dl this file */ 1095 uint64_t offset; /* file begins at the torrent's nth byte */ 1138 uint64_t length; /* Length of the file, in bytes */ 1139 char * name; /* Path to the file */ 1140 int8_t priority; /* TR_PRI_HIGH, _NORMAL, or _LOW */ 1141 int8_t dnd; /* nonzero if the file shouldn't be 1142 downloaded */ 1143 tr_piece_index_t firstPiece; /* We need pieces [firstPiece... */ 1144 tr_piece_index_t lastPiece; /* ...lastPiece] to dl this file */ 1145 uint64_t offset; /* file begins at the torrent's nth byte */ 1096 1146 } 1097 1147 tr_file; … … 1099 1149 typedef struct tr_piece 1100 1150 { 1101 uint8_t hash[SHA_DIGEST_LENGTH]; /* pieces hash */ 1102 int8_t priority; /* TR_PRI_HIGH, _NORMAL, or _LOW */ 1103 int8_t dnd; /* nonzero if the piece shouldn't be downloaded */ 1151 uint8_t hash[SHA_DIGEST_LENGTH]; /* pieces hash */ 1152 int8_t priority; /* TR_PRI_HIGH, _NORMAL, or _LOW */ 1153 int8_t dnd; /* nonzero if the piece shouldn't be 1154 downloaded */ 1104 1155 } 1105 1156 tr_piece; … … 1108 1159 { 1109 1160 /* Flags */ 1110 unsigned int isPrivate: 1;1111 unsigned int isMultifile : 1;1161 unsigned int isPrivate : 1; 1162 unsigned int isMultifile : 1; 1112 1163 1113 1164 /* General info */ 1114 uint8_t 1115 char hashString[2*SHA_DIGEST_LENGTH+1];1116 char *name;1165 uint8_t hash[SHA_DIGEST_LENGTH]; 1166 char hashString[2 * SHA_DIGEST_LENGTH + 1]; 1167 char * name; 1117 1168 1118 1169 /* Path to torrent */ 1119 char *torrent;1170 char * torrent; 1120 1171 1121 1172 /* these trackers are sorted by tier */ 1122 tr_tracker_info *trackers;1123 int 1124 1125 char **webseeds;1126 int 1173 tr_tracker_info * trackers; 1174 int trackerCount; 1175 1176 char ** webseeds; 1177 int webseedCount; 1127 1178 1128 1179 /* Torrent info */ 1129 char *comment;1130 char *creator;1131 time_t 1180 char * comment; 1181 char * creator; 1182 time_t dateCreated; 1132 1183 1133 1184 /* Pieces info */ 1134 uint32_t 1135 tr_piece_index_t 1136 uint64_t 1137 tr_piece *pieces;1185 uint32_t pieceSize; 1186 tr_piece_index_t pieceCount; 1187 uint64_t totalSize; 1188 tr_piece * pieces; 1138 1189 1139 1190 /* Files info */ 1140 tr_file_index_t 1141 tr_file *files;1191 tr_file_index_t fileCount; 1192 tr_file * files; 1142 1193 }; 1143 1194 1144 1195 typedef enum 1145 1196 { 1146 TR_STATUS_CHECK_WAIT = ( 1<<0), /* Waiting in queue to check files */1147 TR_STATUS_CHECK = ( 1<<1), /* Checking files */1148 TR_STATUS_DOWNLOAD = ( 1<<2), /* Downloading */1149 TR_STATUS_SEED = ( 1<<3), /* Seeding */1150 TR_STATUS_STOPPED = ( 1<<4) /* Torrent is stopped */1197 TR_STATUS_CHECK_WAIT = ( 1 << 0 ), /* Waiting in queue to check files */ 1198 TR_STATUS_CHECK = ( 1 << 1 ), /* Checking files */ 1199 TR_STATUS_DOWNLOAD = ( 1 << 2 ), /* Downloading */ 1200 TR_STATUS_SEED = ( 1 << 3 ), /* Seeding */ 1201 TR_STATUS_STOPPED = ( 1 << 4 ) /* Torrent is stopped */ 1151 1202 } 1152 1203 tr_torrent_status; 1153 1204 1154 #define TR_STATUS_IS_ACTIVE( s) ((s) != TR_STATUS_STOPPED)1205 #define TR_STATUS_IS_ACTIVE( s ) ( ( s ) != TR_STATUS_STOPPED ) 1155 1206 1156 1207 /** … … 1187 1238 typedef enum 1188 1239 { 1189 TR_LOCKFILE_SUCCESS = 0,1190 TR_LOCKFILE_EOPEN,1191 TR_LOCKFILE_ELOCK1240 TR_LOCKFILE_SUCCESS = 0, 1241 TR_LOCKFILE_EOPEN, 1242 TR_LOCKFILE_ELOCK 1192 1243 } tr_lockfile_state_t; 1193 1244 … … 1209 1260 typedef struct tr_stat 1210 1261 { 1211 /** The torrent's unique Id. 1262 /** The torrent's unique Id. 1212 1263 @see tr_torrentId() */ 1213 int id;1264 int id; 1214 1265 1215 1266 /** The torrent's current status */ 1216 tr_torrent_status status;1267 tr_torrent_status status; 1217 1268 1218 1269 /** Our current announce URL, or NULL if none. … … 1220 1271 metainfo has multiple trackers and the current one 1221 1272 becomes unreachable. */ 1222 char * announceURL;1273 char * announceURL; 1223 1274 1224 1275 /** Our current scrape URL, or NULL if none. … … 1226 1277 metainfo has multiple trackers and the current one 1227 1278 becomes unreachable. */ 1228 char * scrapeURL;1279 char * scrapeURL; 1229 1280 1230 1281 /** The error status for this torrent. 0 means everything's fine. */ 1231 tr_errno error;1282 tr_errno error; 1232 1283 1233 1284 /** Typically an error string returned from the tracker. */ 1234 char errorString[128];1285 char errorString[128]; 1235 1286 1236 1287 /** When tr_stat.status is TR_STATUS_CHECK or TR_STATUS_CHECK_WAIT, … … 1239 1290 Range is [0..1] 1240 1291 @see tr_stat.status */ 1241 float recheckProgress;1292 float recheckProgress; 1242 1293 1243 1294 /** How much has been downloaded of the entire torrent. 1244 1295 Range is [0..1] */ 1245 float percentComplete;1296 float percentComplete; 1246 1297 1247 1298 /** How much has been downloaded of the files the user wants. This differs … … 1249 1300 Range is [0..1] 1250 1301 @see tr_stat.leftUntilDone */ 1251 float percentDone;1302 float percentDone; 1252 1303 1253 1304 /** Download speed in KiB/s */ 1254 double rateDownload;1305 double rateDownload; 1255 1306 1256 1307 /** Upload speed in KiB/s */ 1257 double rateUpload;1258 1259 1260 1308 double rateUpload; 1309 1310 #define TR_ETA_NOT_AVAIL -1 1311 #define TR_ETA_UNKNOWN -2 1261 1312 /** Estimated number of seconds left until the torrent is done, 1262 1313 or TR_ETA_NOT_AVAIL or TR_ETA_UNKNOWN */ 1263 int eta;1314 int eta; 1264 1315 1265 1316 /** Number of peers that the tracker says this torrent has */ 1266 int peersKnown;1317 int peersKnown; 1267 1318 1268 1319 /** Number of peers that we're connected to */ 1269 int peersConnected;1320 int peersConnected; 1270 1321 1271 1322 /** How many peers we found out about from the tracker, or from pex, 1272 1323 or from incoming connections, or from our resume file. */ 1273 int peersFrom[TR_PEER_FROM__MAX];1324 int peersFrom[TR_PEER_FROM__MAX]; 1274 1325 1275 1326 /** Number of peers that are sending data to us. */ 1276 int peersSendingToUs;1327 int peersSendingToUs; 1277 1328 1278 1329 /** Number of peers that we're sending data to */ 1279 int peersGettingFromUs;1330 int peersGettingFromUs; 1280 1331 1281 1332 /** Number of webseeds that are sending data to us. */ 1282 int webseedsSendingToUs;1333 int webseedsSendingToUs; 1283 1334 1284 1335 /** Number of seeders that the tracker says this torrent has */ 1285 int seeders;1336 int seeders; 1286 1337 1287 1338 /** Number of leechers that the tracker says this torrent has */ 1288 int leechers;1339 int leechers; 1289 1340 1290 1341 /** Number of finished downloads that the tracker says torrent has */ 1291 int timesCompleted;1342 int timesCompleted; 1292 1343 1293 1344 /** Byte count of all the piece data we'll have downloaded when we're done, 1294 1345 whether or not we have it yet. [0...tr_info.totalSize] */ 1295 uint64_t sizeWhenDone;1346 uint64_t sizeWhenDone; 1296 1347 1297 1348 /** Byte count of how much data is left to be downloaded until 1298 1349 we're done -- that is, until we've got all the pieces we wanted. 1299 1350 [0...tr_info.sizeWhenDone] */ 1300 uint64_t leftUntilDone;1351 uint64_t leftUntilDone; 1301 1352 1302 1353 /** Byte count of all the piece data we want and don't have yet, 1303 1354 but that a connected peer does have. [0...leftUntilDone] */ 1304 uint64_t desiredAvailable;1355 uint64_t desiredAvailable; 1305 1356 1306 1357 /** Byte count of all the corrupt data you've ever downloaded for 1307 1358 this torrent. If you're on a poisoned torrent, this number can 1308 1359 grow very large. */ 1309 uint64_t corruptEver;1360 uint64_t corruptEver; 1310 1361 1311 1362 /** Byte count of all data you've ever uploaded for this torrent. */ 1312 uint64_t uploadedEver;1363 uint64_t uploadedEver; 1313 1364 1314 1365 /** Byte count of all the non-corrupt data you've ever downloaded 1315 1366 for this torrent. If you deleted the files and downloaded a second 1316 1367 time, this will be 2*totalSize.. */ 1317 uint64_t downloadedEver; 1318 1319 /** Byte count of all the checksum-verified data we have for this torrent. */ 1320 uint64_t haveValid; 1368 uint64_t downloadedEver; 1369 1370 /** Byte count of all the checksum-verified data we have for this torrent. 1371 */ 1372 uint64_t haveValid; 1321 1373 1322 1374 /** Byte count of all the partial piece data we have for this torrent. 1323 1375 As pieces become complete, this value may decrease as portions of it 1324 1376 are moved to `corrupt' or `haveValid'. */ 1325 uint64_t haveUnchecked;1377 uint64_t haveUnchecked; 1326 1378 1327 1379 /** This is the unmodified string returned by the tracker in response 1328 1380 to the torrent's most recent scrape request. If no request was 1329 1381 sent or there was no response, this string is empty. */ 1330 char scrapeResponse[64];1382 char scrapeResponse[64]; 1331 1383 1332 1384 /** The unmodified string returned by the tracker in response 1333 1385 to the torrent's most recent scrape request. If no request was 1334 1386 sent or there was no response, this string is empty. */ 1335 char announceResponse[64];1387 char announceResponse[64]; 1336 1388 1337 1389 /** Time the most recent scrape request was sent, 1338 1390 or zero if one hasn't been sent yet. */ 1339 time_t lastScrapeTime;1391 time_t lastScrapeTime; 1340 1392 1341 1393 /** Time when the next scrape request will be sent, … … 1343 1395 or 1 if a scrape is currently in progress s.t. 1344 1396 we haven't set a timer for the next one yet. */ 1345 time_t nextScrapeTime;1397 time_t nextScrapeTime; 1346 1398 1347 1399 /** Time the most recent announce request was sent, 1348 1400 or zero if one hasn't been sent yet. */ 1349 time_t lastAnnounceTime;1401 time_t lastAnnounceTime; 1350 1402 1351 1403 /** Time when the next reannounce request will be sent, … … 1353 1405 or 1 if an announce is currently in progress s.t. 1354 1406 we haven't set a timer for the next one yet */ 1355 time_t nextAnnounceTime;1407 time_t nextAnnounceTime; 1356 1408 1357 1409 /** If the torrent is running, this is the time at which … … 1361 1413 or 1 if an announce is currently in progress s.t. 1362 1414 we haven't set a timer for the next one yet */ 1363 time_t manualAnnounceTime;1415 time_t manualAnnounceTime; 1364 1416 1365 1417 /** A very rough estimate in KiB/s of how quickly data is being 1366 passed around between all the peers we're connected to. 1418 passed around between all the peers we're connected to. 1367 1419 Don't put too much weight in this number. */ 1368 float swarmSpeed;1420 float swarmSpeed; 1369 1421 1370 1422 #define TR_RATIO_NA -1 1371 1423 #define TR_RATIO_INF -2 1372 1424 /** TR_RATIO_INF, TR_RATIO_NA, or a regular ratio */ 1373 float ratio;1425 float ratio; 1374 1426 1375 1427 /** When the torrent was first added. */ 1376 time_t addedDate;1428 time_t addedDate; 1377 1429 1378 1430 /** When the torrent finished downloading. */ 1379 time_t doneDate;1380 1381 /** When the torrent was last started. */ 1382 time_t startDate;1431 time_t doneDate; 1432 1433 /** When the torrent was last started. */ 1434 time_t startDate; 1383 1435 1384 1436 /** The last time we uploaded or downloaded piece data on this torrent. */ 1385 time_t activityDate;1437 time_t activityDate; 1386 1438 } 1387 1439 tr_stat; … … 1398 1450 1399 1451 /** @deprecated this method will be removed in 1.40 */ 1400 void tr_torrentSetAddedDate( tr_torrent *, time_t ); 1452 void tr_torrentSetAddedDate( tr_torrent *, 1453 time_t ); 1401 1454 1402 1455 /** @deprecated this method will be removed in 1.40 */ 1403 void tr_torrentSetActivityDate( tr_torrent *, time_t ); 1456 void tr_torrentSetActivityDate( tr_torrent *, 1457 time_t ); 1404 1458 1405 1459 /** @deprecated this method will be removed in 1.40 */ 1406 void tr_torrentSetDoneDate( tr_torrent *, time_t ); 1460 void tr_torrentSetDoneDate( tr_torrent *, 1461 time_t ); 1407 1462 1408 1463 /** @} */ 1409 1464 1410 1465 #ifdef __TRANSMISSION__ 1411 #include "session.h"1466 #include "session.h" 1412 1467 #endif 1413 1468
Note: See TracChangeset
for help on using the changeset viewer.