Changeset 2573


Ignore:
Timestamp:
Jul 31, 2007, 2:26:44 PM (14 years ago)
Author:
charles
Message:

continue whittling away at internal.h to reduce the global #include dependencies

Location:
trunk/libtransmission
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/choking.c

    r2555 r2573  
    2929#include "transmission.h"
    3030#include "choking.h"
     31#include "peer.h"
     32#include "platform.h"
    3133#include "utils.h"
    3234
  • trunk/libtransmission/fastresume.c

    r2555 r2573  
    5656#include "completion.h"
    5757#include "fastresume.h"
     58#include "peer.h"
     59#include "platform.h"
    5860#include "utils.h"
    5961
  • trunk/libtransmission/fdlimit.c

    r2555 r2573  
    3030#include <sys/types.h>
    3131#include <sys/stat.h>
    32 #include <sys/socket.h>
    33 #include <netinet/in.h>
    34 #include <arpa/inet.h>
    3532#include <unistd.h>
    3633#include <fcntl.h>
    3734
    3835#include "transmission.h"
     36#include "net.h"
     37#include "platform.h"
    3938#include "utils.h"
    4039
     
    8988 * tr_fdInit
    9089 **********************************************************************/
    91 void tr_fdInit()
     90void tr_fdInit( void )
    9291{
    9392    int i, j, s[4096];
     
    408407 * tr_fdClose
    409408 **********************************************************************/
    410 void tr_fdClose()
     409void tr_fdClose( void )
    411410{
    412411    tr_lockFree( gFd->lock );
  • trunk/libtransmission/fdlimit.h

    r2555 r2573  
    2323 *****************************************************************************/
    2424
     25#include "net.h"
     26
    2527/***********************************************************************
    2628 * tr_fdInit
     
    2830 * Detect the maximum number of open files and initializes things.
    2931 **********************************************************************/
    30 void tr_fdInit();
     32void tr_fdInit( void );
    3133
    3234/***********************************************************************
     
    7072 * Frees resources allocated by tr_fdInit.
    7173 **********************************************************************/
    72 void tr_fdClose();
     74void tr_fdClose( void );
    7375
  • trunk/libtransmission/http.c

    r2555 r2573  
    3030
    3131#include <sys/types.h>
    32 #include <sys/socket.h>
    33 #include <netinet/in.h>
    34 #include <arpa/inet.h>
    3532
    3633#include "transmission.h"
  • trunk/libtransmission/inout.c

    r2557 r2573  
    2121#include "fdlimit.h"
    2222#include "inout.h"
     23#include "net.h"
     24#include "peer.h"
    2325#include "sha1.h"
    2426#include "utils.h"
  • trunk/libtransmission/internal.h

    r2568 r2573  
    3838#endif
    3939
    40 #if defined(BEOS_NETSERVER) || defined(__MINGW__)
    41 #include <stdint.h>
    42 typedef uint16_t tr_port_t;
    43 #else
    44 #include <arpa/inet.h>
    45 typedef in_port_t tr_port_t;
    46 #endif
    47 
    4840#define TR_NAME "Transmission"
    4941
     
    6254typedef enum { TR_NET_OK, TR_NET_ERROR, TR_NET_WAIT } tr_tristate_t;
    6355
    64 #include "platform.h" /* thread, lock */
    65 #include "peer.h"
    66 
    6756#ifndef TRUE
    6857#define TRUE 1
    6958#endif
     59
    7060#ifndef FALSE
    7161#define FALSE 0
    7262#endif
    7363
     64struct tr_peer_s;
     65
    7466void tr_peerIdNew ( char* buf, int buflen );
    7567
     
    7870int tr_torrentAddCompact( tr_torrent_t * tor, int from,
    7971                           uint8_t * buf, int count );
    80 int tr_torrentAttachPeer( tr_torrent_t * tor, tr_peer_t * );
     72int tr_torrentAttachPeer( tr_torrent_t * tor, struct tr_peer_s * );
    8173
    8274void tr_torrentSetHasPiece( tr_torrent_t * tor, int pieceIndex, int has );
     
    165157    run_status_t      runStatus;
    166158    cp_status_t       cpStatus;
    167     tr_thread_t     * thread;
    168     tr_rwlock_t     * lock;
     159    struct tr_thread_s     * thread;
     160    struct tr_rwlock_s     * lock;
    169161
    170162    struct tr_tracker_s    * tracker;
     
    176168
    177169    int               peerCount;
    178     tr_peer_t      * peers[TR_MAX_PEER_COUNT];
     170    struct tr_peer_s * peers[TR_MAX_PEER_COUNT];
    179171
    180172    uint64_t          downloadedCur;
  • trunk/libtransmission/metainfo.c

    r2557 r2573  
    3636#include "http.h" /* tr_httpParseUrl */
    3737#include "metainfo.h"
     38#include "platform.h"
    3839#include "sha1.h"
    3940#include "utils.h"
  • trunk/libtransmission/natpmp.c

    r2555 r2573  
    3030
    3131#include <sys/types.h>
    32 #include <sys/socket.h>
    33 #include <netinet/in.h>
    34 #include <arpa/inet.h>
    3532
    3633#include "transmission.h"
    3734#include "natpmp.h"
    3835#include "net.h"
     36#include "platform.h" /* tr_getDefaultRoute() */
    3937#include "utils.h"
    4038
  • trunk/libtransmission/net.c

    r2555 r2573  
    2929
    3030#include <sys/types.h>
    31 #include <sys/socket.h>
    32 #include <netinet/in.h>
    33 #include <arpa/inet.h>
    3431#include <netdb.h>
    3532#include <fcntl.h>
     
    3835#include "fdlimit.h"
    3936#include "net.h"
     37#include "platform.h"
    4038#include "utils.h"
    4139
     
    273271}
    274272
    275 int tr_netOpen( const struct in_addr * addr, tr_port_t port,
    276                 int type, int priority )
     273static int
     274tr_netOpen( const struct in_addr * addr, tr_port_t port,
     275            int type, int priority )
    277276{
    278277    int s;
     
    300299    return s;
    301300}
     301 
     302int
     303tr_netOpenTCP( const struct in_addr * addr, tr_port_t port, int priority )
     304{
     305    return tr_netOpen( addr, port, SOCK_STREAM, priority );
     306}
     307
     308int
     309tr_netOpenUDP( const struct in_addr * addr, tr_port_t port, int priority )
     310{
     311    return tr_netOpen( addr, port, SOCK_DGRAM, priority );
     312}
    302313
    303314#ifdef IP_ADD_MEMBERSHIP
     
    332343#endif /* IP_ADD_MEMBERSHIP */
    333344
    334 int tr_netBind( int port, int type )
     345static int
     346tr_netBind( int port, int type )
    335347{
    336348    int s;
     
    373385    return s;
    374386}
     387
     388int
     389tr_netBindTCP( int port )
     390{
     391    return tr_netBind( port, SOCK_STREAM );
     392}
     393
     394int
     395tr_netBindUDP( int port )
     396{
     397    return tr_netBind( port, SOCK_DGRAM );
     398}
     399
    375400
    376401int tr_netAccept( int b, struct in_addr * addr, tr_port_t * port )
  • trunk/libtransmission/net.h

    r2555 r2573  
    2323 *****************************************************************************/
    2424
     25#ifndef _TR_NET_H_
     26#define _TR_NET_H_
     27
     28#if defined(BEOS_NETSERVER) || defined(__MINGW__)
     29#include <stdint.h>
     30typedef uint16_t tr_port_t;
     31#else
     32#include <arpa/inet.h>
     33typedef in_port_t tr_port_t;
     34#endif
    2535
    2636struct in_addr;
     
    4353 * TCP and UDP sockets
    4454 **********************************************************************/
    45 #define tr_netOpenTCP( addr, port, priority ) \
    46     tr_netOpen( (addr), (port), SOCK_STREAM, (priority) )
    47 #define tr_netOpenUDP( addr, port, priority ) \
    48     tr_netOpen( (addr), (port), SOCK_DGRAM, (priority) )
    49 int  tr_netOpen    ( const struct in_addr * addr, tr_port_t port, int type,
    50                      int priority );
     55int  tr_netOpenTCP ( const struct in_addr * addr, tr_port_t port, int priority );
     56int  tr_netOpenUDP ( const struct in_addr * addr, tr_port_t port, int priority );
    5157int  tr_netMcastOpen( int port, const struct in_addr * addr );
    52 #define tr_netBindTCP( port ) tr_netBind( (port), SOCK_STREAM )
    53 #define tr_netBindUDP( port ) tr_netBind( (port), SOCK_DGRAM )
    54 int  tr_netBind    ( int port, int type );
     58int  tr_netBindTCP ( int port );
     59int  tr_netBindUDP ( int port );
    5560int  tr_netAccept  ( int s, struct in_addr *, tr_port_t * );
    5661void tr_netClose   ( int s );
     
    6671
    6772#define tr_addrcmp( aa, bb )    memcmp( ( void * )(aa), ( void * )(bb), 4)
     73
     74#endif /* _TR_NET_H_ */
  • trunk/libtransmission/peer.c

    r2568 r2573  
    3030
    3131#include <sys/types.h>
    32 #include <sys/socket.h>
    33 #include <netinet/in.h>
    34 #include <arpa/inet.h>
    3532
    3633#include "transmission.h"
     
    4138#include "list.h"
    4239#include "net.h"
     40#include "peer.h"
    4341#include "peertree.h"
    4442#include "ratecontrol.h"
  • trunk/libtransmission/peer.h

    r2555 r2573  
    2626#define TR_PEER_H 1
    2727
    28 #include "transmission.h"
     28#include "net.h"
    2929
    3030struct in_addr;
     
    3535const char *tr_peerClient          ( tr_peer_t * );
    3636void        tr_peerSetPrivate      ( tr_peer_t *, int );
    37 void        tr_peerSetTorrent      ( tr_peer_t *, tr_torrent_t * );
     37void        tr_peerSetTorrent      ( tr_peer_t *, struct tr_torrent_s * );
    3838void        tr_peerSentBlockToUs   ( tr_peer_t *, int byteCount );
    3939void        tr_peerGotBlockFromUs  ( tr_peer_t *, int byteCount );
     
    6161void        tr_peerBlame           ( tr_peer_t *, int piece, int success );
    6262struct in_addr * tr_peerAddress    ( tr_peer_t * );
    63 int         tr_peerGetConnectable  ( const tr_torrent_t *, uint8_t ** );
     63int         tr_peerGetConnectable  ( const struct tr_torrent_s *, uint8_t ** );
    6464
    6565void        tr_swiftPulse          ( tr_handle_t * );
  • trunk/libtransmission/platform.c

    r2552 r2573  
    4343
    4444#include "transmission.h"
     45#include "net.h"
     46#include "platform.h"
    4547#include "utils.h"
    4648
  • trunk/libtransmission/ratecontrol.c

    r2555 r2573  
    2626
    2727#include "transmission.h"
     28#include "platform.h"
    2829#include "ratecontrol.h"
    2930#include "shared.h"
  • trunk/libtransmission/shared.c

    r2555 r2573  
    2828
    2929#include <sys/types.h>
    30 #include <sys/socket.h>
    31 #include <netinet/in.h>
    32 #include <arpa/inet.h>
    3330
    3431#include "transmission.h"
     
    3734#include "net.h"
    3835#include "peer.h"
     36#include "platform.h"
    3937#include "shared.h"
    4038#include "upnp.h"
  • trunk/libtransmission/torrent.c

    r2555 r2573  
    2929
    3030#include <sys/types.h>
    31 #include <sys/socket.h>
    32 #include <netinet/in.h>
    33 #include <arpa/inet.h>
    3431
    3532#include "transmission.h"
     
    3936#include "metainfo.h"
    4037#include "net.h" /* tr_netNtop */
     38#include "peer.h"
     39#include "platform.h"
    4140#include "ratecontrol.h"
    4241#include "shared.h"
  • trunk/libtransmission/tracker.c

    r2555 r2573  
    2828
    2929#include <sys/types.h>
    30 #include <sys/socket.h>
    31 #include <netinet/in.h>
    32 #include <arpa/inet.h>
    3330
    3431#include "transmission.h"
  • trunk/libtransmission/transmission.c

    r2555 r2573  
    3838#include "list.h"
    3939#include "net.h"
     40#include "platform.h"
    4041#include "ratecontrol.h"
    4142#include "shared.h"
  • trunk/libtransmission/upnp.c

    r2555 r2573  
    3333
    3434#include <sys/types.h>
    35 #include <sys/socket.h>
    36 #include <netinet/in.h>
    37 #include <arpa/inet.h>
    3835
    3936#include "transmission.h"
Note: See TracChangeset for help on using the changeset viewer.