Ignore:
Timestamp:
Jul 14, 2007, 4:29:21 PM (15 years ago)
Author:
joshe
Message:

Change a couple functions to take an in_addr pointer instead of an in_addr.
Forward declare struct in_addr and include the relevant headers in the .c files where it's used.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/net.c

    r2334 r2343  
    2323 *****************************************************************************/
    2424
    25 #include <netdb.h>
     25#include <sys/types.h>
    2626#include <sys/socket.h>
    2727#include <netinet/in.h>
     28#include <arpa/inet.h>
     29#include <netdb.h>
    2830#include <fcntl.h>
     31
    2932#include "transmission.h"
    3033#include "fdlimit.h"
     
    265268}
    266269
    267 int tr_netOpen( struct in_addr addr, in_port_t port, int type, int priority )
     270int tr_netOpen( const struct in_addr * addr, in_port_t port,
     271                int type, int priority )
    268272{
    269273    int s;
     
    277281    memset( &sock, 0, sizeof( sock ) );
    278282    sock.sin_family      = AF_INET;
    279     sock.sin_addr.s_addr = addr.s_addr;
     283    sock.sin_addr.s_addr = addr->s_addr;
    280284    sock.sin_port        = port;
    281285
     
    293297
    294298#ifdef IP_ADD_MEMBERSHIP
    295 int tr_netMcastOpen( int port, struct in_addr addr )
     299int tr_netMcastOpen( int port, const struct in_addr * addr )
    296300{
    297301    int fd;
     
    305309
    306310    memset( &req, 0, sizeof( req ) );
    307     req.imr_multiaddr.s_addr = addr.s_addr;
     311    req.imr_multiaddr.s_addr = addr->s_addr;
    308312    req.imr_interface.s_addr = htonl( INADDR_ANY );
    309313    if( setsockopt( fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &req, sizeof ( req ) ) )
     
    317321}
    318322#else /* IP_ADD_MEMBERSHIP */
    319 int tr_netMcastOpen( int port UNUSED, struct in_addr addr UNUSED )
     323int tr_netMcastOpen( int port UNUSED, const struct in_addr * addr UNUSED )
    320324{
    321325    return -1;
Note: See TracChangeset for help on using the changeset viewer.