]>
git.saurik.com Git - apple/xnu.git/blob - bsd/net/net_osdep.h
eeb7c2f026cf5199cb13a98e82085b8f4b4eb9a9
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
23 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
24 * All rights reserved.
26 * Redistribution and use in source and binary forms, with or without
27 * modification, are permitted provided that the following conditions
29 * 1. Redistributions of source code must retain the above copyright
30 * notice, this list of conditions and the following disclaimer.
31 * 2. Redistributions in binary form must reproduce the above copyright
32 * notice, this list of conditions and the following disclaimer in the
33 * documentation and/or other materials provided with the distribution.
34 * 3. Neither the name of the project nor the names of its contributors
35 * may be used to endorse or promote products derived from this software
36 * without specific prior written permission.
38 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
39 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
41 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
42 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
43 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
44 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
45 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
46 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
47 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * glue for kernel code programming differences.
57 * - privileged process
60 * if (p && !suser(p->p_ucred, &p->p_acflag))
62 * OpenBSD, BSDI [34], FreeBSD 2
64 * if (so->so_state & SS_PRIV)
68 * needs to give struct proc * as argument
69 * OpenBSD, BSDI [34], FreeBSD 2
70 * do not need struct proc *
72 * OpenBSD, NetBSD, BSDI [34]
73 * need caddr_t * (= if_bpf **) and struct ifnet *
74 * FreeBSD 2, FreeBSD 3
75 * need only struct ifnet * as argument
77 * use queue.h? member names if name
79 * FreeBSD 2 no old standard if_name+unit
80 * FreeBSD 3 yes strange if_name+unit
81 * OpenBSD yes standard if_xname
82 * NetBSD yes standard if_xname
83 * BSDI [34] no old standard if_name+unit
85 * NetBSD, OpenBSD, BSDI [34], FreeBSD 2
86 * single function with PRU_xx, arguments are mbuf
88 * separates functions, non-mbuf arguments
90 * NetBSD, OpenBSD, BSDI [34], FreeBSD 2
91 * manipulation based on mbuf
93 * non-mbuf manipulation using sooptcopy{in,out}()
94 * - timeout() and untimeout()
95 * NetBSD, OpenBSD, BSDI [34], FreeBSD 2
96 * timeout() is a void function
98 * timeout() is non-void, must keep returned value for untimeuot()
103 * foo_sysctl() but with different style
104 * FreeBSD 2, FreeBSD 3
108 * NetBSD, FreeBSD 3, BSDI [34]
109 * 2nd argument is u_long cmd
111 * 2nd argument is int cmd
112 * - if attach routines
114 * void xxattach(int);
115 * FreeBSD 2, FreeBSD 3
116 * void xxattach(void *);
117 * PSEUDO_SET(xxattach, if_xx);
120 * in NetBSD 1.4 or later, ovbcopy() is not supplied in the kernel.
121 * bcopy() is safe against overwrites.
123 * NetBSD 1.4 or later requires splsoftnet().
124 * other operating systems use splnet().
129 * - struct ifnet for loopback interface
130 * BSDI3: struct ifnet loif;
131 * BSDI4: struct ifnet *loifp;
132 * NetBSD, OpenBSD, FreeBSD2: struct ifnet loif[NLOOP];
134 * odd thing is that many of them refers loif as ifnet *loif,
135 * not loif[NLOOP], from outside of if_loop.c.
138 #ifndef __NET_NET_OSDEP_H_DEFINED_
139 #define __NET_NET_OSDEP_H_DEFINED_
142 #if defined(__NetBSD__) || defined(__OpenBSD__)
143 #define if_name(ifp) ((ifp)->if_xname)
146 extern char *if_name
__P((struct ifnet
*));
149 #if defined (__APPLE__)
153 //#if defined(__FreeBSD__) && __FreeBSD__ >= 3
154 #if defined (__APPLE__)
155 #define ifa_list ifa_link
156 #define if_addrlist if_addrhead
157 #define if_list if_link
160 #if defined(__NetBSD__) && __NetBSD_Version__ >= 104000000
161 #define ovbcopy bcopy
164 #if defined(__OpenBSD__) || (defined(__bsdi__) && _BSDI_VERSION >= 199802)
165 #define HAVE_NRL_INPCB
169 #endif /*__NET_NET_OSDEP_H_DEFINED_ */