Annotation of src/dist/bind/lib/bind/port_after.h.in, Revision 1.1.1.3
1.1 christos 1: #ifndef port_after_h
2: #define port_after_h
3:
4: #include <stdio.h>
5: #include <sys/types.h>
6: #include <sys/socket.h>
7: #include <sys/param.h>
8: #if (!defined(BSD)) || (BSD < 199306)
9: #include <sys/bitypes.h>
10: #endif
11:
12: @NEED_PSELECT@
13: @HAVE_SA_LEN@
14: @HAVE_MINIMUM_IFREQ@
15: @NEED_DAEMON@
16: @NEED_STRSEP@
17: @NEED_STRERROR@
18: @HAS_INET6_STRUCTS@
19: @HAVE_SIN6_SCOPE_ID@
20: @NEED_IN6ADDR_ANY@
21: @HAS_IN_ADDR6@
22: @HAVE_SOCKADDR_STORAGE@
23: @NEED_GETTIMEOFDAY@
24: @HAVE_STRNDUP@
25: @USE_FIONBIO_IOCTL@
26: @USE_SYSERROR_LIST@
27: @INNETGR_ARGS@
28: @SETNETGRENT_ARGS@
29:
30: /* XXX sunos and cygwin needs O_NDELAY */
31: #define PORT_NONBLOCK O_NONBLOCK
32:
33: /*
34: * We need to know the IPv6 address family number even on IPv4-only systems.
35: * Note that this is NOT a protocol constant, and that if the system has its
36: * own AF_INET6, different from ours below, all of BIND's libraries and
37: * executables will need to be recompiled after the system <sys/socket.h>
38: * has had this type added. The type number below is correct on most BSD-
39: * derived systems for which AF_INET6 is defined.
40: */
41: #ifndef AF_INET6
42: #define AF_INET6 24
43: #endif
44:
45: #ifndef PF_INET6
46: #define PF_INET6 AF_INET6
47: #endif
48:
49: #ifdef HAS_IN_ADDR6
50: /* Map to pre-RFC structure. */
51: #define in6_addr in_addr6
52: #endif
53:
54: #ifndef HAS_INET6_STRUCTS
55: /* Replace with structure from later rev of O/S if known. */
56: struct in6_addr {
57: u_int8_t s6_addr[16];
58: };
59:
60: #define IN6ADDR_ANY_INIT \
61: {{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
62: 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}
63:
64: #define IN6ADDR_LOOPBACK_INIT \
65: {{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
66: 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}
67:
68: /* Replace with structure from later rev of O/S if known. */
69: struct sockaddr_in6 {
70: #ifdef HAVE_SA_LEN
71: u_int8_t sin6_len; /* length of this struct */
72: u_int8_t sin6_family; /* AF_INET6 */
73: #else
74: u_int16_t sin6_family; /* AF_INET6 */
75: #endif
76: u_int16_t sin6_port; /* transport layer port # */
77: u_int32_t sin6_flowinfo; /* IPv6 flow information */
78: struct in6_addr sin6_addr; /* IPv6 address */
79: u_int32_t sin6_scope_id; /* set of interfaces for a scope */
80: };
81: #endif /* HAS_INET6_STRUCTS */
82:
83: #ifdef BROKEN_IN6ADDR_INIT_MACROS
84: #undef IN6ADDR_ANY_INIT
85: #undef IN6ADDR_LOOPBACK_INIT
86: #endif
87:
88: #ifndef IN6ADDR_ANY_INIT
89: #ifdef s6_addr
90: #define IN6ADDR_ANY_INIT \
91: {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
92: 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
93: #else
94: #define IN6ADDR_ANY_INIT \
95: {{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
96: 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}
97: #endif
98:
99: #endif
100: #ifndef IN6ADDR_LOOPBACK_INIT
101: #ifdef s6_addr
102: #define IN6ADDR_LOOPBACK_INIT \
103: {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
104: 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
105: #else
106: #define IN6ADDR_LOOPBACK_INIT \
107: {{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
108: 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}
109: #endif
110: #endif
111:
112: #ifndef HAVE_SOCKADDR_STORAGE
113: #define __SS_MAXSIZE 128
114: #define __SS_ALLIGSIZE (sizeof (long))
115:
116: struct sockaddr_storage {
117: #ifdef HAVE_SA_LEN
118: u_int8_t ss_len; /* address length */
119: u_int8_t ss_family; /* address family */
120: char __ss_pad1[__SS_ALLIGSIZE - 2 * sizeof(u_int8_t)];
121: long __ss_align;
122: char __ss_pad2[__SS_MAXSIZE - 2 * __SS_ALLIGSIZE];
123: #else
124: u_int16_t ss_family; /* address family */
125: char __ss_pad1[__SS_ALLIGSIZE - sizeof(u_int16_t)];
126: long __ss_align;
127: char __ss_pad2[__SS_MAXSIZE - 2 * __SS_ALLIGSIZE];
128: #endif
129: };
130: #endif
131:
132:
133: #if !defined(HAS_INET6_STRUCTS) || defined(NEED_IN6ADDR_ANY)
134: #define in6addr_any isc_in6addr_any
135: extern const struct in6_addr in6addr_any;
136: #endif
137:
138: /*
139: * IN6_ARE_ADDR_EQUAL, IN6_IS_ADDR_UNSPECIFIED, IN6_IS_ADDR_V4COMPAT and
140: * IN6_IS_ADDR_V4MAPPED are broken in glibc 2.1.
141: */
142: #ifdef __GLIBC__
143: #if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 2)
144: #undef IN6_ARE_ADDR_EQUAL
145: #undef IN6_IS_ADDR_UNSPECIFIED
146: #undef IN6_IS_ADDR_V4COMPAT
147: #undef IN6_IS_ADDR_V4MAPPED
148: #endif
149: #endif
150:
151: #ifndef IN6_ARE_ADDR_EQUAL
152: #define IN6_ARE_ADDR_EQUAL(a,b) \
153: (memcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0)
154: #endif
155:
156: #ifndef IN6_IS_ADDR_UNSPECIFIED
157: #define IN6_IS_ADDR_UNSPECIFIED(a) \
158: IN6_ARE_ADDR_EQUAL(a, &in6addr_any)
159: #endif
160:
161: #ifndef IN6_IS_ADDR_LOOPBACK
162: extern const struct in6_addr isc_in6addr_loopback;
163: #define IN6_IS_ADDR_LOOPBACK(a) \
164: IN6_ARE_ADDR_EQUAL(a, &isc_in6addr_loopback)
165: #endif
166:
167: #ifndef IN6_IS_ADDR_V4MAPPED
168: #define IN6_IS_ADDR_V4MAPPED(a) \
169: ((a)->s6_addr[0] == 0x00 && (a)->s6_addr[1] == 0x00 && \
170: (a)->s6_addr[2] == 0x00 && (a)->s6_addr[3] == 0x00 && \
171: (a)->s6_addr[4] == 0x00 && (a)->s6_addr[5] == 0x00 && \
172: (a)->s6_addr[6] == 0x00 && (a)->s6_addr[9] == 0x00 && \
173: (a)->s6_addr[8] == 0x00 && (a)->s6_addr[9] == 0x00 && \
174: (a)->s6_addr[10] == 0xff && (a)->s6_addr[11] == 0xff)
175: #endif
176:
177: #ifndef IN6_IS_ADDR_SITELOCAL
178: #define IN6_IS_ADDR_SITELOCAL(a) \
179: (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0))
180: #endif
181:
182: #ifndef IN6_IS_ADDR_LINKLOCAL
183: #define IN6_IS_ADDR_LINKLOCAL(a) \
184: (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80))
185: #endif
186:
187: #ifndef IN6_IS_ADDR_MULTICAST
188: #define IN6_IS_ADDR_MULTICAST(a) ((a)->s6_addr[0] == 0xff)
189: #endif
190:
191: #ifndef __IPV6_ADDR_MC_SCOPE
192: #define __IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f)
193: #endif
194:
195: #ifndef __IPV6_ADDR_SCOPE_SITELOCAL
196: #define __IPV6_ADDR_SCOPE_SITELOCAL 0x05
197: #endif
198: #ifndef __IPV6_ADDR_SCOPE_ORGLOCAL
199: #define __IPV6_ADDR_SCOPE_ORGLOCAL 0x08
200: #endif
201:
202: #ifndef IN6_IS_ADDR_MC_SITELOCAL
203: #define IN6_IS_ADDR_MC_SITELOCAL(a) \
204: (IN6_IS_ADDR_MULTICAST(a) && \
205: (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_SITELOCAL))
206: #endif
207:
208: #ifndef IN6_IS_ADDR_MC_ORGLOCAL
209: #define IN6_IS_ADDR_MC_ORGLOCAL(a) \
210: (IN6_IS_ADDR_MULTICAST(a) && \
211: (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_ORGLOCAL))
212: #endif
213:
214: #ifndef INADDR_NONE
215: #define INADDR_NONE 0xffffffff
216: #endif
217:
218: #ifndef MAXHOSTNAMELEN
219: #define MAXHOSTNAMELEN 256
220: #endif
221:
222: #ifndef INET6_ADDRSTRLEN
223: /* sizeof("aaaa:bbbb:cccc:dddd:eeee:ffff:123.123.123.123") */
224: #define INET6_ADDRSTRLEN 46
225: #endif
226:
227: #ifndef MIN
228: #define MIN(x,y) (((x) <= (y)) ? (x) : (y))
229: #endif
230:
231: #ifndef MAX
232: #define MAX(x,y) (((x) >= (y)) ? (x) : (y))
233: #endif
234:
235: #ifdef NEED_DAEMON
236: int daemon(int nochdir, int noclose);
237: #endif
238:
239: #ifdef NEED_STRSEP
240: char * strsep(char **stringp, const char *delim);
241: #endif
242:
243: #ifndef ALIGN
244: #define ALIGN(p) (((unsigned int)(p) + (sizeof(int) - 1)) & ~(sizeof(int) - 1))
245: #endif
246:
247: #ifdef NEED_SETGROUPENT
248: int setgroupent(int stayopen);
249: #endif
250:
251: #ifdef NEED_GETGROUPLIST
252: int getgrouplist(GETGROUPLIST_ARGS);
253: #endif
254:
255: #ifdef POSIX_GETGRNAM_R
256: int
257: __posix_getgrnam_r(const char *, struct group *, char *, int, struct group **);
258: #endif
259:
260: #ifdef NEED_GETGRNAM_R
261: int
262: getgrnam_r(const char *, struct group *, char *, size_t, struct group **);
263: #endif
264:
265: #ifdef POSIX_GETGRGID_R
266: int
267: __posix_getgrgid_r(gid_t, struct group *, char *, int, struct group **) ;
268: #endif
269:
270: #ifdef NEED_GETGRGID_R
271: int
272: getgrgid_r(gid_t, struct group *, char *, size_t, struct group **);
273: #endif
274:
275: #ifdef NEED_GETGRENT_R
276: GROUP_R_RETURN getgrent_r(struct group *gptr, GROUP_R_ARGS);
277: #endif
278:
279: #ifdef NEED_SETGRENT_R
280: GROUP_R_SET_RETURN setgrent_r(GROUP_R_ENT_ARGS);
281: #endif
282:
283: #ifdef NEED_ENDGRENT_R
284: GROUP_R_END_RETURN endgrent_r(GROUP_R_ENT_ARGS);
285: #endif
286:
287: #ifdef NEED_INNETGR_R
288: NGR_R_RETURN
289: innetgr_r(const char *, const char *, const char *, const char *);
290: #endif
291:
292: #ifdef NEED_SETNETGRENT_R
293: #ifdef NGR_R_ENT_ARGS
294: NGR_R_SET_RETURN setnetgrent_r(const char *netgroup, NGR_R_ENT_ARGS);
295: #else
296: NGR_R_SET_RETURN setnetgrent_r(const char *netgroup);
297: #endif
298: #endif
299:
300: #ifdef NEED_ENDNETGRENT_R
301: #ifdef NGR_R_ENT_ARGS
302: NGR_R_END_RETURN endnetgrent_r(NGR_R_ENT_ARGS);
303: #else
304: NGR_R_END_RETURN endnetgrent_r(void);
305: #endif
306: #endif
307:
308: #ifdef POSIX_GETPWNAM_R
309: int
310: __posix_getpwnam_r(const char *login, struct passwd *pwptr,
311: char *buf, size_t buflen, struct passwd **result);
312: #endif
313:
314: #ifdef NEED_GETPWNAM_R
315: int
316: getpwnam_r(const char *login, struct passwd *pwptr,
317: char *buf, size_t buflen, struct passwd **result);
318: #endif
319:
320: #ifdef POSIX_GETPWUID_R
321: int
322: __posix_getpwuid_r(uid_t uid, struct passwd *pwptr,
323: char *buf, int buflen, struct passwd **result);
324: #endif
325:
326: #ifdef NEED_GETPWUID_R
327: int
328: getpwuid_r(uid_t uid, struct passwd *pwptr,
329: char *buf, size_t buflen, struct passwd **result);
330: #endif
331:
332: #ifdef NEED_SETPWENT_R
333: #ifdef PASS_R_ENT_ARGS
334: PASS_R_SET_RETURN setpwent_r(PASS_R_ENT_ARGS);
335: #else
336: PASS_R_SET_RETURN setpwent_r(void);
337: #endif
338:
339: #endif
340:
341: #ifdef NEED_SETPASSENT_R
342: #ifdef PASS_R_ENT_ARGS
343: PASS_R_SET_RETURN setpassent_r(int stayopen, PASS_R_ENT_ARGS);
344: #else
345: PASS_R_SET_RETURN setpassent_r(int stayopen);
346: #endif
347: #endif
348:
349: #ifdef NEED_GETPWENT_R
350: PASS_R_RETURN getpwent_r(struct passwd *pwptr, PASS_R_ARGS);
351: #endif
352:
353: #ifdef NEED_ENDPWENT_R
354: void endpwent_r(void);
355: #endif
356:
357: #ifdef NEED_SETPASSENT
358: int setpassent(int stayopen);
359: #endif
360:
361: #define gettimeofday isc__gettimeofday
362: #ifdef NEED_GETTIMEOFDAY
363: int isc__gettimeofday(struct timeval *tvp, struct _TIMEZONE *tzp);
364: #else
365: int isc__gettimeofday(struct timeval *tp, struct timezone *tzp);
366: #endif
367:
368: int getnetgrent(char **machinep, char **userp, char **domainp);
369:
370: int getnetgrent_r(char **machinep, char **userp, char **domainp, NGR_R_ARGS);
371:
372: #ifdef SETNETGRENT_ARGS
373: void setnetgrent(SETNETGRENT_ARGS);
374: #else
375: void setnetgrent(const char *netgroup);
376: #endif
377:
378: void endnetgrent(void);
379:
380: #ifdef INNETGR_ARGS
381: int innetgr(INNETGR_ARGS);
382: #else
383: int innetgr(const char *netgroup, const char *machine,
384: const char *user, const char *domain);
385: #endif
386:
387: #ifdef NGR_R_ENT_ARGS
388: NGR_R_SET_RETURN
389: setnetgrent_r(const char *netgroup, NGR_R_ENT_ARGS);
390: #else
391: NGR_R_SET_RETURN
392: setnetgrent_r(const char *netgroup);
393: #endif
394: #endif
CVSweb <webmaster@jp.NetBSD.org>