Patch #7815 by James Smith: added inet_ntop/inet_pton

This commit is contained in:
Simon Goldschmidt 2014-02-20 16:10:55 +01:00
parent 2f02120fee
commit cffe54d094

View File

@ -423,6 +423,20 @@ int lwip_fcntl(int s, int cmd, int val);
#define fcntl(a,b,c) lwip_fcntl(a,b,c) #define fcntl(a,b,c) lwip_fcntl(a,b,c)
#endif /* LWIP_POSIX_SOCKETS_IO_NAMES */ #endif /* LWIP_POSIX_SOCKETS_IO_NAMES */
#if LWIP_IPV6
#define inet_ntop(af,src,dst,size) \
(((af) == AF_INET6) ? ip6addr_ntoa_r((src),(dst),(size)) \
: (((af) == AF_INET) ? ipaddr_ntoa_r((src),(dst),(size)) : NULL))
#define inet_pton(af,src,dst) \
(((af) == AF_INET6) ? inet6_aton((src),(dst)) \
: (((af) == AF_INET) ? inet_aton((src),(dst)) : 0))
#else /* LWIP_IPV6 */
#define inet_ntop(af,src,dst,size) \
(((af) == AF_INET) ? ipaddr_ntoa_r((src),(dst),(size)) : NULL)
#define inet_pton(af,src,dst) \
(((af) == AF_INET) ? inet_aton((src),(dst)) : 0)
#endif /* LWIP_IPV6 */
#endif /* LWIP_COMPAT_SOCKETS */ #endif /* LWIP_COMPAT_SOCKETS */
#ifdef __cplusplus #ifdef __cplusplus