tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
addrinfo incorrectly declared?
netinfo.h declares struct addrinfo in such a way that it disappears
without a preprocessor definition. Am I missing something, or it
supposed to be that way?
The code requires one of:
_POSIX_C_SOURCE
_XOPEN_SOURCE
_NETBSD_SOURCE
Neither the standard nor the man page mention need for any of these.
SuS:
http://pubs.opengroup.org/onlinepubs/009695399/basedefs/netdb.h.html
Code:
/*
* Note: ai_addrlen used to be a size_t, per RFC 2553.
* In XNS5.2, and subsequently in POSIX-2001 and
* draft-ietf-ipngwg-rfc2553bis-02.txt it was changed to a socklen_t.
* To accommodate for this while preserving binary compatibility with
the
* old interface, we prepend or append 32 bits of padding, depending on
* the (LP64) architecture's endianness.
*
* This should be deleted the next time the libc major number is
* incremented.
*/
#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \
defined(_NETBSD_SOURCE)
struct addrinfo {
int ai_flags; /*%< AI_PASSIVE,
AI_CANONNAME */ int ai_family; /*%< PF_xxx */
int ai_socktype; /*%< SOCK_xxx */
int ai_protocol; /*%< 0 or IPPROTO_xxx
for IPv4 and IPv6 */
#if defined(__sparc__) && defined(_LP64)
int __ai_pad0; /* ABI compatibility */
#endif
socklen_t ai_addrlen; /*%< length of ai_addr */
#if defined(__alpha__) || (defined(__i386__) && defined(_LP64))
int __ai_pad0; /* ABI compatibility */
#endif
char *ai_canonname; /*%< canonical name
for hostname */ struct sockaddr *ai_addr; /*%< binary
address */ struct addrinfo *ai_next; /*%< next structure
in linked list */ };
#endif
--jkl
Home |
Main Index |
Thread Index |
Old Index