Changeset 8561


Ignore:
Timestamp:
May 29, 2009, 7:17:12 PM (11 years ago)
Author:
charles
Message:

(trunk libT) re-start work on making libT doxygen friendly. still a long ways to go on this.

Location:
trunk/libtransmission
Files:
1 added
26 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/bandwidth.h

    r8254 r8561  
    2323
    2424struct tr_peerIo;
     25
     26/**
     27 * @addtogroup networked_io Networked IO
     28 * @{
     29 */
    2530
    2631/* these are PRIVATE IMPLEMENTATION details that should not be touched.
     
    260265                          struct tr_peerIo    * peerIo );
    261266
     267/* @} */
    262268#endif
  • trunk/libtransmission/bencode.h

    r8414 r8561  
    2121
    2222struct evbuffer;
     23
     24/**
     25 * @addtogroup tr_benc Variant
     26 *
     27 * An object that acts like a union for
     28 * integers, strings, lists, dictionaries, booleans, and floating-point numbers.
     29 * The structure is named tr_benc due to the historical reason that it was
     30 * originally tightly coupled with bencoded data.  It currently supports
     31 * being parsed from, and serialized to, both bencoded notation and json notation.
     32 *
     33 * @{
     34 */
    2335
    2436/* these are PRIVATE IMPLEMENTATION details that should not be touched.
     
    208220void  tr_bencMergeDicts( tr_benc * target, const tr_benc * source );
    209221
     222/* @} */
     223
    210224#ifdef __cplusplus
    211225}
  • trunk/libtransmission/clients-test.c

    r7783 r8561  
    4646    TEST_CLIENT( "O1008132", "Osprey 1.0.0" );
    4747
     48    /* gobbledygook */
     49    TEST_CLIENT( "-IIO\x10\x2D\x04-", "-IIO%10-%04-" );
     50    TEST_CLIENT( "-I\05O\x08\x03\x01-", "-I%05O%08%03%01-" );
     51
    4852    TEST_CLIENT(
    4953        "\x65\x78\x62\x63\x00\x38\x7A\x44\x63\x10\x2D\x6E\x9A\xD6\x72\x3B\x33\x9F\x35\xA9",
  • trunk/libtransmission/clients.c

    r8441 r8561  
    413413    if( !*buf )
    414414    {
    415         struct evbuffer * out = tr_getBuffer( );
     415        char out[32], *walk=out;
    416416        const char *in, *in_end;
    417417        for( in=(const char*)id, in_end=in+8; in!=in_end; ++in ) {
    418418            if( isprint( *in ) )
    419                 evbuffer_add_printf( out, "%c", *in );
    420             else
    421                 evbuffer_add_printf( out, "%%%02X", (unsigned int)*in );
    422         }
    423 
    424         tr_strlcpy( buf, EVBUFFER_DATA( out ), buflen );
    425         tr_releaseBuffer( out );
    426     }
    427 }
     419                *walk++ = *in;
     420            else {
     421                tr_snprintf( walk, out+sizeof(out)-walk, "%%%02X", (unsigned int)*in );
     422                walk += 3;
     423            }
     424        }
     425        *walk = '\0';
     426        tr_strlcpy( buf, out, buflen );
     427    }
     428}
  • trunk/libtransmission/clients.h

    r7632 r8561  
    1111 */
    1212
     13/**
     14 * @ingroup utils
     15 */
    1316void tr_clientForId( char       * buf,
    1417                     size_t       buflen,
  • trunk/libtransmission/crypto.h

    r8080 r8561  
    2727
    2828struct evbuffer;
     29
     30/**
     31 * @addtogroup utils Utilities
     32 * @{
     33 */
     34
    2935typedef struct tr_crypto tr_crypto;
    3036
     
    100106tr_bool        tr_ssha1_matches( const char * source, const char * pass );
    101107
     108/* @} */
     109
    102110#endif
  • trunk/libtransmission/fdlimit.h

    r8389 r8561  
    2929#include "transmission.h"
    3030#include "net.h"
     31
     32/**
     33 * @addtogroup file_io File IO
     34 * @{
     35 */
    3136
    3237void tr_fdInit( size_t openFileLimit,
     
    112117uint16_t tr_fdGetPeerLimit( void );
    113118
     119/* @} */
  • trunk/libtransmission/ggets.h

    r7197 r8561  
    4040#endif
    4141
    42 int fggets( char* *ln,
    43             FILE * f );
     42/** @ingroup utils */
     43int fggets( char* *ln, FILE * f );
    4444
    4545#define ggets( ln ) fggets( ln, stdin )
  • trunk/libtransmission/handshake.h

    r7792 r8561  
    2121#include "net.h"
    2222
     23/** @addtogroup peers Peers
     24    @{ */
     25
    2326struct tr_peerIo;
     27
     28/** @brief opaque struct holding hanshake state information.
     29           freed when the handshake is completed. */
    2430typedef struct tr_handshake tr_handshake;
    2531
     
    3137                                      void *                userData );
    3238
     39/** @brief instantiate a new handshake */
    3340tr_handshake *         tr_handshakeNew( struct tr_peerIo * io,
    3441                                        tr_encryption_mode encryptionMode,
     
    4653
    4754
     55/** @} */
    4856#endif
  • trunk/libtransmission/inout.h

    r7658 r8561  
    1919
    2020struct tr_torrent;
     21
     22/**
     23 * @addtogroup file_io File IO
     24 * @{
     25 */
    2126
    2227/**
     
    6368
    6469
     70/* @} */
    6571#endif
  • trunk/libtransmission/json.h

    r8076 r8561  
    1717#endif
    1818
     19/** @ingroup tr_benc */
    1920int tr_jsonParse( const void *     vbuf,
    2021                  size_t           len,
  • trunk/libtransmission/natpmp.h

    r7658 r8561  
    1818#define TR_NATPMP_H 1
    1919
     20/**
     21 * @addtogroup port_forwarding Port Forwarding
     22 * @{
     23 */
     24
    2025typedef struct tr_natpmp tr_natpmp;
    2126
     
    2833                                int isEnabled );
    2934
     35/* @} */
    3036#endif
  • trunk/libtransmission/peer-common.h

    r7874 r8561  
    1717#ifndef TR_PEER_H
    1818#define TR_PEER_H
     19
     20/**
     21 * @addtogroup peers Peers
     22 * @{
     23 */
    1924
    2025/**
     
    7075#endif
    7176
     77/** @} */
     78
    7279#endif
  • trunk/libtransmission/peer-io.h

    r8433 r8561  
    3636struct tr_peerIo;
    3737
     38/**
     39 * @addtogroup networked_io Networked IO
     40 * @{
     41 */
     42
    3843typedef enum
    3944{
     
    402407}
    403408
     409/* @} */
    404410
    405411#endif
  • trunk/libtransmission/peer-mgr.h

    r8550 r8561  
    2626#include "net.h"
    2727#include "publish.h" /* tr_publisher_tag */
     28
     29/**
     30 * @addtogroup peers Peers
     31 * @{
     32 */
    2833
    2934struct tr_peer_stat;
     
    183188                             tr_direction       direction );
    184189
     190/* @} */
     191
    185192#endif
  • trunk/libtransmission/peer-msgs.h

    r7658 r8561  
    2525struct tr_peer;
    2626struct tr_bitfield;
     27
     28/**
     29 * @addtogroup peers Peers
     30 * @{
     31 */
    2732
    2833typedef struct tr_peermsgs tr_peermsgs;
     
    6671
    6772
     73/* @} */
    6874#endif
  • trunk/libtransmission/platform.h

    r7632 r8561  
    3030
    3131#define MAX_STACK_ARRAY_SIZE 7168
     32
     33/**
     34 * @addtogroup utils Utilities
     35 * @{
     36 */
    3237
    3338typedef struct tr_lock   tr_lock;
     
    7479#endif
    7580
     81/* @} */
     82
    7683#endif
  • trunk/libtransmission/port-forwarding.h

    r8398 r8561  
    3333#include "net.h"
    3434
     35/**
     36 * @addtogroup port_forwarding Port Forwarding
     37 * @{
     38 */
     39
    3540struct tr_bindsockets;
    3641
     
    5156int        tr_sharedTraversalStatus( const tr_shared * );
    5257
     58/** @} */
    5359#endif
  • trunk/libtransmission/ptrarray.h

    r7663 r8561  
    3131
    3232#include "transmission.h"
     33
     34/**
     35 * @addtogroup utils Utilities
     36 * @{
     37 */
    3338
    3439/**
     
    111116                                     int compare(const void*, const void*) );
    112117
     118/* @} */
    113119#endif
  • trunk/libtransmission/rpc-server.c

    r8424 r8561  
    439439            "<p>Couldn't find Transmission's web interface files!</p>"
    440440            "<p>Users: to tell Transmission where to look, "
    441             "set the TRANSMISSION_WEB_HOME environmental "
     441            "set the TRANSMISSION_WEB_HOME environment "
    442442            "variable to the folder where the web interface's "
    443443            "index.html is located.</p>"
  • trunk/libtransmission/session.h

    r8433 r8561  
    187187};
    188188
    189 static inline tr_bool tr_isSession( const tr_session * session )
     189static TR_INLINE tr_bool tr_isSession( const tr_session * session )
    190190{
    191191    return ( session != NULL ) && ( session->magicNumber == SESSION_MAGIC_NUMBER );
    192192}
    193193
     194static TR_INLINE tr_bool tr_isPreallocationMode( tr_preallocation_mode m  )
     195{
     196    return ( m == TR_PREALLOCATE_NONE )
     197        || ( m == TR_PREALLOCATE_SPARSE )
     198        || ( m == TR_PREALLOCATE_FULL );
     199}
     200
     201static TR_INLINE tr_bool tr_isEncryptionMode( tr_encryption_mode m )
     202{
     203    return ( m == TR_CLEAR_PREFERRED )
     204        || ( m == TR_ENCRYPTION_PREFERRED )
     205        || ( m == TR_ENCRYPTION_REQUIRED );
     206}
     207
     208static TR_INLINE tr_bool tr_isPriority( tr_priority_t p )
     209{
     210    return ( p == TR_PRI_LOW )
     211        || ( p == TR_PRI_NORMAL )
     212        || ( p == TR_PRI_HIGH );
     213}
     214
    194215#endif
  • trunk/libtransmission/tr-getopt.h

    r8071 r8561  
    2929extern "C" {
    3030#endif
     31
     32/**
     33 * @addtogroup utils Utilities
     34 * @{
     35 */
    3136
    3237extern int tr_optind;
     
    7479#endif
    7580
     81/** @} */
     82
    7683#endif /* TR_GETOPT_H */
  • trunk/libtransmission/transmission.h

    r8460 r8561  
    2626 * This file defines the public API for the libtransmission library.
    2727 *
    28  * Other headers suitable for public consumption are bencode.h
    29  * and utils.h.  Most of the remaining headers in libtransmission
    30  * should be considered private to libtransmission.
     28 * Other headers with a public API are bencode.h and utils.h.
     29 * Most of the remaining headers in libtransmission are private.
    3130 */
    3231#ifndef TR_TRANSMISSION_H
     
    3736#endif
    3837
     38/***
     39****
     40****  Basic Types
     41****
     42***/
     43
    3944#include <inttypes.h> /* uintN_t */
     45#include <time.h> /* time_t */
     46
    4047#ifndef PRId64
    4148 #define PRId64 "lld"
     
    4754 #define PRIu32 "lu"
    4855#endif
    49 #include <time.h> /* time_t */
    50 
    51 #if defined( WIN32 ) && defined(_MSC_VER)
     56
     57#if defined(WIN32) && defined(_MSC_VER)
    5258 #define TR_INLINE __inline
    5359#else
     
    5763#define SHA_DIGEST_LENGTH 20
    5864#define TR_INET6_ADDRSTRLEN 46
    59 
    60 #define TR_RPC_SESSION_ID_HEADER "X-Transmission-Session-Id"
    6165
    6266typedef uint32_t tr_file_index_t;
     
    6670typedef uint8_t tr_bool;
    6771
    68 enum
    69 {
    70     TR_PRI_LOW    = -1,
    71     TR_PRI_NORMAL =  0, /* since NORMAL is 0, memset initializes nicely */
    72     TR_PRI_HIGH   =  1
    73 };
    74 
    75 typedef int8_t tr_priority_t;
    76 
    77 static TR_INLINE tr_bool tr_isPriority( tr_priority_t p )
    78 {
    79     return ( p == TR_PRI_LOW )
    80         || ( p == TR_PRI_NORMAL )
    81         || ( p == TR_PRI_HIGH );
    82 }
    83 
    84 /**
    85  * @brief returns Transmission's default configuration file directory.
    86  *
    87  * The default configuration directory is determined this way:
    88  * 1. If the TRANSMISSION_HOME environmental variable is set, its value is used.
    89  * 2. On Darwin, "${HOME}/Library/Application Support/${appname}" is used.
    90  * 3. On Windows, "${CSIDL_APPDATA}/${appname}" is used.
    91  * 4. If XDG_CONFIG_HOME is set, "${XDG_CONFIG_HOME}/${appname}" is used.
    92  * 5. ${HOME}/.config/${appname}" is used as a last resort.
    93  */
    94 const char* tr_getDefaultConfigDir( const char * appname );
    95 
    96 /**
    97  * @brief returns Transmisson's default download directory.
    98  *
    99  * The default download directory is determined this way:
    100  * 1. If the HOME environmental variable is set, "${HOME}/Downloads" is used.
    101  * 2. On Windows, "${CSIDL_MYDOCUMENTS}/Downloads" is used.
    102  * 3. Otherwise, getpwuid(getuid())->pw_dir + "/Downloads" is used.
    103  */
    104 const char* tr_getDefaultDownloadDir( void );
    105 
    10672typedef struct tr_ctor tr_ctor;
    10773typedef struct tr_info tr_info;
     
    10975typedef struct tr_session tr_session;
    11076
     77struct tr_benc;
     78
     79typedef int8_t tr_priority_t;
     80
     81#define TR_RPC_SESSION_ID_HEADER "X-Transmission-Session-Id"
     82
     83typedef enum
     84{
     85    TR_PREALLOCATE_NONE   = 0,
     86    TR_PREALLOCATE_SPARSE = 1,
     87    TR_PREALLOCATE_FULL   = 2
     88}
     89tr_preallocation_mode;
     90
     91typedef enum
     92{
     93    TR_PROXY_HTTP,
     94    TR_PROXY_SOCKS4,
     95    TR_PROXY_SOCKS5
     96}
     97tr_proxy_type;
     98
     99typedef enum
     100{
     101    TR_CLEAR_PREFERRED,
     102    TR_ENCRYPTION_PREFERRED,
     103    TR_ENCRYPTION_REQUIRED
     104}
     105tr_encryption_mode;
     106
     107
     108/***
     109****
     110****  Startup & Shutdown
     111****
     112***/
    111113
    112114/**
     
    121123 */
    122124
    123 typedef enum
    124 {
    125     TR_PREALLOCATE_NONE   = 0,
    126     TR_PREALLOCATE_SPARSE = 1,
    127     TR_PREALLOCATE_FULL   = 2
    128 }
    129 tr_preallocation_mode;
    130 
    131 static TR_INLINE tr_bool tr_isPreallocationMode( tr_preallocation_mode m  )
    132 {
    133     return ( m == TR_PREALLOCATE_NONE )
    134         || ( m == TR_PREALLOCATE_SPARSE )
    135         || ( m == TR_PREALLOCATE_FULL );
    136 }
    137 
    138 typedef enum
    139 {
    140     TR_PROXY_HTTP,
    141     TR_PROXY_SOCKS4,
    142     TR_PROXY_SOCKS5
    143 }
    144 tr_proxy_type;
    145 
    146 typedef enum
    147 {
    148     TR_CLEAR_PREFERRED,
    149     TR_ENCRYPTION_PREFERRED,
    150     TR_ENCRYPTION_REQUIRED
    151 }
    152 tr_encryption_mode;
    153 
    154 static TR_INLINE tr_bool tr_isEncryptionMode( tr_encryption_mode m )
    155 {
    156     return ( m == TR_CLEAR_PREFERRED )
    157         || ( m == TR_ENCRYPTION_PREFERRED )
    158         || ( m == TR_ENCRYPTION_REQUIRED );
    159 }
    160 
    161 
    162 #define TR_DEFAULT_BIND_ADDRESS_IPV4 "0.0.0.0"
    163 #define TR_DEFAULT_BIND_ADDRESS_IPV6 "::"
    164 #define TR_DEFAULT_OPEN_FILE_LIMIT_STR "32"
    165 #define TR_DEFAULT_RPC_WHITELIST "127.0.0.1"
    166 #define TR_DEFAULT_RPC_PORT_STR "9091"
    167 #define TR_DEFAULT_PEER_PORT_STR "51413"
    168 #define TR_DEFAULT_PEER_SOCKET_TOS_STR "0"
    169 #define TR_DEFAULT_PEER_LIMIT_GLOBAL_STR "240"
    170 #define TR_DEFAULT_PEER_LIMIT_TORRENT_STR "60"
     125/**
     126 * @brief returns Transmission's default configuration file directory.
     127 *
     128 * The default configuration directory is determined this way:
     129 * -# If the TRANSMISSION_HOME environment variable is set, its value is used.
     130 * -# On Darwin, "${HOME}/Library/Application Support/${appname}" is used.
     131 * -# On Windows, "${CSIDL_APPDATA}/${appname}" is used.
     132 * -# If XDG_CONFIG_HOME is set, "${XDG_CONFIG_HOME}/${appname}" is used.
     133 * -# ${HOME}/.config/${appname}" is used as a last resort.
     134 */
     135const char* tr_getDefaultConfigDir( const char * appname );
     136
     137/**
     138 * @brief returns Transmisson's default download directory.
     139 *
     140 * The default download directory is determined this way:
     141 * -# If the HOME environment variable is set, "${HOME}/Downloads" is used.
     142 * -# On Windows, "${CSIDL_MYDOCUMENTS}/Downloads" is used.
     143 * -# Otherwise, getpwuid(getuid())->pw_dir + "/Downloads" is used.
     144 */
     145const char* tr_getDefaultDownloadDir( void );
     146
     147
     148#define TR_DEFAULT_BIND_ADDRESS_IPV4       "0.0.0.0"
     149#define TR_DEFAULT_BIND_ADDRESS_IPV6            "::"
     150#define TR_DEFAULT_OPEN_FILE_LIMIT_STR          "32"
     151#define TR_DEFAULT_RPC_WHITELIST         "127.0.0.1"
     152#define TR_DEFAULT_RPC_PORT_STR               "9091"
     153#define TR_DEFAULT_PEER_PORT_STR             "51413"
     154#define TR_DEFAULT_PEER_SOCKET_TOS_STR           "0"
     155#define TR_DEFAULT_PEER_LIMIT_GLOBAL_STR       "240"
     156#define TR_DEFAULT_PEER_LIMIT_TORRENT_STR       "60"
    171157
    172158#define TR_PREFS_KEY_ALT_SPEED_ENABLED          "alt-speed-enabled"
     
    219205#define TR_PREFS_KEY_UPLOAD_SLOTS_PER_TORRENT   "upload-slots-per-torrent"
    220206
    221 struct tr_benc;
    222207
    223208/**
     
    244229
    245230/**
    246  * Add the session's configuration settings to the benc dictionary.
     231 * Add the session's current configuration settings to the benc dictionary.
    247232 *
    248233 * FIXME: this probably belongs in libtransmissionapp
     
    262247 * @param dictionary pointer to an uninitialized tr_benc
    263248 * @param configDir the configuration directory to find settings.json
    264  * @param appName if configDir is empty, appName is used to get the default config dir.
     249 * @param appName if configDir is empty, appName is used to find the default dir.
    265250 * @see tr_sessionGetDefaultSettings()
    266251 * @see tr_sessionInit()
     
    286271
    287272/**
    288  * Initialize a libtransmission session.
     273 * @brief Initialize a libtransmission session.
    289274 *
    290275 * For example, this will instantiate a session with all the default values:
     
    300285 *
    301286 *     tr_bencFree( &settings );
    302  * @encode
     287 * @endcode
    303288 *
    304289 * @param tag "gtk", "macosx", "daemon", etc... this is only for pre-1.30 resume files
     
    320305
    321306/**
    322  * @brief Return the session's configuration directory
     307 * @brief Return the session's configuration directory.
    323308 *
    324309 * This is where transmission stores its .torrent files, .resume files,
    325  * blocklists, etc.
     310 * blocklists, etc.  It's set in tr_transmissionInit() and is immutable
     311 * during the session.
    326312 */
    327313const char * tr_sessionGetConfigDir( const tr_session * );
     
    333319 * @see tr_ctorSetDownloadDir()
    334320 */
    335 void tr_sessionSetDownloadDir( tr_session  * session,
    336                                const char  * downloadDir );
     321void tr_sessionSetDownloadDir( tr_session * session, const char * downloadDir );
    337322
    338323/**
     
    772757
    773758
    774 /** @addtogroup tr_ctor Torrent Instantiation
     759/** @addtogroup tr_ctor Torrent Constructors
    775760    @{
    776761
     
    10311016****/
    10321017
     1018enum
     1019{
     1020    TR_PRI_LOW    = -1,
     1021    TR_PRI_NORMAL =  0, /* since NORMAL is 0, memset initializes nicely */
     1022    TR_PRI_HIGH   =  1
     1023};
    10331024
    10341025/**
     
    10851076**/
    10861077
     1078/** @brief a part of tr_info that represents a single tracker */
    10871079typedef struct tr_tracker_info
    10881080{
     
    12661258 **********************************************************************/
    12671259
     1260/** @brief a part of tr_info that represents a single file of the torrent's content */
    12681261typedef struct tr_file
    12691262{
     
    12791272tr_file;
    12801273
     1274/** @brief a part of tr_info that represents a single piece of the torrent's content */
    12811275typedef struct tr_piece
    12821276{
     
    12881282tr_piece;
    12891283
     1284/** @brief information about a torrent that comes from its metainfo file */
    12901285struct tr_info
    12911286{
     
    15821577const tr_stat * tr_torrentStatCached( tr_torrent * torrent );
    15831578
    1584 /** @deprecated this method will be removed in 1.40 */
     1579/** @deprecated */
    15851580void tr_torrentSetAddedDate( tr_torrent * torrent,
    15861581                             time_t       addedDate );
    15871582
    1588 /** @deprecated this method will be removed in 1.40 */
     1583/** @deprecated */
    15891584void tr_torrentSetActivityDate( tr_torrent * torrent,
    15901585                                time_t       activityDate );
    15911586
    1592 /** @deprecated this method will be removed in 1.40 */
    1593 void tr_torrentSetDoneDate( tr_torrent  * torrent,
    1594                             time_t        doneDate );
     1587/** @deprecated */
     1588void tr_torrentSetDoneDate( tr_torrent * torrent, time_t doneDate );
     1589
     1590/** @} */
    15951591
    15961592/** @brief Sanity checker to test that the direction is TR_UP or TR_DOWN */
     
    16001596static TR_INLINE tr_bool tr_isBool( tr_bool b ) { return b==1 || b==0; }
    16011597
    1602 /** @} */
    1603 
    16041598#ifdef __cplusplus
    16051599}
  • trunk/libtransmission/upnp.h

    r8271 r8561  
    1818#define TR_UPNP_H 1
    1919
     20/**
     21 * @addtogroup port_forwarding Port Forwarding
     22 * @{
     23 */
     24
    2025typedef struct tr_upnp tr_upnp;
    2126
     
    2833                            int isEnabled,
    2934                            int doPortCheck );
     35/* @} */
    3036#endif
  • trunk/libtransmission/utils.h

    r8424 r8561  
    3232***/
    3333
     34/**
     35 * @addtogroup utils Utilities
     36 * @{
     37 */
     38
    3439#ifndef FALSE
    3540 #define FALSE 0
     
    193198                           const char * pattern );
    194199
    195 /** a portability wrapper for basename(). */
    196 char*          tr_basename( const char * path ) TR_GNUC_MALLOC;
    197 
    198 /** a portability wrapper for dirname(). */
    199 char*          tr_dirname( const char * path ) TR_GNUC_MALLOC;
    200 
    201 /**
     200/** @brief Portability wrapper for basename() that uses the system implementation if available */
     201char* tr_basename( const char * path ) TR_GNUC_MALLOC;
     202
     203/** @brief Portability wrapper for dirname() that uses the system implementation if available */
     204char* tr_dirname( const char * path ) TR_GNUC_MALLOC;
     205
     206/**
     207 * @brief Portability wrapper for mkdir()
     208 *
    202209 * a portability wrapper around mkdir().
    203210 * On WIN32, the `permissions' argument is unused.
     
    215222 * (in which case errno is set appropriately).
    216223 */
    217 int            tr_mkdirp( const char * path,
    218                           int          permissions );
    219 
    220 
    221 /**
    222  * Loads a file and returns its contents.
     224int tr_mkdirp( const char * path, int permissions );
     225
     226
     227/**
     228 * @brief Loads a file and returns its contents.
    223229 * On failure, NULL is returned and errno is set.
    224230 */
    225 uint8_t*       tr_loadFile( const char * filename,
    226                             size_t *     size ) TR_GNUC_MALLOC;
    227 
    228 
    229 /* creates a filename from a series of elements using the
    230    correct separator for filenames. */
    231 char*          tr_buildPath( const char * first_element, ... )
    232                                               TR_GNUC_NULL_TERMINATED
    233                                               TR_GNUC_MALLOC;
     231uint8_t* tr_loadFile( const char * filename, size_t * size ) TR_GNUC_MALLOC;
     232
     233
     234/** @brief build a filename from a series of elements using the
     235           platform's correct directory separator. */
     236char* tr_buildPath( const char * first_element, ... ) TR_GNUC_NULL_TERMINATED
     237                                                      TR_GNUC_MALLOC;
    234238
    235239struct timeval;
    236240
    237 void tr_timevalMsec( uint64_t           milliseconds,
    238                      struct timeval   * setme );
    239 
    240 
    241 /* return the current date in milliseconds */
     241void tr_timevalMsec( uint64_t milliseconds, struct timeval   * setme );
     242
     243
     244/** @brief return the current date in milliseconds */
    242245uint64_t       tr_date( void );
    243246
    244 /* wait the specified number of milliseconds */
     247/** @brief wait the specified number of milliseconds */
    245248void           tr_wait( uint64_t delay_milliseconds );
    246249
    247 char*          tr_utf8clean( const char  * str,
    248                              int           max_len,
    249                              tr_bool     * err );
     250/**
     251 * @brief make a copy of 'str' whose non-utf8 content has been corrected or stripped
     252 * @param str the string to make a clean copy of
     253 * @param len the length of the string to copy.  If -1, the entire string is used.
     254 * @param err if an error occurs and err is non-NULL, it's set to TRUE.
     255 */
     256char* tr_utf8clean( const char * str, int len, tr_bool * err ) TR_GNUC_MALLOC;
    250257
    251258
     
    269276***/
    270277
    271 /* Sometimes the system defines MAX/MIN, sometimes not. In the latter
    272    case, define those here since we will use them */
     278/* Sometimes the system defines MAX/MIN, sometimes not.
     279   In the latter case, define those here since we will use them */
    273280#ifndef MAX
    274281 #define MAX( a, b ) ( ( a ) > ( b ) ? ( a ) : ( b ) )
     
    338345                              int *        outlen ) TR_GNUC_MALLOC;
    339346
    340 size_t      tr_strlcpy( char *       dst,
    341                         const void * src,
    342                         size_t       siz );
    343 
    344 int         tr_snprintf( char *       buf,
    345                          size_t       buflen,
    346                          const char * fmt,
    347                          ... ) TR_GNUC_PRINTF( 3, 4 );
     347/** @brief Portability wrapper for strlcpy() that uses the system implementation if available */
     348size_t tr_strlcpy( char * dst, const void * src, size_t siz );
     349
     350/** @brief Portability wrapper for snprintf() that uses the system implementation if available */
     351int tr_snprintf( char * buf, size_t buflen,
     352                 const char * fmt, ... ) TR_GNUC_PRINTF( 3, 4 );
    348353
    349354const char* tr_strerror( int );
    350355
    351 char*       tr_strstrip( char * str );
    352 
     356/** @brief strips leading and trailing whitspace from a string
     357    @return the stripped string */
     358char* tr_strstrip( char * str );
     359
     360/** @brief Portability wrapper for memmem() that uses the system implementation if available */
    353361const char* tr_memmem( const char * haystack, size_t haystack_len,
    354362                       const char * needle, size_t needle_len );
     
    455463double tr_getRatio( double numerator, double denominator );
    456464
    457 int* tr_parseNumberRange( const char * str, int str_len, int * setmeCount );
     465int* tr_parseNumberRange( const char * str, int str_len, int * setmeCount ) TR_GNUC_MALLOC;
    458466
    459467
     
    470478char* tr_strratio( char * buf, size_t buflen, double ratio, const char * infinity );
    471479
     480/** @brief Portability wrapper for localtime_r() that uses the system implementation if available */
    472481struct tm * tr_localtime_r( const time_t *_clock, struct tm *_result );
    473482
     
    481490#endif
    482491
    483 #endif
     492/** @} */
     493
     494#endif
  • trunk/libtransmission/verify.h

    r8244 r8561  
    1818#define TR_VERIFY_H 1
    1919
     20/**
     21 * @addtogroup file_io File IO
     22 * @{
     23 */
     24
    2025typedef void ( *tr_verify_done_cb )( tr_torrent * tor );
    2126
     
    2934void tr_verifyClose( tr_session * );
    3035
     36/* @} */
     37
    3138#endif
Note: See TracChangeset for help on using the changeset viewer.