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