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