Ignore:
Timestamp:
Dec 15, 2008, 12:17:08 AM (12 years ago)
Author:
charles
Message:

(trunk libT) add ipv6 support by jhujhiti. I think this is the largest user-contributed patch we've ever used... thanks jhujhiti :)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/net.h

    r7232 r7397  
    5656struct tr_session;
    5757
    58 #define TR_AF_INET  0
    59 #define TR_AF_INET6 1
    60  
    61 typedef struct tr_address {
    62     unsigned short type : 1;
    63     union {
    64         /* The order here is important for tr_in{,6}addr_any initialization,
    65          * since we can't use C99 designated initializers */
    66         struct in6_addr addr6;
    67         struct in_addr  addr4;
    68     } addr;
    69 } tr_address;
    70  
    71 extern const tr_address tr_inaddr_any;
    72 extern const tr_address tr_in6addr_any;
    73  
    74 const char *tr_ntop( const tr_address * src,
    75                      char * dst,
    76                      int size );
    77 const char *tr_ntop_non_ts( const tr_address * src );
    78 tr_address *tr_pton( const char * src,
    79                      tr_address * dst );
    80 int tr_compareAddresses( const tr_address * a,
    81                          const tr_address * b);
     58#define TR_AF_INET  0
     59#define TR_AF_INET6 1
     60
     61typedef struct tr_address {
     62    uint8_t type;
     63    union {
     64        /* The order here is important for tr_in{,6}addr_any initialization,
     65         * since we can't use C99 designated initializers */
     66        struct in6_addr addr6;
     67        struct in_addr  addr4;
     68    } addr;
     69} tr_address;
     70
     71extern const tr_address tr_inaddr_any;
     72extern const tr_address tr_in6addr_any;
     73
     74const char *tr_ntop( const tr_address * src,
     75                     char * dst,
     76                     int size );
     77const char *tr_ntop_non_ts( const tr_address * src );
     78tr_address *tr_pton( const char * src,
     79                     tr_address * dst );
     80int tr_compareAddresses( const tr_address * a,
     81                         const tr_address * b);
     82void tr_normalizeV4Mapped( tr_address * const addr );
     83
     84/***********************************************************************
     85 * Socket list housekeeping
     86 **********************************************************************/
     87typedef struct tr_socketList tr_socketList;
     88tr_socketList *tr_socketListAppend( tr_socketList * const head,
     89                                    const tr_address * const addr );
     90tr_socketList *tr_socketListNew( const tr_address * const addr );
     91void tr_socketListFree( tr_socketList * const head );
     92void tr_socketListRemove( tr_socketList * const head,
     93                          tr_socketList * const el);
     94void tr_socketListTruncate( tr_socketList * const head,
     95                            tr_socketList * const start );
     96int tr_socketListGetSocket( const tr_socketList * const el );
     97const tr_address *tr_socketListGetAddress( const tr_socketList * const el );
     98void tr_socketListForEach( tr_socketList * const head,
     99                           void ( * cb ) ( int * const,
     100                                           tr_address * const,
     101                                           void * const ),
     102                           void * const userData);
    82103
    83104/***********************************************************************
     
    89110
    90111int  tr_netBindTCP( const tr_address * addr,
    91                     tr_port            port );
     112                    tr_port            port,
     113                    tr_bool            suppressMsgs );
    92114
    93115int  tr_netAccept( struct tr_handle  * session,
Note: See TracChangeset for help on using the changeset viewer.