]>
git.saurik.com Git - apple/xnu.git/blob - bsd/netat/sysglue.h
2c84a83f42754eb1e3794c6be5ba38d55e7ea083
2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
29 * Title: sysglue.h - AppleTalk protocol to Unix System V/streams interface
31 * Facility: AppleTalk Protocol Execution Environment
33 * Author: Gregory Burns, Creation Date: Jun-3-1988
36 * X01-001 Gregory Burns 3-Jun-1988
41 #ifndef _NETAT_SYSGLUE_H_
42 #define _NETAT_SYSGLUE_H_
43 #include <sys/appleapiopts.h>
44 #include <sys/cdefs.h>
46 #ifdef __APPLE_API_OBSOLETE
49 The following is originally from netat/h/localglue.h, which was
50 included in netat/h/sysglue.h:
63 /* LP64 version of ioccmd_t. all pointers
64 * grow when we're dealing with a 64-bit process.
65 * WARNING - keep in sync with ioccmd_t
67 #if __DARWIN_ALIGN_NATURAL
68 #pragma options align=natural
78 #if __DARWIN_ALIGN_NATURAL
79 #pragma options align=reset
82 #endif // KERNEL_PRIVATE
97 * Want these definitions outside the KERNEL define for admin
101 #define MSG_DATA 0x00
102 #define MSG_PROTO 0x01
103 #define MSG_IOCTL 0x0e
104 #define MSG_ERROR 0x8a
105 #define MSG_HANGUP 0x89
106 #define MSG_IOCACK 0x81
107 #define MSG_IOCNAK 0x82
110 /* ### LD 5/3/97 MacOSX porting note:
111 * Cannot use MSG_DATA = 0, because MT_FREE is defined as 0
112 * and the sanity check in m_free cause a panic.
115 #define MSG_DATA (MT_MAX - 1)
116 #define MSG_PROTO (MT_MAX - 2)
117 #define MSG_IOCTL (MT_MAX - 3)
118 #define MSG_ERROR (MT_MAX - 4)
119 #define MSG_HANGUP (MT_MAX - 5)
120 #define MSG_IOCACK (MT_MAX - 6)
121 #define MSG_IOCNAK (MT_MAX - 7)
122 #define MSG_CTL (MT_MAX - 8)
126 #ifdef KERNEL_PRIVATE
128 #define SYS_HZ HZ /* Number of clock (SYS_SETTIMER) ticks per second */
129 #define HZ hz /* HZ ticks definition used throughout AppleTalk */
131 /* returned when the operation is not possible at this
132 * time (ie when starting up or shutting down.
133 * right now, uses ESHUTDOWN because ENOTREADY is not defined
134 * in MacOSX. Need to find a better Error code ###LD
136 #define ENOTREADY ESHUTDOWN
138 /* T_MPSAFE is used only in atp_open. I suspect it's a
139 * trick to accelerate local atp transactions.
143 #define INTERRUPTIBLE 1
144 #define POLLIN 0x0001
145 #define POLLOUT 0x0002
146 #define POLLPRI 0x0004
147 #define POLLMSG 0x0080
148 #define POLLSYNC 0x8000
149 #define POLLMSG 0x0080
152 * Define a new Data Type for file. it was DTYPE_OTHER for
153 * AIX, for MacOSX there is no such define so defines
157 #define DTYPE_ATALK -1
159 #define AT_WR_OFFSET 38
161 #define EVENT_NULL -1
162 #define LOCK_HANDLER 2
164 typedef int atevent_t
;
166 typedef int atlock_t
;
167 typedef int *atomic_p
;
168 #define ATLOCKINIT(a) (a = (atlock_t) EVENT_NULL)
169 #define ATDISABLE(l, a)
170 #define ATENABLE(l, a)
171 #define ATEVENTINIT(a) (a = (atevent_t) EVENT_NULL)
172 #define DDP_OUTPUT(m) ddp_putmsg(0,m)
173 #define StaticProc static
179 typedef struct mbuf gbuf_t
;
181 /* prototypes for the gbuf routines */
183 struct mbuf
*m_lgbuf_alloc(int size
, int wait
);
184 gbuf_t
*gbuf_alloc_wait(int size
, int wait
);
185 gbuf_t
*gbuf_copym(gbuf_t
*mlist
);
186 gbuf_t
*gbuf_strip(gbuf_t
*m
);
187 int gbuf_freel(gbuf_t
*m
);
188 void gbuf_linkb(gbuf_t
*m1
, gbuf_t
*m2
);
189 void gbuf_linkpkt(gbuf_t
*m1
, gbuf_t
*m2
);
190 int gbuf_msgsize(gbuf_t
*m
);
192 #define gbuf_cont(m) m->m_next
193 #define gbuf_next(m) m->m_nextpkt
194 #define gbuf_rptr(m) m->m_data
195 #define gbuf_rinc(m,len) {m->m_data += len; m->m_len -= len;}
196 #define gbuf_rdec(m,len) {m->m_data -= len; m->m_len += len;}
197 #define gbuf_wptr(m) (m->m_data + m->m_len)
198 #define gbuf_winc(m,len) (m->m_len += len)
199 #define gbuf_wdec(m,len) (m->m_len -= len)
200 #define gbuf_wset(m,len) (m->m_len = len)
201 #define gbuf_type(m) m->m_type
202 #define gbuf_len(m) m->m_len
204 #define gbuf_alloc(size, pri) (gbuf_alloc_wait(size, FALSE))
205 #define gbuf_copym(mlist) ((gbuf_t *)copy_pkt(mlist, -1))
207 #define gbuf_prepend(m,len) M_PREPEND(m,len,M_DONTWAIT)
208 #define gbuf_freem(mlist) m_freem((struct mbuf *)mlist)
209 #define gbuf_freeb(m) (void)m_free((struct mbuf *)m)
210 #define gbuf_set_type(m, mtype) MCHTYPE(m, mtype)
212 /* Duplicate a single mbuf, attaching existing external storage. */
213 #define gbuf_dupb_wait(m, wait) ((gbuf_t *)m_copym(m, 0, gbuf_len(m), (wait)? M_WAIT: M_DONTWAIT))
214 #define gbuf_dupb(m) (gbuf_dupb_wait(m, FALSE))
215 /* Duplicate an mbuf chain, attaching existing external storage. */
216 #define gbuf_dupm(mlist) ((gbuf_t *)copy_pkt(mlist, -1))
217 /* *** was ((gbuf_t *)m_copym(mlist, 0, M_COPYALL, M_DONTWAIT)) *** */
223 #endif /* KERNEL_PRIVATE */
225 #endif /* __APPLE_API_OBSOLETE */
226 #endif /* _NETAT_SYSGLUE_H_ */