Changeset 204

Show
Ignore:
Timestamp:
08/17/99 23:08:40 (15 years ago)
Author:
ucaccsp
Message:

Fixup the new inet_pton() and inet_ntop() code.

Location:
common/trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • common/trunk/MODS

    r202 r204  
    8787        - Updates to the RTP code from Markus Germeier: time-out and delete sources, 
    8888          fix X but in RTP header, add support for sending BYE packets. 
     89        - Add inet_pton() and inet_ntop() implementations, for those platforms 
     90          which are missing them. 
    8991 
    9092Still to do... 
  • common/trunk/src/inet_ntop.c

    r203 r204  
    1717 */ 
    1818 
    19 #if defined(LIBC_SCCS) && !defined(lint) 
    20 static char rcsid[] = "$Id$"; 
    21 #endif /* LIBC_SCCS and not lint */ 
    22  
    23 #include <sys/param.h> 
    24 #include <sys/types.h> 
    25 #include <sys/socket.h> 
    26 #include <netinet/in.h> 
    27 #include <arpa/inet.h> 
    28 #include <string.h> 
    29 #include <errno.h> 
    30 #include <stdio.h> 
     19#ifdef NEED_INET_NTOP 
     20#include "config_unix.h" 
     21#include "config_win32.h" 
    3122#include "inet_ntop.h" 
    3223 
     
    198189        return (dst); 
    199190} 
     191 
     192#endif 
     193 
  • common/trunk/src/inet_pton.c

    r203 r204  
    1717 */ 
    1818 
    19 #if defined(LIBC_SCCS) && !defined(lint) 
    20 static char rcsid[] = "$Id$"; 
    21 #endif /* LIBC_SCCS and not lint */ 
    22  
    23 #include <sys/param.h> 
    24 #include <sys/types.h> 
    25 #include <sys/socket.h> 
    26 #include <netinet/in.h> 
    27 #include <arpa/inet.h> 
    28 #include <string.h> 
    29 #include <errno.h> 
     19#ifdef NEED_INET_PTON 
     20#include "config_unix.h" 
     21#include "config_win32.h" 
    3022#include "inet_pton.h" 
    3123 
     
    224216        return (1); 
    225217} 
     218 
     219#endif 
     220 
  • common/trunk/src/net_udp.c

    r201 r204  
    4444#include "debug.h" 
    4545#include "memory.h" 
     46#include "inet_pton.h" 
     47#include "inet_ntop.h" 
    4648#include "net_udp.h" 
    4749 
     
    175177        addr->s_addr = inet_addr(name); 
    176178        return (addr->s_addr != (in_addr_t) INADDR_NONE); 
    177 } 
    178 #endif 
    179  
    180 #ifdef NEED_INET_PTON 
    181 #ifdef NEED_INET_PTON_STATIC 
    182 static  
    183 #endif 
    184 int inet_pton(int family, const char *name, void *addr) 
    185 { 
    186         if (family == AF_INET) { 
    187                 struct in_addr  in_val; 
    188                  
    189                 if (inet_aton(name, &in_val)) { 
    190                         memcpy(addr, &in_val, sizeof(struct in_addr)); 
    191                         return 1; 
    192                 } 
    193                 return 0; 
    194 #if defined (NEED_INET_PTON) && defined(HAVE_IPv6) 
    195         } else if (family == AF_INET6) { 
    196                 return inet6_addr(name, addr); 
    197 #endif 
    198         } else { 
    199                 debug_msg("Unknown address family\n"); 
    200                 return -1; 
    201         } 
    202179} 
    203180#endif