ares_inet_pton/ntop: cleanup
Make sure that the symbols are always exported and present in c-ares. Make the headers prefixed with 'ares'. Removed the inet_ntop.h version as it no longer features any content.
This commit is contained in:
parent
ee9a1c2457
commit
cf7ad9758d
|
@ -204,12 +204,8 @@ PDFPAGES = ares_cancel.pdf \
|
||||||
|
|
||||||
SAMPLESOURCES = ares_getopt.c \
|
SAMPLESOURCES = ares_getopt.c \
|
||||||
ares_nowarn.c \
|
ares_nowarn.c \
|
||||||
ares_strcasecmp.c \
|
ares_strcasecmp.c
|
||||||
inet_net_pton.c \
|
|
||||||
inet_ntop.c
|
|
||||||
|
|
||||||
SAMPLEHEADERS = ares_getopt.h \
|
SAMPLEHEADERS = ares_getopt.h \
|
||||||
ares_nowarn.h \
|
ares_nowarn.h \
|
||||||
ares_strcasecmp.h \
|
ares_strcasecmp.h
|
||||||
inet_net_pton.h \
|
|
||||||
inet_ntop.h
|
|
||||||
|
|
|
@ -48,8 +48,6 @@
|
||||||
|
|
||||||
#include "ares.h"
|
#include "ares.h"
|
||||||
#include "ares_getopt.h"
|
#include "ares_getopt.h"
|
||||||
#include "inet_net_pton.h"
|
|
||||||
#include "inet_ntop.h"
|
|
||||||
#include "ares_nowarn.h"
|
#include "ares_nowarn.h"
|
||||||
|
|
||||||
#ifndef HAVE_STRDUP
|
#ifndef HAVE_STRDUP
|
||||||
|
|
2
adig.c
2
adig.c
|
@ -40,8 +40,6 @@
|
||||||
|
|
||||||
#include "ares.h"
|
#include "ares.h"
|
||||||
#include "ares_dns.h"
|
#include "ares_dns.h"
|
||||||
#include "inet_ntop.h"
|
|
||||||
#include "inet_net_pton.h"
|
|
||||||
#include "ares_getopt.h"
|
#include "ares_getopt.h"
|
||||||
#include "ares_nowarn.h"
|
#include "ares_nowarn.h"
|
||||||
|
|
||||||
|
|
2
ahost.c
2
ahost.c
|
@ -28,8 +28,6 @@
|
||||||
|
|
||||||
#include "ares.h"
|
#include "ares.h"
|
||||||
#include "ares_dns.h"
|
#include "ares_dns.h"
|
||||||
#include "inet_ntop.h"
|
|
||||||
#include "inet_net_pton.h"
|
|
||||||
#include "ares_getopt.h"
|
#include "ares_getopt.h"
|
||||||
#include "ares_ipv6.h"
|
#include "ares_ipv6.h"
|
||||||
#include "ares_nowarn.h"
|
#include "ares_nowarn.h"
|
||||||
|
|
8
ares.h
8
ares.h
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
/* Copyright 1998, 2009 by the Massachusetts Institute of Technology.
|
/* Copyright 1998, 2009 by the Massachusetts Institute of Technology.
|
||||||
* Copyright (C) 2007-2011 by Daniel Stenberg
|
* Copyright (C) 2007-2013 by Daniel Stenberg
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
* software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
|
@ -579,6 +579,12 @@ CARES_EXTERN int ares_set_servers_csv(ares_channel channel,
|
||||||
CARES_EXTERN int ares_get_servers(ares_channel channel,
|
CARES_EXTERN int ares_get_servers(ares_channel channel,
|
||||||
struct ares_addr_node **servers);
|
struct ares_addr_node **servers);
|
||||||
|
|
||||||
|
CARES_EXTERN const char *ares_inet_ntop(int af, const void *src, char *dst,
|
||||||
|
socklen_t size);
|
||||||
|
|
||||||
|
CARES_EXTERN int ares_inet_pton(int af, const char *src, void *dst);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "ares.h"
|
#include "ares.h"
|
||||||
#include "inet_net_pton.h"
|
#include "ares_inet_net_pton.h"
|
||||||
#include "ares_nowarn.h"
|
#include "ares_nowarn.h"
|
||||||
#include "ares_private.h"
|
#include "ares_private.h"
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "ares.h"
|
#include "ares.h"
|
||||||
#include "inet_net_pton.h"
|
#include "ares_inet_net_pton.h"
|
||||||
#include "ares_platform.h"
|
#include "ares_platform.h"
|
||||||
#include "ares_private.h"
|
#include "ares_private.h"
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
/* Copyright 1998, 2011 by the Massachusetts Institute of Technology.
|
/* Copyright 1998, 2011, 2013 by the Massachusetts Institute of Technology.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
* software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "ares.h"
|
#include "ares.h"
|
||||||
#include "inet_net_pton.h"
|
#include "ares_inet_net_pton.h"
|
||||||
#include "bitncmp.h"
|
#include "bitncmp.h"
|
||||||
#include "ares_platform.h"
|
#include "ares_platform.h"
|
||||||
#include "ares_nowarn.h"
|
#include "ares_nowarn.h"
|
||||||
|
|
|
@ -46,7 +46,6 @@
|
||||||
|
|
||||||
#include "ares.h"
|
#include "ares.h"
|
||||||
#include "ares_ipv6.h"
|
#include "ares_ipv6.h"
|
||||||
#include "inet_ntop.h"
|
|
||||||
#include "ares_nowarn.h"
|
#include "ares_nowarn.h"
|
||||||
#include "ares_private.h"
|
#include "ares_private.h"
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef HEADER_CARES_INET_NET_PTON_H
|
#ifndef HEADER_CARES_INET_NET_PTON_H
|
||||||
#define HEADER_CARES_INET_NET_PTON_H
|
#define HEADER_CARES_INET_NET_PTON_H
|
||||||
|
|
||||||
/* Copyright (C) 2005-2010 by Daniel Stenberg et al
|
/* Copyright (C) 2005-2013 by Daniel Stenberg et al
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
* software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
|
@ -16,12 +16,6 @@
|
||||||
* without express or implied warranty.
|
* without express or implied warranty.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_INET_PTON
|
|
||||||
#define ares_inet_pton(x,y,z) inet_pton(x,y,z)
|
|
||||||
#else
|
|
||||||
int ares_inet_pton(int af, const char *src, void *dst);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_INET_NET_PTON
|
#ifdef HAVE_INET_NET_PTON
|
||||||
#define ares_inet_net_pton(w,x,y,z) inet_net_pton(w,x,y,z)
|
#define ares_inet_net_pton(w,x,y,z) inet_net_pton(w,x,y,z)
|
||||||
#else
|
#else
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
||||||
* Copyright (C) 2007-2012 by Daniel Stenberg
|
* Copyright (C) 2007-2013 by Daniel Stenberg
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
* software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
|
@ -50,8 +50,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "ares.h"
|
#include "ares.h"
|
||||||
#include "inet_ntop.h"
|
#include "ares_inet_net_pton.h"
|
||||||
#include "inet_net_pton.h"
|
|
||||||
#include "ares_library_init.h"
|
#include "ares_library_init.h"
|
||||||
#include "ares_nowarn.h"
|
#include "ares_nowarn.h"
|
||||||
#include "ares_platform.h"
|
#include "ares_platform.h"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
||||||
* Copyright (C) 2008-2011 by Daniel Stenberg
|
* Copyright (C) 2008-2013 by Daniel Stenberg
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
* software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
#include "ares.h"
|
#include "ares.h"
|
||||||
#include "ares_data.h"
|
#include "ares_data.h"
|
||||||
#include "inet_net_pton.h"
|
#include "ares_inet_net_pton.h"
|
||||||
#include "ares_private.h"
|
#include "ares_private.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
|
|
||||||
#include "ares.h"
|
#include "ares.h"
|
||||||
#include "ares_dns.h"
|
#include "ares_dns.h"
|
||||||
#include "inet_net_pton.h"
|
#include "ares_inet_net_pton.h"
|
||||||
#include "ares_private.h"
|
#include "ares_private.h"
|
||||||
|
|
||||||
int ares_parse_aaaa_reply(const unsigned char *abuf, int alen,
|
int ares_parse_aaaa_reply(const unsigned char *abuf, int alen,
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
#include "ares.h"
|
#include "ares.h"
|
||||||
#include "ares_ipv6.h"
|
#include "ares_ipv6.h"
|
||||||
#include "ares_nowarn.h"
|
#include "ares_nowarn.h"
|
||||||
#include "inet_net_pton.h"
|
#include "ares_inet_net_pton.h"
|
||||||
|
|
||||||
|
|
||||||
const struct ares_in6_addr ares_in6addr_any = { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } };
|
const struct ares_in6_addr ares_in6addr_any = { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } };
|
||||||
|
@ -440,4 +440,11 @@ int ares_inet_pton(int af, const char *src, void *dst)
|
||||||
return 0;
|
return 0;
|
||||||
return (result > -1 ? 1 : -1);
|
return (result > -1 ? 1 : -1);
|
||||||
}
|
}
|
||||||
|
#else /* HAVE_INET_PTON */
|
||||||
|
int ares_inet_pton(int af, const char *src, void *dst)
|
||||||
|
{
|
||||||
|
/* just relay this to the underlying function */
|
||||||
|
return inet_pton(af, src, dst);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
13
inet_ntop.c
13
inet_ntop.c
|
@ -34,8 +34,6 @@
|
||||||
|
|
||||||
#include "ares.h"
|
#include "ares.h"
|
||||||
#include "ares_ipv6.h"
|
#include "ares_ipv6.h"
|
||||||
#include "inet_ntop.h"
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef HAVE_INET_NTOP
|
#ifndef HAVE_INET_NTOP
|
||||||
|
|
||||||
|
@ -61,7 +59,7 @@ static const char *inet_ntop6(const unsigned char *src, char *dst, size_t size);
|
||||||
* Paul Vixie, 1996.
|
* Paul Vixie, 1996.
|
||||||
*/
|
*/
|
||||||
const char *
|
const char *
|
||||||
ares_inet_ntop(int af, const void *src, char *dst, size_t size)
|
ares_inet_ntop(int af, const void *src, char *dst, socklen_t size)
|
||||||
{
|
{
|
||||||
switch (af) {
|
switch (af) {
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
|
@ -197,4 +195,11 @@ inet_ntop6(const unsigned char *src, char *dst, size_t size)
|
||||||
strcpy(dst, tmp);
|
strcpy(dst, tmp);
|
||||||
return (dst);
|
return (dst);
|
||||||
}
|
}
|
||||||
#endif
|
#else /* HAVE_INET_NTOP */
|
||||||
|
|
||||||
|
const char *ares_inet_ntop(int af, const void *src, char *dst, socklen_t size)
|
||||||
|
{
|
||||||
|
/* just relay this to the underlying function */
|
||||||
|
return inet_ntop(af, src, dst, size);
|
||||||
|
}
|
||||||
|
#endif /* HAVE_INET_NTOP */
|
||||||
|
|
26
inet_ntop.h
26
inet_ntop.h
|
@ -1,26 +0,0 @@
|
||||||
#ifndef __ARES_INET_NTOP_H
|
|
||||||
#define __ARES_INET_NTOP_H
|
|
||||||
|
|
||||||
|
|
||||||
/* Copyright (C) 2005 by Dominick Meglio
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, and distribute this
|
|
||||||
* software and its documentation for any purpose and without
|
|
||||||
* fee is hereby granted, provided that the above copyright
|
|
||||||
* notice appear in all copies and that both that copyright
|
|
||||||
* notice and this permission notice appear in supporting
|
|
||||||
* documentation, and that the name of M.I.T. not be used in
|
|
||||||
* advertising or publicity pertaining to distribution of the
|
|
||||||
* software without specific, written prior permission.
|
|
||||||
* M.I.T. makes no representations about the suitability of
|
|
||||||
* this software for any purpose. It is provided "as is"
|
|
||||||
* without express or implied warranty.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_INET_NTOP
|
|
||||||
#define ares_inet_ntop(w,x,y,z) inet_ntop(w,x,y,z)
|
|
||||||
#else
|
|
||||||
const char *ares_inet_ntop(int af, const void *src, char *dst, size_t size);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __ARES_INET_NTOP_H */
|
|
Loading…
Reference in New Issue