1*9525b14bSRao Shoaib /*
2*9525b14bSRao Shoaib  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
3*9525b14bSRao Shoaib  * Use is subject to license terms.
4*9525b14bSRao Shoaib  */
5*9525b14bSRao Shoaib 
6*9525b14bSRao Shoaib 
7*9525b14bSRao Shoaib #ifndef _PORT_NETDB_H
8*9525b14bSRao Shoaib #define	_PORT_NETDB_H
9*9525b14bSRao Shoaib 
10*9525b14bSRao Shoaib #ifdef	__cplusplus
11*9525b14bSRao Shoaib extern "C" {
12*9525b14bSRao Shoaib #endif
13*9525b14bSRao Shoaib 
14*9525b14bSRao Shoaib /* AI_NUMERICSERV is not a valid flag for getaddrinfo */
15*9525b14bSRao Shoaib #define	AI_MASK		0x0038	/* mask of valid flags */
16*9525b14bSRao Shoaib 
17*9525b14bSRao Shoaib /* EAI_OVERFLOW was removed from ISC */
18*9525b14bSRao Shoaib #define	EAI_BADHINTS  12
19*9525b14bSRao Shoaib 
20*9525b14bSRao Shoaib /*
21*9525b14bSRao Shoaib  * these are libresolv2 functions that were renamed in previous versions to
22*9525b14bSRao Shoaib  * res_* because they conflict with libnsl or libsocket
23*9525b14bSRao Shoaib  */
24*9525b14bSRao Shoaib 
25*9525b14bSRao Shoaib #define	endhostent res_endhostent /* libnsl */
26*9525b14bSRao Shoaib void endhostent __P((void));
27*9525b14bSRao Shoaib #define	endnetent res_endnetent  /* libsocket */
28*9525b14bSRao Shoaib void endnetent __P((void));
29*9525b14bSRao Shoaib #define	freeaddrinfo res_freeaddrinfo /* libsocket */
30*9525b14bSRao Shoaib void freeaddrinfo __P((struct addrinfo *));
31*9525b14bSRao Shoaib #define	freehostent res_freehostent  /* libsocket and libnsl */
32*9525b14bSRao Shoaib void freehostent __P((struct hostent *));
33*9525b14bSRao Shoaib #define	getaddrinfo res_getaddrinfo  /* libsocket */
34*9525b14bSRao Shoaib int getaddrinfo __P((const char *, const char *,
35*9525b14bSRao Shoaib 				const struct addrinfo *, struct addrinfo **));
36*9525b14bSRao Shoaib #define	gethostbyaddr res_gethostbyaddr /* libnsl */
37*9525b14bSRao Shoaib struct hostent *gethostbyaddr __P((const char *, int, int));
38*9525b14bSRao Shoaib #define	gethostbyname res_gethostbyname /* libnsl */
39*9525b14bSRao Shoaib struct hostent *gethostbyname __P((const char *));
40*9525b14bSRao Shoaib #define	gethostbyname2 res_gethostbyname2 /* lib/nsswitch/dns */
41*9525b14bSRao Shoaib struct hostent *gethostbyname2 __P((const char *, int));
42*9525b14bSRao Shoaib #define	gethostent res_gethostent  /* libnsl */
43*9525b14bSRao Shoaib struct hostent *gethostent __P((void));
44*9525b14bSRao Shoaib #define	getipnodebyaddr res_getipnodebyaddr  /* libnsl and libsocket */
45*9525b14bSRao Shoaib struct hostent *getipnodebyaddr __P((const void *, size_t, int, int *));
46*9525b14bSRao Shoaib #define	getipnodebyname res_getipnodebyname  /* libnsl and libsocket */
47*9525b14bSRao Shoaib struct hostent *getipnodebyname __P((const char *, int, int, int *));
48*9525b14bSRao Shoaib 
49*9525b14bSRao Shoaib #define	getnetbyaddr res_getnetbyaddr /* libsocket */
50*9525b14bSRao Shoaib struct netent *getnetbyaddr __P((unsigned long, int));
51*9525b14bSRao Shoaib #define	getnetbyname res_getnetbyname /* libsocket */
52*9525b14bSRao Shoaib struct netent *getnetbyname __P((const char *));
53*9525b14bSRao Shoaib #define	getnetent res_getnetent /* libsocket */
54*9525b14bSRao Shoaib struct netent *getnetent __P((void));
55*9525b14bSRao Shoaib #define	sethostent res_sethostent /* libnsl */
56*9525b14bSRao Shoaib void sethostent __P((int));
57*9525b14bSRao Shoaib #define	setnetent res_setnetent /* libsocket */
58*9525b14bSRao Shoaib void setnetent __P((int));
59*9525b14bSRao Shoaib 
60*9525b14bSRao Shoaib /*
61*9525b14bSRao Shoaib  * these are other irs functions now included in libresolv.so.2. We rename the
62*9525b14bSRao Shoaib  * ones that overlap with libsocket or libnsl
63*9525b14bSRao Shoaib  */
64*9525b14bSRao Shoaib 
65*9525b14bSRao Shoaib /* endprotoent is in libsocket.so.1 */
66*9525b14bSRao Shoaib #define	endprotoent res_endprotoent
67*9525b14bSRao Shoaib void		endprotoent __P((void));
68*9525b14bSRao Shoaib 
69*9525b14bSRao Shoaib /* endservent is in libsocket.so.1 */
70*9525b14bSRao Shoaib #define	endservent res_endservent
71*9525b14bSRao Shoaib void		endservent __P((void));
72*9525b14bSRao Shoaib 
73*9525b14bSRao Shoaib /* note: the next two symbols are variables, not functions */
74*9525b14bSRao Shoaib 
75*9525b14bSRao Shoaib /* gai_errlist is in libsocket.so.1 */
76*9525b14bSRao Shoaib #define	gai_errlist res_gai_errlist
77*9525b14bSRao Shoaib 
78*9525b14bSRao Shoaib /* gai_nerr is in libsocket.so.1 */
79*9525b14bSRao Shoaib #define	gai_nerr res_gai_nerr
80*9525b14bSRao Shoaib 
81*9525b14bSRao Shoaib /* gai_strerror is in libsocket.so.1 */
82*9525b14bSRao Shoaib #define	gai_strerror res_gai_strerror
83*9525b14bSRao Shoaib const char *gai_strerror __P((int ecode));
84*9525b14bSRao Shoaib 
85*9525b14bSRao Shoaib /* gethostbyaddr_r is in libnsl.so.1 */
86*9525b14bSRao Shoaib #define	gethostbyaddr_r res_gethostbyaddr_r
87*9525b14bSRao Shoaib struct hostent *gethostbyaddr_r __P((const char *addr, int len, int type,
88*9525b14bSRao Shoaib 				struct hostent *hptr, char *buf,
89*9525b14bSRao Shoaib 				int buflen, int *h_errnop));
90*9525b14bSRao Shoaib 
91*9525b14bSRao Shoaib /* gethostbyname_r is in libnsl.so.1 */
92*9525b14bSRao Shoaib #define	gethostbyname_r res_gethostbyname_r
93*9525b14bSRao Shoaib struct hostent *gethostbyname_r __P((const char *name,	 struct hostent *hptr,
94*9525b14bSRao Shoaib 				char *buf, int buflen, int *h_errnop));
95*9525b14bSRao Shoaib 
96*9525b14bSRao Shoaib /* gethostent_r is in libnsl.so.1 */
97*9525b14bSRao Shoaib #define	gethostent_r res_gethostent_r
98*9525b14bSRao Shoaib struct hostent *gethostent_r __P((struct hostent *hptr, char *buf, int buflen,
99*9525b14bSRao Shoaib 				int *h_errnop));
100*9525b14bSRao Shoaib 
101*9525b14bSRao Shoaib /* getnameinfo is in libsocket.so.1 */
102*9525b14bSRao Shoaib #define	getnameinfo res_getnameinfo
103*9525b14bSRao Shoaib int getnameinfo __P((const struct sockaddr *, size_t, char *,
104*9525b14bSRao Shoaib 				size_t, char *, size_t, int));
105*9525b14bSRao Shoaib 
106*9525b14bSRao Shoaib /* getnetbyaddr_r is in libsocket.so.1 */
107*9525b14bSRao Shoaib #define	getnetbyaddr_r res_getnetbyaddr_r
108*9525b14bSRao Shoaib struct netent *getnetbyaddr_r __P((long, int, struct netent *, char *, int));
109*9525b14bSRao Shoaib 
110*9525b14bSRao Shoaib /* getnetbyname_r is in libsocket.so.1 */
111*9525b14bSRao Shoaib #define	getnetbyname_r res_getnetbyname_r
112*9525b14bSRao Shoaib struct netent *getnetbyname_r __P((const char *, struct netent *, char *, int));
113*9525b14bSRao Shoaib 
114*9525b14bSRao Shoaib /* getnetent_r is in libsocket.so.1 */
115*9525b14bSRao Shoaib #define	getnetent_r res_getnetent_r
116*9525b14bSRao Shoaib struct netent *getnetent_r __P((struct netent *, char *, int));
117*9525b14bSRao Shoaib 
118*9525b14bSRao Shoaib /* getprotobyname is in libsocket.so.1 */
119*9525b14bSRao Shoaib #define	getprotobyname res_getprotobyname
120*9525b14bSRao Shoaib struct protoent	*getprotobyname __P((const char *));
121*9525b14bSRao Shoaib 
122*9525b14bSRao Shoaib /* getprotobyname_r is in libsocket.so.1 */
123*9525b14bSRao Shoaib #define	getprotobyname_r res_getprotobyname_r
124*9525b14bSRao Shoaib struct protoent	*getprotobyname_r __P((const char *, struct protoent *,
125*9525b14bSRao Shoaib 				char *, int));
126*9525b14bSRao Shoaib 
127*9525b14bSRao Shoaib /* getprotobynumber is in libsocket.so.1 */
128*9525b14bSRao Shoaib #define	getprotobynumber res_getprotobynumber
129*9525b14bSRao Shoaib struct protoent	*getprotobynumber __P((int));
130*9525b14bSRao Shoaib 
131*9525b14bSRao Shoaib /* getprotobynumber_r is in libsocket.so.1 */
132*9525b14bSRao Shoaib #define	getprotobynumber_r res_getprotobynumber_r
133*9525b14bSRao Shoaib struct protoent	*getprotobynumber_r __P((int,
134*9525b14bSRao Shoaib 				struct protoent *, char *, int));
135*9525b14bSRao Shoaib 
136*9525b14bSRao Shoaib /* getprotoent is in libsocket.so.1 */
137*9525b14bSRao Shoaib #define	getprotoent res_getprotoent
138*9525b14bSRao Shoaib struct protoent	*getprotoent __P((void));
139*9525b14bSRao Shoaib 
140*9525b14bSRao Shoaib /* getprotoent_r is in libsocket.so.1 */
141*9525b14bSRao Shoaib #define	getprotoent_r res_getprotoent_r
142*9525b14bSRao Shoaib struct protoent	*getprotoent_r __P((struct protoent *, char *, int));
143*9525b14bSRao Shoaib 
144*9525b14bSRao Shoaib /* getservbyname is in libsocket.so.1 and libnsl.so.1 */
145*9525b14bSRao Shoaib #define	getservbyname res_getservbyname
146*9525b14bSRao Shoaib struct servent *getservbyname __P((const char *, const char *));
147*9525b14bSRao Shoaib 
148*9525b14bSRao Shoaib /* getservbyname_r is in libsocket.so.1 and libnsl.so.1 */
149*9525b14bSRao Shoaib #define	getservbyname_r res_getservbyname_r
150*9525b14bSRao Shoaib struct servent *getservbyname_r __P((const char *name, const char *,
151*9525b14bSRao Shoaib 				struct servent *, char *, int));
152*9525b14bSRao Shoaib 
153*9525b14bSRao Shoaib /* getservbyport is in libsocket.so.1 and libnsl.so.1 */
154*9525b14bSRao Shoaib #define	getservbyport res_getservbyport
155*9525b14bSRao Shoaib struct servent *getservbyport __P((int, const char *));
156*9525b14bSRao Shoaib 
157*9525b14bSRao Shoaib /* getservbyport_r is in libsocket.so.1 and libnsl.so.1 */
158*9525b14bSRao Shoaib #define	getservbyport_r res_getservbyport_r
159*9525b14bSRao Shoaib struct servent *getservbyport_r __P((int port, const char *,
160*9525b14bSRao Shoaib 				struct servent *, char *, int));
161*9525b14bSRao Shoaib 
162*9525b14bSRao Shoaib /* getservent is in libsocket.so.1 */
163*9525b14bSRao Shoaib #define	getservent res_getservent
164*9525b14bSRao Shoaib struct servent *getservent __P((void));
165*9525b14bSRao Shoaib 
166*9525b14bSRao Shoaib /* getservent_r is in libsocket.so.1 */
167*9525b14bSRao Shoaib #define	getservent_r res_getservent_r
168*9525b14bSRao Shoaib struct servent *getservent_r __P((struct servent *, char *, int));
169*9525b14bSRao Shoaib 
170*9525b14bSRao Shoaib /* innetgr is in libsocket.so.1 */
171*9525b14bSRao Shoaib #define	innetgr res_innetgr
172*9525b14bSRao Shoaib int innetgr __P((const char *, const char *, const char *, const char *));
173*9525b14bSRao Shoaib 
174*9525b14bSRao Shoaib /* setprotoent is in libsocket.so.1 */
175*9525b14bSRao Shoaib #define	setprotoent res_setprotoent
176*9525b14bSRao Shoaib void setprotoent __P((int));
177*9525b14bSRao Shoaib 
178*9525b14bSRao Shoaib /* setservent is in libsocket.so.1 */
179*9525b14bSRao Shoaib #define	setservent res_setservent
180*9525b14bSRao Shoaib void setservent __P((int));
181*9525b14bSRao Shoaib 
182*9525b14bSRao Shoaib 
183*9525b14bSRao Shoaib 
184*9525b14bSRao Shoaib #ifdef	__cplusplus
185*9525b14bSRao Shoaib }
186*9525b14bSRao Shoaib #endif
187*9525b14bSRao Shoaib 
188*9525b14bSRao Shoaib #endif /* _PORT_NETDB_H */