mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-03 08:05:21 +00:00
eliminate inet.h; cleanups; do not use UNIX-specific .h files
This commit is contained in:
@@ -70,21 +70,15 @@
|
|||||||
|
|
||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
#if defined(LIBC_SCCS) && !defined(lint)
|
||||||
static char sccsid[] = "@(#)inet_addr.c 8.1 (Berkeley) 6/17/93";
|
static char sccsid[] = "@(#)inet_addr.c 8.1 (Berkeley) 6/17/93";
|
||||||
static char rcsid[] = "$Id: inet_aton.c,v 1.4 1999/03/06 04:03:53 halley Exp $";
|
static char rcsid[] = "$Id: inet_aton.c,v 1.5 1999/07/16 00:24:04 halley Exp $";
|
||||||
#endif /* LIBC_SCCS and not lint */
|
#endif /* LIBC_SCCS and not lint */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/param.h>
|
|
||||||
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include <isc/types.h>
|
#include <isc/types.h>
|
||||||
#include <isc/inet.h>
|
#include <isc/net.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check whether "cp" is a valid ascii representation
|
* Check whether "cp" is a valid ascii representation
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
#if defined(LIBC_SCCS) && !defined(lint)
|
||||||
static char rcsid[] = "$Id: inet_ntop.c,v 1.3 1999/02/06 08:48:07 explorer Exp $";
|
static char rcsid[] = "$Id: inet_ntop.c,v 1.4 1999/07/16 00:24:04 halley Exp $";
|
||||||
#endif /* LIBC_SCCS and not lint */
|
#endif /* LIBC_SCCS and not lint */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@@ -25,16 +25,7 @@ static char rcsid[] = "$Id: inet_ntop.c,v 1.3 1999/02/06 08:48:07 explorer Exp $
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <isc/net.h>
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
|
|
||||||
#include <netinet/in.h>
|
|
||||||
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <arpa/nameser.h>
|
|
||||||
|
|
||||||
#include <isc/inet.h>
|
|
||||||
|
|
||||||
#define NS_INT16SZ 2
|
#define NS_INT16SZ 2
|
||||||
#define NS_IN6ADDRSZ 16
|
#define NS_IN6ADDRSZ 16
|
||||||
@@ -44,9 +35,12 @@ static char rcsid[] = "$Id: inet_ntop.c,v 1.3 1999/02/06 08:48:07 explorer Exp $
|
|||||||
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
|
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static const char *isc_inet_ntop4(const unsigned char *src, char *dst, size_t size);
|
static const char *inet_ntop4(const unsigned char *src, char *dst,
|
||||||
|
size_t size);
|
||||||
|
|
||||||
#ifdef AF_INET6
|
#ifdef AF_INET6
|
||||||
static const char *isc_inet_ntop6(const unsigned char *src, char *dst, size_t size);
|
static const char *inet_ntop6(const unsigned char *src, char *dst,
|
||||||
|
size_t size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* char *
|
/* char *
|
||||||
@@ -62,10 +56,10 @@ isc_inet_ntop(int af, const void *src, char *dst, size_t size)
|
|||||||
{
|
{
|
||||||
switch (af) {
|
switch (af) {
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
return (isc_inet_ntop4(src, dst, size));
|
return (inet_ntop4(src, dst, size));
|
||||||
#ifdef AF_INET6
|
#ifdef AF_INET6
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
return (isc_inet_ntop6(src, dst, size));
|
return (inet_ntop6(src, dst, size));
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
errno = EAFNOSUPPORT;
|
errno = EAFNOSUPPORT;
|
||||||
@@ -75,7 +69,7 @@ isc_inet_ntop(int af, const void *src, char *dst, size_t size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* const char *
|
/* const char *
|
||||||
* isc_inet_ntop4(src, dst, size)
|
* inet_ntop4(src, dst, size)
|
||||||
* format an IPv4 address
|
* format an IPv4 address
|
||||||
* return:
|
* return:
|
||||||
* `dst' (as a const)
|
* `dst' (as a const)
|
||||||
@@ -86,7 +80,7 @@ isc_inet_ntop(int af, const void *src, char *dst, size_t size)
|
|||||||
* Paul Vixie, 1996.
|
* Paul Vixie, 1996.
|
||||||
*/
|
*/
|
||||||
static const char *
|
static const char *
|
||||||
isc_inet_ntop4(const unsigned char *src, char *dst, size_t size)
|
inet_ntop4(const unsigned char *src, char *dst, size_t size)
|
||||||
{
|
{
|
||||||
static const char *fmt = "%u.%u.%u.%u";
|
static const char *fmt = "%u.%u.%u.%u";
|
||||||
char tmp[sizeof "255.255.255.255"];
|
char tmp[sizeof "255.255.255.255"];
|
||||||
@@ -108,7 +102,7 @@ isc_inet_ntop4(const unsigned char *src, char *dst, size_t size)
|
|||||||
*/
|
*/
|
||||||
#ifdef AF_INET6
|
#ifdef AF_INET6
|
||||||
static const char *
|
static const char *
|
||||||
isc_inet_ntop6(const unsigned char *src, char *dst, size_t size)
|
inet_ntop6(const unsigned char *src, char *dst, size_t size)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Note that int32_t and int16_t need only be "at least" large enough
|
* Note that int32_t and int16_t need only be "at least" large enough
|
||||||
@@ -171,8 +165,8 @@ isc_inet_ntop6(const unsigned char *src, char *dst, size_t size)
|
|||||||
/* Is this address an encapsulated IPv4? */
|
/* Is this address an encapsulated IPv4? */
|
||||||
if (i == 6 && best.base == 0 &&
|
if (i == 6 && best.base == 0 &&
|
||||||
(best.len == 6 || (best.len == 5 && words[5] == 0xffff))) {
|
(best.len == 6 || (best.len == 5 && words[5] == 0xffff))) {
|
||||||
if (!isc_inet_ntop4(src+12, tp,
|
if (!inet_ntop4(src+12, tp,
|
||||||
sizeof tmp - (tp - tmp)))
|
sizeof tmp - (tp - tmp)))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
tp += strlen(tp);
|
tp += strlen(tp);
|
||||||
break;
|
break;
|
||||||
|
@@ -16,23 +16,15 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
#if defined(LIBC_SCCS) && !defined(lint)
|
||||||
static char rcsid[] = "$Id: inet_pton.c,v 1.2 1999/02/06 08:48:07 explorer Exp $";
|
static char rcsid[] = "$Id: inet_pton.c,v 1.3 1999/07/16 00:24:04 halley Exp $";
|
||||||
#endif /* LIBC_SCCS and not lint */
|
#endif /* LIBC_SCCS and not lint */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
|
|
||||||
#include <netinet/in.h>
|
|
||||||
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <arpa/nameser.h>
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include <isc/inet.h>
|
#include <isc/net.h>
|
||||||
|
|
||||||
#define NS_INT16SZ 2
|
#define NS_INT16SZ 2
|
||||||
#define NS_INADDRSZ 4
|
#define NS_INADDRSZ 4
|
||||||
@@ -43,8 +35,8 @@ static char rcsid[] = "$Id: inet_pton.c,v 1.2 1999/02/06 08:48:07 explorer Exp $
|
|||||||
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
|
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int inet_pton4(const char *src, unsigned char *dst);
|
static int inet_pton4(const char *src, unsigned char *dst);
|
||||||
static int inet_pton6(const char *src, unsigned char *dst);
|
static int inet_pton6(const char *src, unsigned char *dst);
|
||||||
|
|
||||||
/* int
|
/* int
|
||||||
* isc_inet_pton(af, src, dst)
|
* isc_inet_pton(af, src, dst)
|
||||||
|
Reference in New Issue
Block a user