Merge from vendor branch DHCP:
[dragonfly.git] / contrib / isc-dhcp / includes / osdep.h
1 /* osdep.h
2
3    Operating system dependencies... */
4
5 /*
6  * Copyright (c) 1996-1999 Internet Software Consortium.
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. Neither the name of The Internet Software Consortium nor the names
19  *    of its contributors may be used to endorse or promote products derived
20  *    from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
23  * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
24  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26  * DISCLAIMED.  IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
27  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
30  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
33  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34  * SUCH DAMAGE.
35  *
36  * This software has been written for the Internet Software Consortium
37  * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
38  * To learn more about the Internet Software Consortium, see
39  * ``http://www.isc.org/''.  To learn more about Vixie Enterprises,
40  * see ``http://www.vix.com''.   To learn more about Nominum, Inc., see
41  * ``http://www.nominum.com''.
42  */
43
44 #if !defined (__ISC_DHCP_OSDEP_H__)
45 #define __ISC_DHCP_OSDEP_H__
46
47 #include "site.h"
48
49 /* Porting::
50
51    If you add a new network API, you must add a check for it below: */
52
53 #if !defined (USE_SOCKETS) && \
54     !defined (USE_SOCKET_SEND) && \
55     !defined (USE_SOCKET_RECEIVE) && \
56     !defined (USE_RAW_SOCKETS) && \
57     !defined (USE_RAW_SEND) && \
58     !defined (USE_SOCKET_RECEIVE) && \
59     !defined (USE_BPF) && \
60     !defined (USE_BPF_SEND) && \
61     !defined (USE_BPF_RECEIVE) && \
62     !defined (USE_LPF) && \
63     !defined (USE_LPF_SEND) && \
64     !defined (USE_LPF_RECEIVE) && \
65     !defined (USE_NIT) && \
66     !defined (USE_NIT_SEND) && \
67     !defined (USE_NIT_RECEIVE) && \
68     !defined (USR_DLPI_SEND) && \
69     !defined (USE_DLPI_RECEIVE)
70 #  define USE_DEFAULT_NETWORK
71 #endif
72
73 #if !defined (TIME_MAX)
74 # define TIME_MAX 2147483647
75 #endif
76
77 /* Porting::
78
79    If you add a new system configuration file, include it here: */
80
81 #if defined (sun)
82 # if defined (__svr4__) || defined (__SVR4)
83 #  include "cf/sunos5-5.h"
84 # else
85 #  include "cf/sunos4.h"
86 # endif
87 #endif
88
89 #ifdef aix
90 #  include "cf/aix.h"
91 #endif
92
93 #ifdef bsdi
94 #  include "cf/bsdos.h"
95 #endif
96
97 #ifdef __NetBSD__
98 #  include "cf/netbsd.h"
99 #endif
100
101 #ifdef __FreeBSD__
102 #  include "cf/freebsd.h"
103 #endif
104
105 #ifdef OpenBSD
106 #  include "cf/openbsd.h"
107 #endif
108
109 #if defined (__osf__) && defined (__alpha)
110 #  include "cf/alphaosf.h"
111 #endif
112
113 #ifdef ultrix
114 #  include "cf/ultrix.h"
115 #endif
116
117 #ifdef linux
118 #  include "cf/linux.h"
119 #endif
120
121 #ifdef SCO
122 #  include "cf/sco.h"
123 #endif
124
125 #if defined (hpux) || defined (__hpux)
126 #  include "cf/hpux.h"
127 #endif
128
129 #ifdef __QNX__
130 #  include "cf/qnx.h"
131 #endif
132
133 #ifdef __CYGWIN32__
134 #  include "cf/cygwin32.h"
135 #endif
136
137 #ifdef __APPLE__
138 # include "cf/rhapsody.h"
139 #else
140 # if defined (NeXT)
141 #  include "cf/nextstep.h"
142 # endif
143 #endif
144
145 /* Porting::
146
147    If you add a new network API, and have it set up so that it can be
148    used for sending or receiving, but doesn't have to be used for both,
149    then set up an ifdef like the ones below: */
150
151 #ifdef USE_SOCKETS
152 #  define USE_SOCKET_SEND
153 #  define USE_SOCKET_RECEIVE
154 #endif
155
156 #ifdef USE_RAW_SOCKETS
157 #  define USE_RAW_SEND
158 #  define USE_SOCKET_RECEIVE
159 #endif
160
161 #ifdef USE_BPF
162 #  define USE_BPF_SEND
163 #  define USE_BPF_RECEIVE
164 #endif
165
166 #ifdef USE_LPF
167 #  define USE_LPF_SEND
168 #  define USE_LPF_RECEIVE
169 #endif
170
171 #ifdef USE_NIT
172 #  define USE_NIT_SEND
173 #  define USE_NIT_RECEIVE
174 #endif
175
176 #ifdef USE_DLPI
177 #  define USE_DLPI_SEND
178 #  define USE_DLPI_RECEIVE
179 #endif
180
181 #ifdef USE_UPF
182 #  define USE_UPF_SEND
183 #  define USE_UPF_RECEIVE
184 #endif
185
186 /* Porting::
187
188    If you add support for sending packets directly out an interface,
189    and your support does not do ARP or routing, you must use a fallback
190    mechanism to deal with packets that need to be sent to routers.
191    Currently, all low-level packet interfaces use BSD sockets as a
192    fallback. */
193
194 #if defined (USE_BPF_SEND) || defined (USE_NIT_SEND) || \
195     defined (USE_DLPI_SEND) || defined (USE_UPF_SEND) || \
196     defined (USE_LPF_SEND) || \
197     (defined (USE_SOCKET_SEND) && defined (HAVE_SO_BINDTODEVICE))
198 #  define USE_SOCKET_FALLBACK
199 #  define USE_FALLBACK
200 #endif
201
202 /* Porting::
203
204    If you add support for sending packets directly out an interface
205    and need to be able to assemble packets, add the USE_XXX_SEND
206    definition for your interface to the list tested below. */
207
208 #if defined (USE_RAW_SEND) || defined (USE_BPF_SEND) || \
209                 defined (USE_NIT_SEND) || defined (USE_UPF_SEND) || \
210                 defined (USE_DLPI_SEND) || defined (USE_LPF_SEND)
211 #  define PACKET_ASSEMBLY
212 #endif
213
214 /* Porting::
215
216    If you add support for receiving packets directly from an interface
217    and need to be able to decode raw packets, add the USE_XXX_RECEIVE
218    definition for your interface to the list tested below. */
219
220 #if defined (USE_RAW_RECEIVE) || defined (USE_BPF_SEND) || \
221                 defined (USE_NIT_RECEIVE) || defined (USE_UPF_RECEIVE) || \
222                 defined (USE_DLPI_RECEIVE) || defined (USE_LPF_RECEIVE)
223 #  define PACKET_DECODING
224 #endif
225
226 /* If we don't have a DLPI packet filter, we have to filter in userland.
227    Probably not worth doing, actually. */
228 #if defined (USE_DLPI_RECEIVE) && !defined (USE_DLPI_PFMOD)
229 #  define USERLAND_FILTER
230 #endif
231
232 /* jmp_buf is assumed to be a struct unless otherwise defined in the
233    system header. */
234 #ifndef jbp_decl
235 # define jbp_decl(x)    jmp_buf *x
236 #endif
237 #ifndef jref
238 # define jref(x)        (&(x))
239 #endif
240 #ifndef jdref
241 # define jdref(x)       (*(x))
242 #endif
243 #ifndef jrefproto
244 # define jrefproto      jmp_buf *
245 #endif
246
247 #ifndef BPF_FORMAT
248 # define BPF_FORMAT "/dev/bpf%d"
249 #endif
250
251 #if defined (F_SETFD) && !defined (HAVE_SETFD)
252 # define HAVE_SETFD
253 #endif
254
255 #if defined (IFF_POINTOPOINT) && !defined (HAVE_IFF_POINTOPOINT)
256 # define HAVE_IFF_POINTOPOINT
257 #endif
258
259 #if defined (AF_LINK) && !defined (HAVE_AF_LINK)
260 # define HAVE_AF_LINK
261 #endif
262
263 #if defined (ARPHRD_TUNNEL) && !defined (HAVE_ARPHRD_TUNNEL)
264 # define HAVE_ARPHRD_TUNNEL
265 #endif
266
267 #if defined (ARPHRD_LOOPBACK) && !defined (HAVE_ARPHRD_LOOPBACK)
268 # define HAVE_ARPHRD_LOOPBACK
269 #endif
270
271 #if defined (ARPHRD_ROSE) && !defined (HAVE_ARPHRD_ROSE)
272 # define HAVE_ARPHRD_ROSE
273 #endif
274
275 #if defined (ARPHRD_IEEE802) && !defined (HAVE_ARPHRD_IEEE802)
276 # define HAVE_ARPHRD_IEEE802
277 #endif
278
279 #if defined (ARPHRD_IEEE802_TR) && !defined (HAVE_ARPHRD_IEEE802_TR)
280 # define HAVE_ARPHRD_IEEE802_TR
281 #endif
282
283 #if defined (ARPHRD_FDDI) && !defined (HAVE_ARPHRD_FDDI)
284 # define HAVE_ARPHRD_FDDI
285 #endif
286
287 #if defined (ARPHRD_AX25) && !defined (HAVE_ARPHRD_AX25)
288 # define HAVE_ARPHRD_AX25
289 #endif
290
291 #if defined (ARPHRD_NETROM) && !defined (HAVE_ARPHRD_NETROM)
292 # define HAVE_ARPHRD_NETROM
293 #endif
294
295 #if defined (ARPHRD_METRICOM) && !defined (HAVE_ARPHRD_METRICOM)
296 # define HAVE_ARPHRD_METRICOM
297 #endif
298
299 #if defined (SO_BINDTODEVICE) && !defined (HAVE_SO_BINDTODEVICE)
300 # define HAVE_SO_BINDTODEVICE
301 #endif
302
303 #if defined (AF_LINK) && !defined (HAVE_AF_LINK)
304 # define HAVE_AF_LINK
305 #endif
306
307 /* Linux needs to define SHUT_* in /usr/include/sys/socket.h someday... */
308 #if !defined (SHUT_RD)
309 # define SHUT_RD 0
310 #endif
311
312 #if !defined (SOCKLEN_T)
313 #define SOCKLEN_T socklen_t
314 #endif
315
316 #endif /* __ISC_DHCP_OSDEP_H__ */