Ignore:
Timestamp:
Mar 25, 2011, 5:34:26 AM (11 years ago)
Author:
jordan
Message:

(trunk libT) API cleanup of the tr_address functions to make them more consistent.

This is loosely related to #2910, but only in the sense of laying the groundwork for #2910's fix...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/net.h

    r12225 r12229  
    5454#endif
    5555
    56 struct tr_session;
     56/****
     57*****
     58*****  tr_address
     59*****
     60****/
    5761
    5862typedef enum tr_address_type
     
    7882extern const tr_address tr_in6addr_any;
    7983
    80 bool tr_ssToAddr( tr_address * setme_addr,
    81                   tr_port    * setme_port,
    82                   const struct sockaddr_storage * from );
     84const char* tr_address_to_string( const tr_address * addr );
    8385
    84 const char *tr_ntop( const tr_address * src,
    85                      char * dst,
    86                      int size );
    87 const char *tr_ntop_non_ts( const tr_address * src );
    88 tr_address *tr_pton( const char * src,
    89                      tr_address * dst );
    90 int tr_compareAddresses( const tr_address * a,
    91                          const tr_address * b);
     86const char* tr_address_to_string_with_buf( const tr_address  * addr,
     87                                           char              * buf,
     88                                           size_t              buflen );
    9289
    93 bool tr_isValidPeerAddress( const tr_address * addr, tr_port port );
     90bool tr_address_from_string ( tr_address  * setme,
     91                              const char  * string );
    9492
    95 static inline bool tr_isAddress( const tr_address * a ) { return ( a != NULL ) && ( a->type==TR_AF_INET || a->type==TR_AF_INET6 ); }
     93bool tr_address_from_sockaddr_storage( tr_address                     * setme,
     94                                       tr_port                        * port,
     95                                       const struct sockaddr_storage  * src );
    9696
    97 bool tr_net_hasIPv6( tr_port );
     97int tr_address_compare( const tr_address * a,
     98                        const tr_address * b );
     99
     100bool tr_address_is_valid_for_peers( const tr_address  * addr,
     101                                    tr_port             port );
     102
     103static inline bool
     104tr_address_is_valid( const tr_address * a )
     105{
     106    return ( a != NULL ) && ( a->type==TR_AF_INET || a->type==TR_AF_INET6 );
     107}
    98108
    99109/***********************************************************************
    100110 * Sockets
    101111 **********************************************************************/
     112
     113struct tr_session;
     114
    102115int  tr_netOpenPeerSocket( tr_session       * session,
    103116                           const tr_address * addr,
     
    131144void tr_netInit( void );
    132145
     146bool tr_net_hasIPv6( tr_port );
     147
    133148
    134149/**
Note: See TracChangeset for help on using the changeset viewer.