Changeset 9965
- Timestamp:
- Jan 19, 2010, 7:37:00 PM (13 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/announcer.c
r9928 r9965 354 354 struct tr_torrent_tiers; 355 355 356 /** 357 * A group of trackers in a single tier, 358 * as per the multitracker spec 359 */ 356 /** @brief A group of trackers in a single tier, as per the multitracker spec */ 360 357 typedef struct 361 358 { … … 470 467 ***/ 471 468 472 /* 473 * per-torrent info. 469 /** 470 * @brief Opaque, per-torrent data structure for tracker announce information 471 * 474 472 * this opaque data structure can be found in tr_torrent.tiers 475 473 */ -
trunk/libtransmission/announcer.h
r9890 r9965 37 37 TrackerEventType; 38 38 39 /** @brief Notification object to tell listeners about announce or scrape occurences */ 39 40 typedef struct 40 41 { -
trunk/libtransmission/bencode.c
r9868 r9965 1177 1177 ***/ 1178 1178 1179 /** @brief Implementation helper class for tr_bencToBuffer(TR_FMT_JSON) */ 1179 1180 struct ParentState 1180 1181 { … … 1184 1185 }; 1185 1186 1187 /** @brief Implementation helper class for tr_bencToBuffer(TR_FMT_JSON) */ 1186 1188 struct jsonWalk 1187 1189 { -
trunk/libtransmission/bencode.h
r9868 r9965 199 199 ***/ 200 200 201 /** @brief Get an int64_t from a variant object 202 @return TRUE if successful, or FALSE if the variant could not be represented as an int64_t */ 201 203 tr_bool tr_bencGetInt( const tr_benc * val, int64_t * setme ); 204 205 /** @brief Get an string from a variant object 206 @return TRUE if successful, or FALSE if the variant could not be represented as a string */ 202 207 tr_bool tr_bencGetStr( const tr_benc * val, const char ** setme ); 208 209 /** @brief Get a boolean from a variant object 210 @return TRUE if successful, or FALSE if the variant could not be represented as a boolean */ 203 211 tr_bool tr_bencGetBool( const tr_benc * val, tr_bool * setme ); 212 213 /** @brief Get a floating-point number from a variant object 214 @return TRUE if successful, or FALSE if the variant could not be represented as a floating-point number */ 204 215 tr_bool tr_bencGetReal( const tr_benc * val, double * setme ); 205 216 206 217 static inline tr_bool tr_bencIsType ( const tr_benc * b, int type ) { return ( b != NULL ) && ( b->type == type ); } 218 207 219 static inline tr_bool tr_bencIsInt ( const tr_benc * b ) { return tr_bencIsType( b, TR_TYPE_INT ); } 208 220 static inline tr_bool tr_bencIsDict ( const tr_benc * b ) { return tr_bencIsType( b, TR_TYPE_DICT ); } … … 212 224 static inline tr_bool tr_bencIsReal ( const tr_benc * b ) { return tr_bencIsType( b, TR_TYPE_REAL ); } 213 225 214 /** 215 *** Treat these as private -- they're only made public here 216 *** so that the unit tests can find them 217 **/ 218 226 /** @brief Private function that's exposed here only for unit tests */ 219 227 int tr_bencParseInt( const uint8_t * buf, 220 228 const uint8_t * bufend, … … 222 230 int64_t * setme_val ); 223 231 232 /** @brief Private function that's exposed here only for unit tests */ 224 233 int tr_bencParseStr( const uint8_t * buf, 225 234 const uint8_t * bufend, -
trunk/libtransmission/bitfield.h
r9931 r9965 21 21 #include "utils.h" /* tr_new0 */ 22 22 23 /** @brief Implementation of the BitTorrent spec's Bitfield array of bits */ 23 24 typedef struct tr_bitfield 24 25 { -
trunk/libtransmission/bitset.h
r9934 r9965 23 23 #include "bitfield.h" 24 24 25 /** Thislike a tr_bitfield, but supports haveAll and haveNone */25 /** @brief like a tr_bitfield, but supports haveAll and haveNone */ 26 26 typedef struct tr_bitset 27 27 { -
trunk/libtransmission/clients.h
r9868 r9965 19 19 20 20 /** 21 * @brief parse a peer-id into a human-readable client name and version number 21 22 * @ingroup utils 22 23 */ -
trunk/libtransmission/crypto.c
r9868 r9965 87 87 static const uint8_t dh_G[] = { 2 }; 88 88 89 /** @brief Holds state information for encrypted peer communications */ 89 90 struct tr_crypto 90 91 { -
trunk/libtransmission/crypto.h
r9891 r9965 29 29 30 30 /** 31 * @addtogroup utils Utilities32 33 31 *** @addtogroup peers 32 *** @{ 33 **/ 34 34 35 35 typedef struct tr_crypto tr_crypto; 36 36 37 /** 38 *** 39 **/ 37 /** @brief create a new tr_crypto object */ 38 tr_crypto* tr_cryptoNew( const uint8_t * torrentHash, int isIncoming ); 40 39 41 tr_crypto* tr_cryptoNew( const uint8_t * torrentHash, 42 int isIncoming ); 43 40 /** @brief destroy an existing tr_crypto object */ 44 41 void tr_cryptoFree( tr_crypto * crypto ); 45 42 46 /**47 ***48 **/49 43 50 void tr_cryptoSetTorrentHash( tr_crypto * crypto, 51 const uint8_t * torrentHash ); 44 void tr_cryptoSetTorrentHash( tr_crypto * crypto, const uint8_t * torrentHash ); 52 45 53 46 const uint8_t* tr_cryptoGetTorrentHash( const tr_crypto * crypto ); 54 47 55 48 int tr_cryptoHasTorrentHash( const tr_crypto * crypto ); 56 57 /**58 ***59 **/60 49 61 50 const uint8_t* tr_cryptoComputeSecret( tr_crypto * crypto, … … 72 61 void * buf_out ); 73 62 74 /**75 ***76 **/77 78 63 void tr_cryptoEncryptInit( tr_crypto * crypto ); 79 64 … … 83 68 void * buf_out ); 84 69 85 void tr_sha1( uint8_t * setme, 86 const void * content1, 87 int content1_len, 88 ... ) TR_GNUC_NULL_TERMINATED; 70 /* @} */ 71 72 /** 73 *** @addtogroup utils Utilities 74 *** @{ 75 **/ 89 76 90 77 91 /** @brief Returns a random number in the range of [0...n) */ 92 int tr_cryptoRandInt( int n ); 78 /** @brief generate a SHA1 hash from one or more chunks of memory */ 79 void tr_sha1( uint8_t * setme, 80 const void * content1, 81 int content1_len, 82 ... ) TR_GNUC_NULL_TERMINATED; 83 84 85 /** @brief returns a random number in the range of [0...n) */ 86 int tr_cryptoRandInt( int n ); 93 87 94 88 /** 95 * @brief Returns a vaguely random number in the range of [0...n).89 * @brief returns a pseudorandom number in the range of [0...n) 96 90 * 97 91 * This is faster, BUT WEAKER, than tr_cryptoRandInt() and never … … 101 95 int tr_cryptoWeakRandInt( int n ); 102 96 103 /** @brief Fillsa buffer with random bytes */104 void 97 /** @brief fill a buffer with random bytes */ 98 void tr_cryptoRandBuf( void * buf, size_t len ); 105 99 106 char* tr_ssha1( const void * plaintext ); 100 /** @brief generate a SSHA password from its plaintext source */ 101 char* tr_ssha1( const void * plaintext ); 107 102 108 tr_bool tr_ssha1_matches( const char * source, const char * pass ); 103 /** @brief Validate a test password against the a ssha1 password */ 104 tr_bool tr_ssha1_matches( const char * ssha1, const char * pass ); 109 105 110 106 /* @} */ -
trunk/libtransmission/peer-mgr.c
r9920 r9965 161 161 }; 162 162 163 /** @brief Opaque, per-torrent data structure for peer connection information */ 163 164 typedef struct tr_torrent_peers 164 165 { -
trunk/libtransmission/platform.c
r9868 r9965 79 79 } 80 80 81 /** @brief portability wrapper around OS-dependent threads */ 81 82 struct tr_thread 82 83 { … … 143 144 ***/ 144 145 146 /** @brief portability wrapper around OS-dependent thread mutexes */ 145 147 struct tr_lock 146 148 { … … 379 381 380 382 void 381 tr_setConfigDir( tr_session * session, 382 const char * configDir ) 383 tr_setConfigDir( tr_session * session, const char * configDir ) 383 384 { 384 385 char * path; -
trunk/libtransmission/platform.h
r9931 r9965 36 36 37 37 /** 38 * @addtogroup tr_session Session 39 * @{ 40 */ 41 42 /** 43 * @brief invoked by tr_sessionInit() to set up the locations of the resume, torrent, and clutch directories. 44 * @see tr_getResumeDir() 45 * @see tr_getTorrentDir() 46 * @see tr_getClutchDir() 47 */ 48 void tr_setConfigDir( tr_session * session, const char * configDir ); 49 50 /** @brief return the directory where .resume files are stored */ 51 const char * tr_getResumeDir( const tr_session * ); 52 53 /** @brief return the directory where .torrent files are stored */ 54 const char * tr_getTorrentDir( const tr_session * ); 55 56 /** @brief return the directory where Clutch's web ui files are kept */ 57 const char * tr_getClutchDir( const tr_session * ); 58 59 /** @} */ 60 61 62 /** 38 63 * @addtogroup utils Utilities 39 64 * @{ 40 65 */ 41 66 42 typedef struct tr_lock tr_lock;43 67 typedef struct tr_thread tr_thread; 44 45 void tr_setConfigDir( tr_session * session,46 const char * configDir );47 48 const char * tr_getResumeDir( const tr_session * );49 50 const char * tr_getTorrentDir( const tr_session * );51 52 const char * tr_getClutchDir( const tr_session * );53 54 55 /***56 ****57 ***/58 68 59 69 /** @brief Instantiate a new process thread */ … … 67 77 **** 68 78 ***/ 79 80 typedef struct tr_lock tr_lock; 69 81 70 82 /** @brief Create a new thread mutex object */ … … 84 96 85 97 #ifdef WIN32 86 void * mmap( void *ptr, 87 long size, 88 long prot, 89 long type, 90 long handle, 91 long arg ); 98 void * mmap( void *ptr, long size, long prot, long type, long handle, long arg ); 92 99 93 long munmap( void *ptr, 94 long size ); 95 100 long munmap( void *ptr, long size ); 96 101 #endif 97 102 -
trunk/libtransmission/session.c
r9932 r9965 577 577 if( usec < min ) usec = min; 578 578 tr_timerAdd( session->nowTimer, 0, usec ); 579 580 /* update libtransmission's epoch time */ 579 581 tr_timeUpdate( tv.tv_sec ); 580 /* fprintf( stderr, "time %zu sec, %zu microsec\n", (size_t)tr_time(), (size_t)tv.tv_usec ); 582 /* fprintf( stderr, "time %zu sec, %zu microsec\n", (size_t)tr_time(), (size_t)tv.tv_usec ); */ 581 583 } 582 584 -
trunk/libtransmission/stats.c
r9868 r9965 24 24 static struct tr_session_stats STATS_INIT = { 0.0f, 0, 0, 0, 0, 0 }; 25 25 26 /** @brief Opaque, per-session data structure for bandwidth use statistics */ 26 27 struct tr_stats_handle 27 28 { -
trunk/libtransmission/torrent.h
r9868 r9965 135 135 struct tr_incomplete_metadata; 136 136 137 /** @brief Torrent object */ 137 138 struct tr_torrent 138 139 { -
trunk/libtransmission/transmission.h
r9928 r9965 341 341 342 342 /** 343 * @brief Set the per-session incomplete download folder.343 * @brief set the per-session incomplete download folder. 344 344 * 345 345 * When you add a new torrent and the session's incomplete directory is enabled, … … 361 361 void tr_sessionSetIncompleteDir( tr_session * session, const char * dir ); 362 362 363 /** @brief get the per-session incomplete download folder */ 363 364 const char* tr_sessionGetIncompleteDir( const tr_session * session ); 364 365 366 /** @brief enable or disable use of the incomplete download folder */ 365 367 void tr_sessionSetIncompleteDirEnabled( tr_session * session, tr_bool ); 366 368 369 /** @brief get whether or not the incomplete download folder is enabled */ 367 370 tr_bool tr_sessionIsIncompleteDirEnabled( const tr_session * session ); 368 371 … … 379 382 void tr_sessionSetIncompleteFileNamingEnabled( tr_session * session, tr_bool ); 380 383 384 /** @brief return whether or filenames will have ".part" at the end until they're complete */ 381 385 tr_bool tr_sessionIsIncompleteFileNamingEnabled( const tr_session * session ); 382 386 … … 539 543 **/ 540 544 545 /** @brief Used by tr_sessionGetStats() and tr_sessionGetCumulativeStats() to give bandwidth statistics */ 541 546 typedef struct tr_session_stats 542 547 { … … 550 555 tr_session_stats; 551 556 552 /* stats from the current session. */ 553 void tr_sessionGetStats( const tr_session * session, 554 tr_session_stats * setme ); 555 556 /* stats from the current and past sessions. */ 557 void tr_sessionGetCumulativeStats( const tr_session * session, 558 tr_session_stats * setme ); 559 560 void tr_sessionClearStats( tr_session * session ); 561 562 /** 563 * Set whether or not torrents are allowed to do peer exchanges. 557 /** @brief Get bandwidth use statistics about the current session */ 558 void tr_sessionGetStats( const tr_session * session, tr_session_stats * setme ); 559 560 /** @brief Get cumulative bandwidth use statistics for the current and past sessions */ 561 void tr_sessionGetCumulativeStats( const tr_session * session, tr_session_stats * setme ); 562 563 void tr_sessionClearStats( tr_session * session ); 564 565 /** 566 * @brief Set whether or not torrents are allowed to do peer exchanges. 567 * 564 568 * PEX is always disabled in private torrents regardless of this. 565 569 * In public torrents, PEX is enabled by default. 566 570 */ 567 void tr_sessionSetPexEnabled( tr_session * session, 568 tr_bool isEnabled ); 571 void tr_sessionSetPexEnabled( tr_session * session, tr_bool isEnabled ); 569 572 570 573 tr_bool tr_sessionIsPexEnabled( const tr_session * session ); … … 1640 1643 tr_stat_errtype; 1641 1644 1642 /** 1643 * @brief Describes a torrent's status 1644 * @see tr_torrentStat() 1645 */ 1645 /** @brief Used by tr_torrentStat() to tell clients about a torrent's state and statistics */ 1646 1646 typedef struct tr_stat 1647 1647 { -
trunk/libtransmission/utils.h
r9891 r9965 520 520 ***/ 521 521 522 /** @brief Private libtransmission variable that's visible only for inlining in tr_time() */ 522 523 extern time_t transmission_now; 523 524
Note: See TracChangeset
for help on using the changeset viewer.