Ignore:
Timestamp:
Dec 2, 2008, 3:41:58 AM (13 years ago)
Author:
charles
Message:

(libT) re-apply jhujhiti's IPv6 patch. This merges in my tr_port cleanup, so any new bugs are mine :/

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/net.h

    r7224 r7231  
    5858#endif
    5959
    60 struct in_addr;
    61 struct sockaddr_in;
    6260struct tr_session;
    6361
    64 /***********************************************************************
    65  * DNS resolution
    66  **********************************************************************/
    67 int  tr_netResolve( const  char *,
    68                     struct in_addr * );
    69 
     62#define TR_AF_INET  0
     63#define TR_AF_INET6 1
     64 
     65typedef struct tr_address {
     66    unsigned short type : 1;
     67    union {
     68        /* The order here is important for tr_in{,6}addr_any initialization,
     69         * since we can't use C99 designated initializers */
     70        struct in6_addr addr6;
     71        struct in_addr  addr4;
     72    } addr;
     73} tr_address;
     74 
     75extern const tr_address tr_inaddr_any;
     76extern const tr_address tr_in6addr_any;
     77 
     78const char *tr_ntop( const tr_address * src,
     79                     char * dst,
     80                     int size );
     81const char *tr_ntop_non_ts( const tr_address * src );
     82tr_address *tr_pton( const char * src,
     83                     tr_address * dst );
     84int tr_compareAddresses( const tr_address * a,
     85                         const tr_address * b);
    7086
    7187/***********************************************************************
    7288 * Sockets
    7389 **********************************************************************/
    74 int  tr_netOpenTCP( struct tr_handle     * session,
    75                     const struct in_addr * addr,
    76                     tr_port                port );
     90int  tr_netOpenTCP( struct tr_handle * session,
     91                    const tr_address * addr,
     92                    tr_port            port );
    7793
    78 int  tr_netBindTCP( int port );
     94int  tr_netBindTCP( const tr_address * addr,
     95                    tr_port            port );
    7996
    8097int  tr_netAccept( struct tr_handle  * session,
    8198                   int                 bound,
    82                    struct in_addr    * setme_addr,
     99                   tr_address        * setme_addr,
    83100                   tr_port           * setme_port );
    84101
     
    88105void tr_netClose( int s );
    89106
    90 void tr_netNtop( const struct in_addr * addr,
    91                  char *                 buf,
    92                  int                    len );
    93 
    94107void tr_netInit( void );
    95108
Note: See TracChangeset for help on using the changeset viewer.