|
|
1.1 root 1: /*
2: * localglue.h:
3: * Assorted local glue.
4: */
5:
6: #ifndef LOCALGLUE_H
7: #define LOCALGLUE_H
8:
9: #include <sys/errno.h>
10: #include <sys/types.h>
11: #include <sys/param.h>
12:
13:
14: #define AT_ATP_LINK 111
15: #define AT_ATP_UNLINK 222
16: #define AT_ADSP_LINK 333
17: #define AT_ADSP_UNLINK 444
18:
19: typedef struct {
20: int maxlen; /* max buffer length */
21: int len; /* length of data */
22: char *buf; /* pointer to buffer */
23: } strbuf_t;
24: typedef struct {
25: int ic_cmd;
26: int ic_timout;
27: int ic_len;
28: char *ic_dp;
29: } ioccmd_t;
30: typedef struct {
31: int ioc_cmd;
32: void *ioc_cr;
33: int ioc_id;
34: int ioc_cnt;
35: int ioc_error;
36: int ioc_rval;
37: void *ioc_private;
38: int ioc_filler[4];
39: } ioc_t;
40: #ifndef ioc_count
41: #define ioc_count ioc_cnt
42: #endif
43: #ifndef MOREDATA
44: #define MOREDATA 1
45: #endif
46:
47: #ifdef _KERNEL
48: #include <sys/systm.h>
49: /* ### LD 4/28/97 tempo removed */
50: #ifdef _AIX
51: #include <sys/pri.h>
52: #include <sys/intr.h>
53: #include <sys/lockl.h>
54: #include <net/spl.h>
55: #else
56: #include <sys/kernel.h>
57: #include <sys/proc.h>
58: #include <sys/filedesc.h>
59: #include <sys/fcntl.h>
60: #endif
61: #include <sys/mbuf.h>
62:
63: /*
64: * Rhapsody: we can't include stdlib.h (which contains atoi) in the
65: * kernel because it conflics with libkern.h for "random"
66: * so we use the inline definition of atoi here...
67: *
68: */
69: #ifndef _AIX
70: #define atoi(x) (int)((x)-'0')
71: #endif
72:
73: #define AT_WR_OFFSET 38
74: #ifndef EVENT_NULL
75: #define EVENT_NULL -1
76: #define LOCK_HANDLER 2
77: #endif
78: typedef int atevent_t;
79: /* ### LD 4/28/97 tempo removed */
80: #ifdef _AIX
81: typedef Simple_lock atlock_t;
82: #define ATLOCKINIT(a) simple_lock_init((void *)&a)
83: #define ATDISABLE(l, a) (l = disable_lock(PL_IMP, (void *)&a))
84: #define ATENABLE(l, a) unlock_enable(l, (void *)&a)
85: #define ATEVENTINIT(a) (a = EVENT_NULL)
86: #define DDP_OUTPUT(m) ddp_putmsg(0,m)
87: #define StaticProc static
88: #else
89: /* ### LD 4/28/97 tempo for next */
90: typedef simple_lock_t atlock_t;
91: typedef int *atomic_p;
92: #define ATLOCKINIT(a) (a = EVENT_NULL)
93: #define ATDISABLE(l, a) (l = splnet())
94: #define ATENABLE(l, a) splx(l)
95: #define ATEVENTINIT(a) (a = EVENT_NULL)
96: #define DDP_OUTPUT(m) ddp_putmsg(0,m)
97: #define StaticProc static
98:
99: #endif
100: #ifdef NEXT
101: /*
102: * Rhapsody specific defines: Right now they're triggered
103: * by the NEXT define. Might want to change that latter
104: * ld 04/28/97
105: */
106:
107: #define RHAPSODY 1
108: /* HZ ticks definition used throughout AppleTalk */
109: #define HZ hz
110:
111: /* returned when the operation is not possible at this
112: * time (ie when starting up or shutting down.
113: * right now, uses ESHUTDOWN because ENOTREADY is not defined
114: * in Rhapsody. Need to find a better Error code ###LD
115: */
116: #define ENOTREADY ESHUTDOWN
117: #define ENOMSG EOPNOTSUPP
118: #define EPROTO EPROTOTYPE
119: #define ENOSR ENOBUFS
120:
121: /* T_MPSAFE is used only in atp_open. I suspect it's a
122: * trick to accelerate local atp transactions.
123: */
124: #define T_MPSAFE 0
125:
126: #define INTERRUPTIBLE 1
127: #define POLLIN 0x0001
128: #define POLLOUT 0x0002
129: #define POLLPRI 0x0004
130: #define POLLMSG 0x0080
131: #define POLLSYNC 0x8000
132: #define POLLMSG 0x0080
133:
134: /*
135: * Define a new Data Type for file. it was DTYPE_OTHER for
136: * AIX, for Rhapsody there is no such define so defines
137: * DTYPE_ATALK
138: */
139:
140: #define DTYPE_ATALK -1
141:
142: typedef unsigned char uchar;
143:
144: #endif
145:
146: #define MSG_DATA 0x00
147: #define MSG_PROTO 0x01
148: #define MSG_IOCTL 0x0e
149: #define MSG_ERROR 0x8a
150: #define MSG_HANGUP 0x89
151: #define MSG_IOCACK 0x81
152: #define MSG_IOCNAK 0x82
153: #define MSG_CTL 0x0d
154: #define PRI_LO 1
155: #define PRI_MED 2
156: #define PRI_HI 3
157:
158: typedef struct mbuf gbuf_t;
159: extern gbuf_t *gbuf_copym();
160: extern gbuf_t *gbuf_dupb();
161: extern gbuf_t *gbuf_dupm();
162: extern void gbuf_freeb();
163: extern void gbuf_freem();
164: extern gbuf_t *gbuf_alloc();
165: #define gbuf_prepend(m,len) M_PREPEND(m,len,M_DONTWAIT)
166: #define gbuf_attach(buf,func,len,arg) m_clattach(buf,func,len,arg,M_DONTWAIT)
167: #define gbuf_cont(m) m->m_next
168: #define gbuf_next(m) m->m_nextpkt
169: #define gbuf_rptr(m) m->m_data
170: #define gbuf_rinc(m,len) {m->m_data += len; m->m_len -= len;}
171: #define gbuf_rdec(m,len) {m->m_data -= len; m->m_len += len;}
172: #define gbuf_wptr(m) (m->m_data + m->m_len)
173: #define gbuf_winc(m,len) (m->m_len += len)
174: #define gbuf_wdec(m,len) (m->m_len -= len)
175: #define gbuf_wset(m,len) (m->m_len = len)
176: #define gbuf_type(m) m->m_type
177: #define gbuf_len(m) m->m_len
178:
179: typedef struct gref {
180: struct gref *next;
181: void *info;
182: gbuf_t *ichead;
183: gbuf_t *ictail;
184: gbuf_t *rdhead;
185: gbuf_t *rdtail;
186: unsigned char proto;
187: unsigned char errno;
188: unsigned short sevents;
189: int pid;
190: atlock_t lock;
191: atevent_t event;
192: atevent_t iocevent;
193: int (*writeable)();
194: int (*readable)();
195: /* for BSD 4.4 we need a selinfo structure for selrecord/selwakeup */
196: #ifndef _AIX
197: struct selinfo si;
198: #endif
199: } gref_t;
200:
201: #undef timeoutcf
202: #undef timeout
203: #undef untimeout
204: #define MAXATALKTIMERS 128
205:
206: #else /* _KERNEL */
207:
208: /* Various device info */
209: #define AT_DEF_ET_INTERFACE "et0"
210: #define NVRAM "/etc/appletalk.nvram"
211: #define NVRAMSIZE 256
212:
213: #endif /* _KERNEL */
214:
215: #endif /* LOCALGLUE_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.