kernel - Introduce lightweight buffers
[dragonfly.git] / lib / libbind / port_before.h
1 /*
2  * Copyright (C) 2005-2008  Internet Systems Consortium, Inc. ("ISC")
3  * Copyright (C) 2001  Internet Software Consortium.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15  * PERFORMANCE OF THIS SOFTWARE.
16  */
17
18 /* $Id: port_before.h.in,v 1.27.128.3 2008/02/28 05:46:12 marka Exp $ */
19
20 #ifndef port_before_h
21 #define port_before_h
22 #include <config.h>
23
24 #ifdef NEED_SUN4PROTOS
25 #define _PARAMS(x) x
26 #endif
27
28 struct group;           /* silence warning */
29 struct passwd;          /* silence warning */
30 struct timeval;         /* silence warning */
31 struct timezone;        /* silence warning */
32
33 #ifdef HAVE_SYS_TIMERS_H
34 #include <sys/timers.h>
35 #endif
36 #include <limits.h>
37
38 #ifdef ISC_PLATFORM_NEEDTIMESPEC
39 #include <time.h>               /* For time_t */
40 struct timespec {
41         time_t  tv_sec;         /* seconds */
42         long    tv_nsec;        /* nanoseconds */
43 };
44 #endif
45 #ifndef HAVE_MEMMOVE
46 /*#define memmove(a,b,c) bcopy(b,a,c)*/
47 #endif
48
49 #undef WANT_IRS_GR
50 #undef WANT_IRS_NIS
51 #undef WANT_IRS_PW
52
53 #undef BSD_COMP
54 #undef HAVE_POLL
55 #undef HAVE_MD5
56 #undef SOLARIS2
57
58 #undef DO_PTHREADS
59 #define GETGROUPLIST_ARGS const char *name, gid_t basegid, gid_t *groups, int *ngroups
60 #define GETNETBYADDR_ADDR_T unsigned long int
61 #define SETPWENT_VOID 1
62 #define SETGRENT_VOID 1
63
64 #define NET_R_ARGS char *buf, size_t buflen, struct netent **answerp, int *h_errnop
65 #define NET_R_BAD ERANGE
66 #define NET_R_COPY buf, buflen
67 #define NET_R_COPY_ARGS char *buf, size_t buflen
68 #define NET_R_END_RESULT(x) /*empty*/
69 #define NET_R_END_RETURN void
70 #undef NET_R_ENT_ARGS /*empty*/
71 #define NET_R_OK 0
72 #define NET_R_RETURN int
73 #undef NET_R_SET_RESULT /*empty*/
74 #define NET_R_SETANSWER 1
75 #define NET_R_SET_RETURN void
76 #undef NETENT_DATA
77
78
79 #define GROUP_R_SET_RETURN void
80 #undef GROUP_R_SET_RESULT /*empty*/
81 #define GROUP_R_END_RETURN void
82 #define GROUP_R_END_RESULT(x) /*empty*/
83
84 #define GROUP_R_ENT_ARGS void
85
86
87
88 #define HOST_R_ARGS char *buf, size_t buflen, struct hostent **answerp, int *h_errnop
89 #define HOST_R_BAD ERANGE
90 #define HOST_R_COPY buf, buflen
91 #define HOST_R_COPY_ARGS char *buf, int buflen
92 #define HOST_R_END_RESULT(x) /*empty*/
93 #define HOST_R_END_RETURN void
94 #undef HOST_R_ENT_ARGS /*empty*/
95 #define HOST_R_ERRNO *h_errnop = h_errno
96 #define HOST_R_OK 0
97 #define HOST_R_RETURN int
98 #define HOST_R_SETANSWER 1
99 #undef HOST_R_SET_RESULT
100 #define HOST_R_SET_RETURN void
101 #undef HOSTENT_DATA
102
103 #define NGR_R_ARGS char *buf, int buflen
104 #define NGR_R_BAD (0)
105 #define NGR_R_COPY buf, buflen
106 #define NGR_R_COPY_ARGS NGR_R_ARGS
107 #define NGR_R_CONST
108 #define NGR_R_END_RESULT(x)  /*empty*/
109 #define NGR_R_END_RETURN void
110 #undef NGR_R_END_ARGS /*empty*/
111 #define NGR_R_OK 1
112 #define NGR_R_RETURN int
113 #define NGR_R_SET_CONST const
114 #undef NGR_R_SET_RESULT /*empty*/
115 #define NGR_R_SET_RETURN void
116 #undef NGR_R_SET_ARGS
117
118
119 #if !defined(NGR_R_SET_ARGS) && defined(NGR_R_END_ARGS)
120 #define NGR_R_SET_ARGS NGR_R_END_ARGS
121 #endif
122
123 #define PROTO_R_ARGS char *buf, size_t buflen, struct protoent **answerp
124 #define PROTO_R_BAD ERANGE
125 #define PROTO_R_COPY buf, buflen
126 #define PROTO_R_COPY_ARGS char *buf, size_t buflen
127 #define PROTO_R_END_RESULT(x) /*empty*/
128 #define PROTO_R_END_RETURN void
129 #undef PROTO_R_ENT_ARGS /*empty*/
130 #undef PROTO_R_ENT_UNUSED
131 #define PROTO_R_OK 0
132 #define PROTO_R_SETANSWER 1
133 #define PROTO_R_RETURN int
134 #undef PROTO_R_SET_RESULT
135 #define PROTO_R_SET_RETURN void
136 #undef PROTOENT_DATA
137
138
139
140
141
142 #define PASS_R_END_RESULT(x) /*empty*/
143 #define PASS_R_END_RETURN void
144 #undef PASS_R_ENT_ARGS
145
146
147 #undef PASS_R_SET_RESULT /*empty*/
148 #define PASS_R_SET_RETURN void
149
150 #define SERV_R_ARGS char *buf, size_t buflen, struct servent **answerp
151 #define SERV_R_BAD ERANGE
152 #define SERV_R_COPY buf, buflen
153 #define SERV_R_COPY_ARGS char *buf, size_t buflen
154 #define SERV_R_END_RESULT(x) /*empty*/
155 #define SERV_R_END_RETURN void 
156 #undef SERV_R_ENT_ARGS /*empty*/
157 #undef SERV_R_ENT_UNUSED /*empty*/
158 #define SERV_R_OK (0)
159 #define SERV_R_SETANSWER 1
160 #define SERV_R_RETURN int
161 #undef SERV_R_SET_RESULT
162 #define SERV_R_SET_RETURN void
163
164
165
166 #define DE_CONST(konst, var) \
167         do { \
168                 union { const void *k; void *v; } _u; \
169                 _u.k = konst; \
170                 var = _u.v; \
171         } while (0)
172
173 #define UNUSED(x) (x) = (x)
174
175 #undef NEED_SOLARIS_BITTYPES
176 #define ISC_SOCKLEN_T socklen_t
177
178 #ifdef __GNUC__
179 #define ISC_FORMAT_PRINTF(fmt, args) \
180         __attribute__((__format__(__printf__, fmt, args)))
181 #else
182 #define ISC_FORMAT_PRINTF(fmt, args)
183 #endif
184
185 /* Pull in host order macros when _XOPEN_SOURCE_EXTENDED is defined. */
186 #if defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED)
187 #include <sys/byteorder.h>
188 #endif
189
190 #endif
191
192 /*! \file */