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