]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
d7e50217 | 6 | * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. |
1c79356b | 7 | * |
d7e50217 A |
8 | * This file contains Original Code and/or Modifications of Original Code |
9 | * as defined in and that are subject to the Apple Public Source License | |
10 | * Version 2.0 (the 'License'). You may not use this file except in | |
11 | * compliance with the License. Please obtain a copy of the License at | |
12 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
13 | * file. | |
14 | * | |
15 | * The Original Code and all software distributed under the License are | |
16 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
1c79356b A |
17 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
18 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
d7e50217 A |
19 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
20 | * Please see the License for the specific language governing rights and | |
21 | * limitations under the License. | |
1c79356b A |
22 | * |
23 | * @APPLE_LICENSE_HEADER_END@ | |
24 | */ | |
25 | /* | |
26 | * Title: sysglue.h - AppleTalk protocol to Unix System V/streams interface | |
27 | * | |
28 | * Facility: AppleTalk Protocol Execution Environment | |
29 | * | |
30 | * Author: Gregory Burns, Creation Date: Jun-3-1988 | |
31 | * | |
32 | * History: | |
33 | * X01-001 Gregory Burns 3-Jun-1988 | |
34 | * Initial Creation. | |
35 | * | |
36 | */ | |
37 | ||
38 | #ifndef _NETAT_SYSGLUE_H_ | |
39 | #define _NETAT_SYSGLUE_H_ | |
9bccf70c | 40 | #include <sys/appleapiopts.h> |
1c79356b A |
41 | |
42 | /* | |
43 | The following is originally from netat/h/localglue.h, which was | |
44 | included in netat/h/sysglue.h: | |
45 | */ | |
46 | ||
47 | typedef struct { | |
48 | int ic_cmd; | |
49 | int ic_timout; | |
50 | int ic_len; | |
51 | char *ic_dp; | |
52 | } ioccmd_t; | |
53 | ||
54 | typedef struct { | |
55 | int ioc_cmd; | |
56 | void *ioc_cr; | |
57 | int ioc_id; | |
58 | int ioc_count; | |
59 | int ioc_error; | |
60 | int ioc_rval; | |
61 | void *ioc_private; | |
62 | int ioc_filler[4]; | |
63 | } ioc_t; | |
64 | ||
65 | /* | |
66 | * Want these definitions outside the KERNEL define for admin | |
67 | * program access. | |
68 | */ | |
69 | #ifdef _AIX | |
70 | #define MSG_DATA 0x00 | |
71 | #define MSG_PROTO 0x01 | |
72 | #define MSG_IOCTL 0x0e | |
73 | #define MSG_ERROR 0x8a | |
74 | #define MSG_HANGUP 0x89 | |
75 | #define MSG_IOCACK 0x81 | |
76 | #define MSG_IOCNAK 0x82 | |
77 | #define MSG_CTL 0x0d | |
78 | #else | |
79 | /* ### LD 5/3/97 MacOSX porting note: | |
80 | * Cannot use MSG_DATA = 0, because MT_FREE is defined as 0 | |
81 | * and the sanity check in m_free cause a panic. | |
82 | */ | |
83 | ||
84 | #define MSG_DATA (MT_MAX - 1) | |
85 | #define MSG_PROTO (MT_MAX - 2) | |
86 | #define MSG_IOCTL (MT_MAX - 3) | |
87 | #define MSG_ERROR (MT_MAX - 4) | |
88 | #define MSG_HANGUP (MT_MAX - 5) | |
89 | #define MSG_IOCACK (MT_MAX - 6) | |
90 | #define MSG_IOCNAK (MT_MAX - 7) | |
91 | #define MSG_CTL (MT_MAX - 8) | |
92 | #endif | |
93 | ||
94 | #ifdef KERNEL | |
9bccf70c | 95 | #ifdef __APPLE_API_PRIVATE |
1c79356b A |
96 | |
97 | #define SYS_HZ HZ /* Number of clock (SYS_SETTIMER) ticks per second */ | |
98 | #define HZ hz /* HZ ticks definition used throughout AppleTalk */ | |
99 | ||
100 | /* returned when the operation is not possible at this | |
101 | * time (ie when starting up or shutting down. | |
102 | * right now, uses ESHUTDOWN because ENOTREADY is not defined | |
103 | * in MacOSX. Need to find a better Error code ###LD | |
104 | */ | |
105 | #define ENOTREADY ESHUTDOWN | |
106 | #define ENOMSG EOPNOTSUPP | |
107 | #define EPROTO EPROTOTYPE | |
108 | ||
109 | /* T_MPSAFE is used only in atp_open. I suspect it's a | |
110 | * trick to accelerate local atp transactions. | |
111 | */ | |
112 | #define T_MPSAFE 0 | |
113 | ||
114 | #define INTERRUPTIBLE 1 | |
115 | #define POLLIN 0x0001 | |
116 | #define POLLOUT 0x0002 | |
117 | #define POLLPRI 0x0004 | |
118 | #define POLLMSG 0x0080 | |
119 | #define POLLSYNC 0x8000 | |
120 | #define POLLMSG 0x0080 | |
121 | ||
122 | /* | |
123 | * Define a new Data Type for file. it was DTYPE_OTHER for | |
124 | * AIX, for MacOSX there is no such define so defines | |
125 | * DTYPE_ATALK | |
126 | */ | |
127 | ||
128 | #define DTYPE_ATALK -1 | |
129 | ||
130 | #define AT_WR_OFFSET 38 | |
131 | #ifndef EVENT_NULL | |
132 | #define EVENT_NULL -1 | |
133 | #define LOCK_HANDLER 2 | |
134 | #endif | |
135 | typedef int atevent_t; | |
136 | ||
137 | typedef simple_lock_t atlock_t; | |
138 | typedef int *atomic_p; | |
139 | #define ATLOCKINIT(a) (a = (atlock_t) EVENT_NULL) | |
140 | #define ATDISABLE(l, a) (l = splimp()) | |
141 | #define ATENABLE(l, a) splx(l) | |
142 | #define ATEVENTINIT(a) (a = (atevent_t) EVENT_NULL) | |
143 | #define DDP_OUTPUT(m) ddp_putmsg(0,m) | |
144 | #define StaticProc static | |
145 | ||
146 | #define PRI_LO 1 | |
147 | #define PRI_MED 2 | |
148 | #define PRI_HI 3 | |
149 | ||
150 | typedef struct mbuf gbuf_t; | |
151 | ||
152 | /* prototypes for the gbuf routines */ | |
153 | ||
154 | struct mbuf *m_lgbuf_alloc(int size, int wait); | |
155 | gbuf_t *gbuf_alloc_wait(int size, int wait); | |
156 | gbuf_t *gbuf_copym(gbuf_t *mlist); | |
157 | gbuf_t *gbuf_strip(gbuf_t *m); | |
158 | int gbuf_freel(gbuf_t *m); | |
159 | void gbuf_linkb(gbuf_t *m1, gbuf_t *m2); | |
160 | void gbuf_linkpkt(gbuf_t *m1, gbuf_t *m2); | |
161 | int gbuf_msgsize(gbuf_t *m); | |
162 | ||
163 | #define gbuf_cont(m) m->m_next | |
164 | #define gbuf_next(m) m->m_nextpkt | |
165 | #define gbuf_rptr(m) m->m_data | |
166 | #define gbuf_rinc(m,len) {m->m_data += len; m->m_len -= len;} | |
167 | #define gbuf_rdec(m,len) {m->m_data -= len; m->m_len += len;} | |
168 | #define gbuf_wptr(m) (m->m_data + m->m_len) | |
169 | #define gbuf_winc(m,len) (m->m_len += len) | |
170 | #define gbuf_wdec(m,len) (m->m_len -= len) | |
171 | #define gbuf_wset(m,len) (m->m_len = len) | |
172 | #define gbuf_type(m) m->m_type | |
173 | #define gbuf_len(m) m->m_len | |
174 | ||
175 | #define gbuf_alloc(size, pri) (gbuf_alloc_wait(size, FALSE)) | |
176 | #define gbuf_copym(mlist) ((gbuf_t *)copy_pkt(mlist, -1)) | |
177 | ||
178 | #define gbuf_prepend(m,len) M_PREPEND(m,len,M_DONTWAIT) | |
179 | #define gbuf_freem(mlist) m_freem((struct mbuf *)mlist) | |
180 | #define gbuf_freeb(m) (void)m_free((struct mbuf *)m) | |
181 | #define gbuf_set_type(m, mtype) MCHTYPE(m, mtype) | |
182 | ||
183 | /* Duplicate a single mbuf, attaching existing external storage. */ | |
184 | #define gbuf_dupb_wait(m, wait) ((gbuf_t *)m_copym(m, 0, gbuf_len(m), (wait)? M_WAIT: M_DONTWAIT)) | |
185 | #define gbuf_dupb(m) (gbuf_dupb_wait(m, FALSE)) | |
186 | /* Duplicate an mbuf chain, attaching existing external storage. */ | |
187 | #define gbuf_dupm(mlist) ((gbuf_t *)copy_pkt(mlist, -1)) | |
188 | /* *** was ((gbuf_t *)m_copym(mlist, 0, M_COPYALL, M_DONTWAIT)) *** */ | |
189 | ||
190 | #undef timeoutcf | |
191 | #undef timeout | |
192 | #undef untimeout | |
193 | ||
9bccf70c | 194 | #endif /* __APPLE_API_PRIVATE */ |
1c79356b A |
195 | #endif /* KERNEL */ |
196 | #endif /* _NETAT_SYSGLUE_H_ */ |