* Since we actually only need size_t to be defined, nuke the previous inclusion

of <sys/types.h> and define size_t via <machine/ansi.h>.
* Various namespace protection issues, using XNS5.2 D2.0 as a reference.
This commit is contained in:
kleink 1999-07-03 13:25:21 +00:00
parent 2ae70ac652
commit 48ce8436f2
1 changed files with 27 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: netdb.h,v 1.12 1999/07/01 18:15:41 itojun Exp $ */
/* $NetBSD: netdb.h,v 1.13 1999/07/03 13:25:21 kleink Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -88,11 +88,15 @@
#ifndef _NETDB_H_
#define _NETDB_H_
#include <machine/ansi.h>
#include <sys/cdefs.h>
#include <sys/types.h>
#include <inttypes.h>
#ifdef _BSD_SIZE_T_
typedef _BSD_SIZE_T_ size_t;
#undef _BSD_SIZE_T_
#endif
#if !defined(_XOPEN_SOURCE)
#define _PATH_HEQUIV "/etc/hosts.equiv"
#define _PATH_HOSTS "/etc/hosts"
@ -141,6 +145,7 @@ struct protoent {
int p_proto; /* protocol # */
};
#if !defined(_XOPEN_SOURCE)
struct addrinfo {
int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */
int ai_family; /* PF_xxx */
@ -151,6 +156,7 @@ struct addrinfo {
struct sockaddr *ai_addr; /* binary address */
struct addrinfo *ai_next; /* next structure in linked list */
};
#endif
/*
* Error return codes from gethostbyname() and gethostbyaddr()
@ -172,6 +178,7 @@ struct addrinfo {
/*
* Error return codes from getaddrinfo()
*/
#if !defined(_XOPEN_SOURCE)
#define EAI_ADDRFAMILY 1 /* address family for hostname not supported */
#define EAI_AGAIN 2 /* temporary failure in name resolution */
#define EAI_BADFLAGS 3 /* invalid value for ai_flags */
@ -186,23 +193,33 @@ struct addrinfo {
#define EAI_BADHINTS 12
#define EAI_PROTOCOL 13
#define EAI_MAX 14
#endif /* !_XOPEN_SOURCE */
/*
* Flag values for getaddrinfo()
*/
#if !defined(_XOPEN_SOURCE)
#define AI_PASSIVE 0x00000001 /* get address to use bind() */
#define AI_CANONNAME 0x00000002 /* fill ai_canonname */
#define AI_NUMERICHOST 0x00000004 /* prevent name resolution */
/* valid flags for addrinfo */
#define AI_MASK (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST)
#endif
#if !defined(_XOPEN_SOURCE) || (_XOPEN_SOURCE - 0) >= 500
#define AI_ALL 0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */
#endif
#if !defined(_XOPEN_SOURCE)
#define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */
#endif
#if !defined(_XOPEN_SOURCE) || (_XOPEN_SOURCE - 0) >= 500
#define AI_ADDRCONFIG 0x00000400 /* only if any address is assigned */
#define AI_V4MAPPED 0x00000800 /* accept IPv4-mapped IPv6 address */
/* special recommended flags for getipnodebyname */
#define AI_DEFAULT (AI_V4MAPPED_CFG | AI_ADDRCONFIG)
#endif
#if !defined(_XOPEN_SOURCE)
/*
* Constants for getnameinfo()
*/
@ -217,21 +234,26 @@ struct addrinfo {
#define NI_NAMEREQD 0x00000004
#define NI_NUMERICSERV 0x00000008
#define NI_DGRAM 0x00000010
#endif /* !_XOPEN_SOURCE */
__BEGIN_DECLS
void endhostent __P((void));
void endnetent __P((void));
void endprotoent __P((void));
void endservent __P((void));
#if !defined(_XOPEN_SOURCE) || (_XOPEN_SOURCE - 0) >= 500
void freehostent __P((struct hostent *));
#endif
struct hostent *gethostbyaddr __P((const char *, int, int));
struct hostent *gethostbyname __P((const char *));
#if !defined(_XOPEN_SOURCE)
struct hostent *gethostbyname2 __P((const char *, int));
#endif
struct hostent *gethostent __P((void));
#if !defined(_XOPEN_SOURCE) || (_XOPEN_SOURCE - 0) >= 500
struct hostent *getipnodebyaddr __P((const void *, size_t, int, int *));
struct hostent *getipnodebyname __P((const char *, int, int, int *));
#endif
struct netent *getnetbyaddr __P((unsigned long, int));
struct netent *getnetbyname __P((const char *));
struct netent *getnetent __P((void));
@ -251,12 +273,14 @@ void sethostent __P((int));
#endif
void setnetent __P((int));
void setprotoent __P((int));
#if !defined(_XOPEN_SOURCE)
int getaddrinfo __P((const char *, const char *,
const struct addrinfo *, struct addrinfo **));
int getnameinfo __P((const struct sockaddr *, size_t, char *,
size_t, char *, size_t, int));
void freeaddrinfo __P((struct addrinfo *));
char *gai_strerror __P((int));
#endif
void setservent __P((int));
__END_DECLS