o Add INET_ADDRSTRLEN and INET6_ADDRSTRLEN defines to <arpa/inet.h>

for POSIX.1-2001 conformance.
o Add magic to <netinet/in.h> and <netinet6/in6.h> to prevent
  redefining INET_ADDRSTRLEN and INET6_ADDRSTRLEN.
o Add a note about missing typedefs in <arpa/inet.h>.
This commit is contained in:
Mike Barcroft 2002-03-10 06:42:27 +00:00
parent 2bc5801e8c
commit 6a6230d2f6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=91984
3 changed files with 18 additions and 2 deletions

View File

@ -64,6 +64,14 @@
/* Required for byteorder(3) functions. */
#include <machine/endian.h>
#ifndef INET_ADDRSTRLEN
#define INET_ADDRSTRLEN 16
#endif
#ifndef INET6_ADDRSTRLEN
#define INET6_ADDRSTRLEN 46
#endif
#ifndef _IN_ADDR_T_DECLARED_
typedef __uint32_t in_addr_t;
#define _IN_ADDR_T_DECLARED_
@ -82,8 +90,8 @@ typedef _BSD_SIZE_T_ size_t;
#endif /* !_POSIX_SOURCE */
/*
* XXX socklen_t is used by a POSIX.1-200x interface, but not required by
* POSIX.1-200x.
* XXX socklen_t is used by a POSIX.1-2001 interface, but not required by
* POSIX.1-2001.
*/
#ifdef _BSD_SOCKLEN_T_
typedef _BSD_SOCKLEN_T_ socklen_t;
@ -97,6 +105,10 @@ struct in_addr {
#define _STRUCT_IN_ADDR_DECLARED
#endif
/*
* XXX missing typedefs for uint16_t and uint32_t.
*/
/* XXX all new diversions!! argh!! */
#ifndef _POSIX_SOURCE
#define inet_addr __inet_addr

View File

@ -306,7 +306,9 @@ struct sockaddr_in {
char sin_zero[8];
};
#ifndef INET_ADDRSTRLEN
#define INET_ADDRSTRLEN 16
#endif
/*
* Options for use with [gs]etsockopt at the IP level.

View File

@ -132,7 +132,9 @@ struct in6_addr {
#define s6_addr32 __u6_addr.__u6_addr32
#endif
#ifndef INET6_ADDRSTRLEN
#define INET6_ADDRSTRLEN 46
#endif
/*
* Socket address for IPv6