Changeset 2555


Ignore:
Timestamp:
Jul 30, 2007, 6:04:10 PM (14 years ago)
Author:
charles
Message:

add portability wrapper for in_port_t...

Location:
trunk/libtransmission
Files:
27 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/bencode.c

    r2544 r2555  
    3131#include "transmission.h"
    3232#include "bencode.h"
     33#include "utils.h"
    3334
    3435/* setting to 1 to help expose bugs with tr_bencListAdd and tr_bencDictAdd */
  • trunk/libtransmission/choking.c

    r2552 r2555  
    2929#include "transmission.h"
    3030#include "choking.h"
     31#include "utils.h"
    3132
    3233#ifndef HAVE_LRINTF
  • trunk/libtransmission/completion.c

    r2544 r2555  
    2828#include "transmission.h"
    2929#include "completion.h"
     30#include "utils.h"
    3031
    3132struct tr_completion_s
  • trunk/libtransmission/completion.h

    r2531 r2555  
    2828#include "transmission.h"
    2929
     30typedef struct tr_completion_s tr_completion_t;
     31
    3032tr_completion_t     * tr_cpInit( tr_torrent_t * );
    3133void                  tr_cpClose( tr_completion_t * );
     
    4547int                   tr_cpPieceHasAllBlocks( const tr_completion_t *, int piece );
    4648int                   tr_cpPieceIsComplete( const tr_completion_t *, int piece );
    47 const tr_bitfield_t * tr_cpPieceBitfield( const tr_completion_t* );
    4849void                  tr_cpPieceAdd( tr_completion_t *, int piece );
    4950void                  tr_cpPieceRem( tr_completion_t *, int piece );
     
    5455int                   tr_cpBlockIsComplete( const tr_completion_t *, int block );
    5556void                  tr_cpBlockAdd( tr_completion_t *, int block );
    56 const tr_bitfield_t * tr_cpBlockBitfield( const tr_completion_t * );
    57 void                  tr_cpBlockBitfieldSet( tr_completion_t *, tr_bitfield_t * );
     57void                  tr_cpBlockBitfieldSet( tr_completion_t *, struct tr_bitfield_s * );
    5858float                 tr_cpPercentBlocksInPiece( const tr_completion_t * cp, int piece );
    5959/* Missing = we don't have it and we are not getting it from any peer yet */
     
    6161int                   tr_cpMissingBlockInPiece( const tr_completion_t *, int piece );
    6262
     63const struct tr_bitfield_s * tr_cpPieceBitfield( const tr_completion_t* );
     64const struct tr_bitfield_s * tr_cpBlockBitfield( const tr_completion_t * );
     65
    6366#endif
  • trunk/libtransmission/fastresume.c

    r2546 r2555  
    5454
    5555#include "transmission.h"
     56#include "completion.h"
    5657#include "fastresume.h"
     58#include "utils.h"
    5759
    5860/* time_t can be 32 or 64 bits... for consistency we'll hardwire 64 */
  • trunk/libtransmission/fastresume.h

    r2462 r2555  
    4141 * Returns a bitwise-or'ed set of the data loaded from fastresume
    4242 */
    43 uint64_t tr_fastResumeLoad( tr_torrent_t   * tor,
    44                             tr_bitfield_t * uncheckedPieces );
     43uint64_t tr_fastResumeLoad( tr_torrent_t         * tor,
     44                            struct tr_bitfield_s * uncheckedPieces );
    4545
    4646#endif
  • trunk/libtransmission/fdlimit.c

    r2552 r2555  
    3737
    3838#include "transmission.h"
     39#include "utils.h"
    3940
    4041#define TR_MAX_OPEN_FILES 16 /* That is, real files, not sockets */
     
    356357}
    357358
    358 int tr_fdSocketAccept( int b, struct in_addr * addr, in_port_t * port )
     359int tr_fdSocketAccept( int b, struct in_addr * addr, tr_port_t * port )
    359360{
    360361    int s = -1;
  • trunk/libtransmission/fdlimit.h

    r2004 r2555  
    6262 **********************************************************************/
    6363int  tr_fdSocketCreate( int type, int priority );
    64 int  tr_fdSocketAccept( int b, struct in_addr * addr, in_port_t * port );
     64int  tr_fdSocketAccept( int b, struct in_addr * addr, tr_port_t * port );
    6565void tr_fdSocketClose( int s );
    6666
  • trunk/libtransmission/http.c

    r2545 r2555  
    3838#include "net.h"
    3939#include "trcompat.h"
     40#include "utils.h"
    4041
    4142#define HTTP_PORT               80      /* default http port 80 */
  • trunk/libtransmission/inout.c

    r2544 r2555  
    1818
    1919#include "transmission.h"
     20#include "completion.h"
    2021#include "fdlimit.h"
     22#include "inout.h"
     23#include "utils.h"
    2124
    2225struct tr_io_s
  • trunk/libtransmission/internal.h

    r2552 r2555  
    4343#endif
    4444
    45 #ifdef BEOS_NETSERVER
    46 #  define in_port_t uint16_t
     45#if defined(BEOS_NETSERVER) || defined(__MINGW__)
     46#include <stdint.h>
     47typedef uint16_t tr_port_t;
    4748#else
    48 #  include <arpa/inet.h>
     49#include <arpa/inet.h>
     50typedef in_port_t tr_port_t;
    4951#endif
    5052
     
    8284#define TR_MAX_PEER_COUNT 60
    8385
    84 typedef struct tr_completion_s tr_completion_t;
    85 typedef struct tr_shared_s tr_shared_t;
    86 
    8786typedef enum { TR_NET_OK, TR_NET_ERROR, TR_NET_WAIT } tr_tristate_t;
    8887
    89 #include "platform.h"
    90 #include "tracker.h"
     88#include "platform.h" /* thread, lock */
    9189#include "peer.h"
    92 #include "inout.h"
    93 #include "ratecontrol.h"
    94 #include "utils.h"
    9590
    9691#ifndef TRUE
     
    107102int tr_torrentAddCompact( tr_torrent_t * tor, int from,
    108103                           uint8_t * buf, int count );
    109 int tr_torrentAttachPeer( tr_torrent_t * tor, tr_peer_t * peer );
     104int tr_torrentAttachPeer( tr_torrent_t * tor, tr_peer_t * );
    110105
    111106void tr_torrentSetHasPiece( tr_torrent_t * tor, int pieceIndex, int has );
     
    159154    tr_speedlimit_t    uploadLimitMode;
    160155    tr_speedlimit_t    downloadLimitMode;
    161     tr_ratecontrol_t * upload;
    162     tr_ratecontrol_t * download;
    163     tr_ratecontrol_t * swarmspeed;
     156    struct tr_ratecontrol_s * upload;
     157    struct tr_ratecontrol_s * download;
     158    struct tr_ratecontrol_s * swarmspeed;
    164159
    165160    int               error;
     
    188183    int               blockCountInLastPiece;
    189184   
    190     tr_completion_t * completion;
     185    struct tr_completion_s * completion;
    191186
    192187    volatile char     dieFlag;
    193     tr_bitfield_t   * uncheckedPieces;
     188    struct tr_bitfield_s   * uncheckedPieces;
    194189    run_status_t      runStatus;
    195190    cp_status_t       cpStatus;
     
    197192    tr_rwlock_t     * lock;
    198193
    199     tr_tracker_t    * tracker;
    200     tr_io_t         * io;
     194    struct tr_tracker_s    * tracker;
     195    struct tr_io_s         * io;
    201196    uint64_t          startDate;
    202197    uint64_t          stopDate;
     
    221216};
    222217
    223 #include "utils.h"
    224 #include "completion.h"
    225 
    226218struct tr_handle_s
    227219{
     
    233225
    234226    char               useUploadLimit;
    235     tr_ratecontrol_t * upload;
    236227    char               useDownloadLimit;
    237     tr_ratecontrol_t * download;
    238 
    239     tr_shared_t      * shared;
     228    struct tr_ratecontrol_s * upload;
     229    struct tr_ratecontrol_s * download;
     230
     231    struct tr_shared_s      * shared;
    240232
    241233    char           key[TR_KEY_LEN+1];
  • trunk/libtransmission/makemeta.c

    r2552 r2555  
    2727#include "platform.h" /* threads, locks */
    2828#include "shared.h" /* shared lock */
     29#include "utils.h" /* buildpath */
    2930#include "version.h"
    3031
  • trunk/libtransmission/metainfo.c

    r2544 r2555  
    3636#include "http.h" /* tr_httpParseUrl */
    3737#include "metainfo.h"
     38#include "utils.h"
    3839
    3940#define TORRENT_MAX_SIZE (5*1024*1024)
  • trunk/libtransmission/natpmp.c

    r2544 r2555  
    3737#include "natpmp.h"
    3838#include "net.h"
     39#include "utils.h"
    3940
    4041#define PMP_PORT                5351
  • trunk/libtransmission/net.c

    r2552 r2555  
    3838#include "fdlimit.h"
    3939#include "net.h"
     40#include "utils.h"
    4041
    4142
     
    272273}
    273274
    274 int tr_netOpen( const struct in_addr * addr, in_port_t port,
     275int tr_netOpen( const struct in_addr * addr, tr_port_t port,
    275276                int type, int priority )
    276277{
     
    373374}
    374375
    375 int tr_netAccept( int b, struct in_addr * addr, in_port_t * port )
     376int tr_netAccept( int b, struct in_addr * addr, tr_port_t * port )
    376377{
    377378    int s;
  • trunk/libtransmission/net.h

    r2552 r2555  
    4747#define tr_netOpenUDP( addr, port, priority ) \
    4848    tr_netOpen( (addr), (port), SOCK_DGRAM, (priority) )
    49 int  tr_netOpen    ( const struct in_addr * addr, in_port_t port, int type,
     49int  tr_netOpen    ( const struct in_addr * addr, tr_port_t port, int type,
    5050                     int priority );
    5151int  tr_netMcastOpen( int port, const struct in_addr * addr );
     
    5353#define tr_netBindUDP( port ) tr_netBind( (port), SOCK_DGRAM )
    5454int  tr_netBind    ( int port, int type );
    55 int  tr_netAccept  ( int s, struct in_addr *, in_port_t * );
     55int  tr_netAccept  ( int s, struct in_addr *, tr_port_t * );
    5656void tr_netClose   ( int s );
    5757
  • trunk/libtransmission/peer.c

    r2544 r2555  
    3737#include "bencode.h"
    3838#include "clients.h" /* for tr_clientForId() */
    39 #include "peertree.h"
     39#include "completion.h"
     40#include "inout.h"
    4041#include "list.h"
    4142#include "net.h"
     43#include "peertree.h"
     44#include "ratecontrol.h"
     45#include "utils.h"
    4246
    4347/*****
     
    132136
    133137    struct in_addr      addr;
    134     in_port_t           port;  /* peer's listening port, 0 if not known */
     138    tr_port_t           port;  /* peer's listening port, 0 if not known */
    135139
    136140#define PEER_STATUS_IDLE        1 /* Need to connect */
     
    257261 * Initializes a new peer.
    258262 **********************************************************************/
    259 tr_peer_t * tr_peerInit( const struct in_addr * addr, in_port_t port,
     263tr_peer_t * tr_peerInit( const struct in_addr * addr, tr_port_t port,
    260264                         int s, int from )
    261265{
  • trunk/libtransmission/peer.h

    r2343 r2555  
    3131typedef struct tr_peer_s tr_peer_t;
    3232
    33 tr_peer_t * tr_peerInit            ( const struct in_addr *, in_port_t, int sock, int );
     33tr_peer_t * tr_peerInit            ( const struct in_addr *, tr_port_t, int sock, int );
    3434void        tr_peerDestroy         ( tr_peer_t * );
    3535const char *tr_peerClient          ( tr_peer_t * );
  • trunk/libtransmission/peerparse.h

    r2531 r2555  
    430430static int parsePort( tr_peer_t * peer, uint8_t * p, int len )
    431431{
    432     in_port_t port;
     432    tr_port_t port;
    433433
    434434    if( len != 2 )
     
    438438    }
    439439
    440     port = *( (in_port_t *) p );
     440    port = *( (tr_port_t *) p );
    441441    peer_dbg( "GET  port %d", ntohs( port ) );
    442442
  • trunk/libtransmission/peertree.h

    r2391 r2555  
    6565
    6666static tr_peertree_entry_t *
    67 peertreeGet( tr_peertree_t * tree, struct in_addr * addr, in_port_t port )
     67peertreeGet( tr_peertree_t * tree, struct in_addr * addr, tr_port_t port )
    6868{
    6969    tr_peertree_entry_t entry;
     
    7777
    7878static tr_peertree_entry_t *
    79 peertreeAdd( tr_peertree_t * tree, struct in_addr * addr, in_port_t port )
     79peertreeAdd( tr_peertree_t * tree, struct in_addr * addr, tr_port_t port )
    8080{
    8181    tr_peertree_entry_t * entry;
  • trunk/libtransmission/ratecontrol.c

    r2552 r2555  
    2626
    2727#include "transmission.h"
     28#include "ratecontrol.h"
    2829#include "shared.h"
     30#include "utils.h"
    2931
    3032#define GRANULARITY_MSEC 250
  • trunk/libtransmission/shared.c

    r2552 r2555  
    3939#include "shared.h"
    4040#include "upnp.h"
     41#include "utils.h"
    4142
    4243/* Maximum number of peers that we keep in our local list */
  • trunk/libtransmission/shared.h

    r1463 r2555  
    2727
    2828#include "transmission.h"
     29
     30typedef struct tr_shared_s tr_shared_t;
    2931
    3032/***********************************************************************
  • trunk/libtransmission/torrent.c

    r2554 r2555  
    3434
    3535#include "transmission.h"
     36#include "completion.h"
    3637#include "fastresume.h"
    37 #include "trcompat.h" /* for strlcpy */
     38#include "inout.h"
    3839#include "metainfo.h"
    3940#include "net.h" /* tr_netNtop */
     41#include "ratecontrol.h"
    4042#include "shared.h"
     43#include "tracker.h"
     44#include "trcompat.h" /* for strlcpy */
     45#include "utils.h"
    4146
    4247/***
     
    979984{
    980985    struct in_addr addr;
    981     in_port_t port;
     986    tr_port_t port;
    982987    int i, added;
    983988    tr_peer_t * peer;
  • trunk/libtransmission/tracker.c

    r2554 r2555  
    3535#include "bencode.h"
    3636#include "bsdqueue.h"
     37#include "completion.h"
    3738#include "http.h"
    3839#include "net.h"
    3940#include "shared.h"
     41#include "tracker.h"
     42#include "utils.h"
    4043
    4144/* Users aren't allowed to make a manual announce more often than this. */
     
    11101113{
    11111114    struct in_addr addr;
    1112     in_port_t      port;
     1115    tr_port_t      port;
    11131116    uint8_t      * peerCompact;
    11141117    benc_val_t   * peer, * addrval, * portval;
  • trunk/libtransmission/transmission.c

    r2544 r2555  
    3838#include "list.h"
    3939#include "net.h"
     40#include "ratecontrol.h"
    4041#include "shared.h"
     42#include "utils.h"
    4143
    4244/* Generate a peer id : "-TRxyzb-" + 12 random alphanumeric
  • trunk/libtransmission/upnp.c

    r2544 r2555  
    4242#include "trcompat.h"
    4343#include "upnp.h"
     44#include "utils.h"
    4445#include "xml.h"
    4546
Note: See TracChangeset for help on using the changeset viewer.