3 Operating system dependencies... */
6 * Copyright (c) 2004-2005,2007-2010 by Internet Systems Consortium,
8 * Copyright (c) 1996-2003 by Internet Software Consortium
10 * Permission to use, copy, modify, and distribute this software for any
11 * purpose with or without fee is hereby granted, provided that the above
12 * copyright notice and this permission notice appear in all copies.
14 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
15 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
16 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
17 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
19 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
20 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 * Internet Systems Consortium, Inc.
24 * Redwood City, CA 94063
26 * https://www.isc.org/
28 * This software has been written for Internet Systems Consortium
29 * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
30 * To learn more about Internet Systems Consortium, see
31 * ``https://www.isc.org/''. To learn more about Vixie Enterprises,
32 * see ``http://www.vix.com''. To learn more about Nominum, Inc., see
33 * ``http://www.nominum.com''.
36 #if !defined (__ISC_DHCP_OSDEP_H__)
37 #define __ISC_DHCP_OSDEP_H__
46 #define LITTLE_ENDIAN 1234
47 #endif /* LITTLE_ENDIAN */
50 #define BIG_ENDIAN 4321
51 #endif /* BIG_ENDIAN */
54 #define BYTE_ORDER DHCP_BYTE_ORDER
55 #endif /* BYTE_ORDER */
59 If you add a new network API, you must add a check for it below: */
61 #if !defined (USE_SOCKETS) && \
62 !defined (USE_SOCKET_SEND) && \
63 !defined (USE_SOCKET_RECEIVE) && \
64 !defined (USE_RAW_SOCKETS) && \
65 !defined (USE_RAW_SEND) && \
66 !defined (USE_SOCKET_RECEIVE) && \
67 !defined (USE_BPF) && \
68 !defined (USE_BPF_SEND) && \
69 !defined (USE_BPF_RECEIVE) && \
70 !defined (USE_LPF) && \
71 !defined (USE_LPF_SEND) && \
72 !defined (USE_LPF_RECEIVE) && \
73 !defined (USE_NIT) && \
74 !defined (USE_NIT_SEND) && \
75 !defined (USE_NIT_RECEIVE) && \
76 !defined (USE_DLPI_SEND) && \
77 !defined (USE_DLPI_RECEIVE)
78 /* Determine default socket API to USE. */
79 # if defined(HAVE_BPF)
81 # elif defined(HAVE_LPF)
83 # elif defined(HAVE_DLPI)
88 #if !defined (TIME_MAX)
89 # define TIME_MAX 2147483647
92 /* snprintf/vsnprintf hacks. for systems with no libc versions only. */
94 extern int isc_print_snprintf(char *, size_t, const char *, ...);
95 extern int isc_print_vsnprintf(char *, size_t, const char *, va_list ap);
96 # define snprintf isc_print_snprintf
97 # define vsnprintf isc_print_vsnprintf
102 If you add a new network API, and have it set up so that it can be
103 used for sending or receiving, but doesn't have to be used for both,
104 then set up an ifdef like the ones below: */
107 # define USE_SOCKET_SEND
108 # define USE_SOCKET_RECEIVE
109 # if defined(HAVE_DLPI)
110 # define USE_DLPI_HWADDR
114 #ifdef USE_RAW_SOCKETS
115 # define USE_RAW_SEND
116 # define USE_SOCKET_RECEIVE
120 # define USE_BPF_SEND
121 # define USE_BPF_RECEIVE
125 # define USE_LPF_SEND
126 # define USE_LPF_RECEIVE
130 # define USE_NIT_SEND
131 # define USE_NIT_RECEIVE
135 # define USE_DLPI_SEND
136 # define USE_DLPI_RECEIVE
140 # define USE_UPF_SEND
141 # define USE_UPF_RECEIVE
146 If you add support for sending packets directly out an interface,
147 and your support does not do ARP or routing, you must use a fallback
148 mechanism to deal with packets that need to be sent to routers.
149 Currently, all low-level packet interfaces use BSD sockets as a
152 #if defined (USE_BPF_SEND) || defined (USE_NIT_SEND) || \
153 defined (USE_DLPI_SEND) || defined (USE_UPF_SEND) || \
154 defined (USE_LPF_SEND) || \
155 (defined (USE_SOCKET_SEND) && defined (HAVE_SO_BINDTODEVICE))
156 # define USE_SOCKET_FALLBACK
157 # define USE_FALLBACK
162 If you add support for sending packets directly out an interface
163 and need to be able to assemble packets, add the USE_XXX_SEND
164 definition for your interface to the list tested below. */
166 #if defined (USE_RAW_SEND) || defined (USE_BPF_SEND) || \
167 defined (USE_NIT_SEND) || defined (USE_UPF_SEND) || \
168 defined (USE_DLPI_SEND) || defined (USE_LPF_SEND)
169 # define PACKET_ASSEMBLY
174 If you add support for receiving packets directly from an interface
175 and need to be able to decode raw packets, add the USE_XXX_RECEIVE
176 definition for your interface to the list tested below. */
178 #if defined (USE_RAW_RECEIVE) || defined (USE_BPF_SEND) || \
179 defined (USE_NIT_RECEIVE) || defined (USE_UPF_RECEIVE) || \
180 defined (USE_DLPI_RECEIVE) || defined (USE_LPF_RECEIVE)
181 # define PACKET_DECODING
184 /* If we don't have a DLPI packet filter, we have to filter in userland.
185 Probably not worth doing, actually. */
186 #if defined (USE_DLPI_RECEIVE) && !defined (USE_DLPI_PFMOD)
187 # define USERLAND_FILTER
190 /* jmp_buf is assumed to be a struct unless otherwise defined in the
193 # define jbp_decl(x) jmp_buf *x
196 # define jref(x) (&(x))
199 # define jdref(x) (*(x))
202 # define jrefproto jmp_buf *
206 # define BPF_FORMAT "/dev/bpf%d"
209 #if defined (F_SETFD) && !defined (HAVE_SETFD)
213 #if defined (IFF_POINTOPOINT) && !defined (HAVE_IFF_POINTOPOINT)
214 # define HAVE_IFF_POINTOPOINT
217 #if defined (AF_LINK) && !defined (HAVE_AF_LINK)
218 # define HAVE_AF_LINK
221 #if defined (ARPHRD_TUNNEL) && !defined (HAVE_ARPHRD_TUNNEL)
222 # define HAVE_ARPHRD_TUNNEL
225 #if defined (ARPHRD_LOOPBACK) && !defined (HAVE_ARPHRD_LOOPBACK)
226 # define HAVE_ARPHRD_LOOPBACK
229 #if defined (ARPHRD_ROSE) && !defined (HAVE_ARPHRD_ROSE)
230 # define HAVE_ARPHRD_ROSE
233 #if defined (ARPHRD_IRDA) && !defined (HAVE_ARPHRD_IRDA)
234 # define HAVE_ARPHRD_IRDA
237 #if defined (ARPHRD_SIT) && !defined (HAVE_ARPHRD_SIT)
238 # define HAVE_ARPHRD_SIT
241 #if defined (ARPHRD_IEEE1394) & !defined (HAVE_ARPHRD_IEEE1394)
242 # define HAVE_ARPHRD_IEEE1394
245 #if defined (ARPHRD_IEEE802) && !defined (HAVE_ARPHRD_IEEE802)
246 # define HAVE_ARPHRD_IEEE802
249 #if defined (ARPHRD_IEEE802_TR) && !defined (HAVE_ARPHRD_IEEE802_TR)
250 # define HAVE_ARPHRD_IEEE802_TR
253 #if defined (ARPHRD_FDDI) && !defined (HAVE_ARPHRD_FDDI)
254 # define HAVE_ARPHRD_FDDI
257 #if defined (ARPHRD_AX25) && !defined (HAVE_ARPHRD_AX25)
258 # define HAVE_ARPHRD_AX25
261 #if defined (ARPHRD_NETROM) && !defined (HAVE_ARPHRD_NETROM)
262 # define HAVE_ARPHRD_NETROM
265 #if defined (ARPHRD_METRICOM) && !defined (HAVE_ARPHRD_METRICOM)
266 # define HAVE_ARPHRD_METRICOM
269 #if defined (SO_BINDTODEVICE) && !defined (HAVE_SO_BINDTODEVICE)
270 # define HAVE_SO_BINDTODEVICE
273 #if defined (AF_LINK) && !defined (HAVE_AF_LINK)
274 # define HAVE_AF_LINK
277 /* Linux needs to define SHUT_* in /usr/include/sys/socket.h someday... */
278 #if !defined (SHUT_RD)
282 #if !defined (SOCKLEN_T)
283 # define SOCKLEN_T socklen_t
286 #define SOCKLEN_T socklen_t
289 #if !defined (STDERR_FILENO)
290 # define STDERR_FILENO 2
293 #endif /* __ISC_DHCP_OSDEP_H__ */