]>
git.saurik.com Git - apple/xnu.git/blob - bsd/netat/sysglue.h
2 * Copyright (c) 2000-2005 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 * Title: sysglue.h - AppleTalk protocol to Unix System V/streams interface
25 * Facility: AppleTalk Protocol Execution Environment
27 * Author: Gregory Burns, Creation Date: Jun-3-1988
30 * X01-001 Gregory Burns 3-Jun-1988
35 #ifndef _NETAT_SYSGLUE_H_
36 #define _NETAT_SYSGLUE_H_
37 #include <sys/appleapiopts.h>
38 #include <sys/cdefs.h>
40 #ifdef __APPLE_API_OBSOLETE
43 The following is originally from netat/h/localglue.h, which was
44 included in netat/h/sysglue.h:
57 /* LP64 version of ioccmd_t. all pointers
58 * grow when we're dealing with a 64-bit process.
59 * WARNING - keep in sync with ioccmd_t
61 #if __DARWIN_ALIGN_NATURAL
62 #pragma options align=natural
72 #if __DARWIN_ALIGN_NATURAL
73 #pragma options align=reset
76 #endif // KERNEL_PRIVATE
91 * Want these definitions outside the KERNEL define for admin
96 #define MSG_PROTO 0x01
97 #define MSG_IOCTL 0x0e
98 #define MSG_ERROR 0x8a
99 #define MSG_HANGUP 0x89
100 #define MSG_IOCACK 0x81
101 #define MSG_IOCNAK 0x82
104 /* ### LD 5/3/97 MacOSX porting note:
105 * Cannot use MSG_DATA = 0, because MT_FREE is defined as 0
106 * and the sanity check in m_free cause a panic.
109 #define MSG_DATA (MT_MAX - 1)
110 #define MSG_PROTO (MT_MAX - 2)
111 #define MSG_IOCTL (MT_MAX - 3)
112 #define MSG_ERROR (MT_MAX - 4)
113 #define MSG_HANGUP (MT_MAX - 5)
114 #define MSG_IOCACK (MT_MAX - 6)
115 #define MSG_IOCNAK (MT_MAX - 7)
116 #define MSG_CTL (MT_MAX - 8)
120 #ifdef KERNEL_PRIVATE
122 #define SYS_HZ HZ /* Number of clock (SYS_SETTIMER) ticks per second */
123 #define HZ hz /* HZ ticks definition used throughout AppleTalk */
125 /* returned when the operation is not possible at this
126 * time (ie when starting up or shutting down.
127 * right now, uses ESHUTDOWN because ENOTREADY is not defined
128 * in MacOSX. Need to find a better Error code ###LD
130 #define ENOTREADY ESHUTDOWN
132 /* T_MPSAFE is used only in atp_open. I suspect it's a
133 * trick to accelerate local atp transactions.
137 #define INTERRUPTIBLE 1
138 #define POLLIN 0x0001
139 #define POLLOUT 0x0002
140 #define POLLPRI 0x0004
141 #define POLLMSG 0x0080
142 #define POLLSYNC 0x8000
143 #define POLLMSG 0x0080
146 * Define a new Data Type for file. it was DTYPE_OTHER for
147 * AIX, for MacOSX there is no such define so defines
151 #define DTYPE_ATALK -1
153 #define AT_WR_OFFSET 38
155 #define EVENT_NULL -1
156 #define LOCK_HANDLER 2
158 typedef int atevent_t
;
160 typedef int atlock_t
;
161 typedef int *atomic_p
;
162 #define ATLOCKINIT(a) (a = (atlock_t) EVENT_NULL)
163 #define ATDISABLE(l, a)
164 #define ATENABLE(l, a)
165 #define ATEVENTINIT(a) (a = (atevent_t) EVENT_NULL)
166 #define DDP_OUTPUT(m) ddp_putmsg(0,m)
167 #define StaticProc static
173 typedef struct mbuf gbuf_t
;
175 /* prototypes for the gbuf routines */
177 struct mbuf
*m_lgbuf_alloc(int size
, int wait
);
178 gbuf_t
*gbuf_alloc_wait(int size
, int wait
);
179 gbuf_t
*gbuf_copym(gbuf_t
*mlist
);
180 gbuf_t
*gbuf_strip(gbuf_t
*m
);
181 int gbuf_freel(gbuf_t
*m
);
182 void gbuf_linkb(gbuf_t
*m1
, gbuf_t
*m2
);
183 void gbuf_linkpkt(gbuf_t
*m1
, gbuf_t
*m2
);
184 int gbuf_msgsize(gbuf_t
*m
);
186 #define gbuf_cont(m) m->m_next
187 #define gbuf_next(m) m->m_nextpkt
188 #define gbuf_rptr(m) m->m_data
189 #define gbuf_rinc(m,len) {m->m_data += len; m->m_len -= len;}
190 #define gbuf_rdec(m,len) {m->m_data -= len; m->m_len += len;}
191 #define gbuf_wptr(m) (m->m_data + m->m_len)
192 #define gbuf_winc(m,len) (m->m_len += len)
193 #define gbuf_wdec(m,len) (m->m_len -= len)
194 #define gbuf_wset(m,len) (m->m_len = len)
195 #define gbuf_type(m) m->m_type
196 #define gbuf_len(m) m->m_len
198 #define gbuf_alloc(size, pri) (gbuf_alloc_wait(size, FALSE))
199 #define gbuf_copym(mlist) ((gbuf_t *)copy_pkt(mlist, -1))
201 #define gbuf_prepend(m,len) M_PREPEND(m,len,M_DONTWAIT)
202 #define gbuf_freem(mlist) m_freem((struct mbuf *)mlist)
203 #define gbuf_freeb(m) (void)m_free((struct mbuf *)m)
204 #define gbuf_set_type(m, mtype) MCHTYPE(m, mtype)
206 /* Duplicate a single mbuf, attaching existing external storage. */
207 #define gbuf_dupb_wait(m, wait) ((gbuf_t *)m_copym(m, 0, gbuf_len(m), (wait)? M_WAIT: M_DONTWAIT))
208 #define gbuf_dupb(m) (gbuf_dupb_wait(m, FALSE))
209 /* Duplicate an mbuf chain, attaching existing external storage. */
210 #define gbuf_dupm(mlist) ((gbuf_t *)copy_pkt(mlist, -1))
211 /* *** was ((gbuf_t *)m_copym(mlist, 0, M_COPYALL, M_DONTWAIT)) *** */
217 #endif /* KERNEL_PRIVATE */
219 #endif /* __APPLE_API_OBSOLETE */
220 #endif /* _NETAT_SYSGLUE_H_ */