]> git.saurik.com Git - apple/xnu.git/blob - bsd/netat/adsp.h
adf805e58fb6bd30e535e4b2d907a7b1c1a20162
[apple/xnu.git] / bsd / netat / adsp.h
1 /*
2 * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
5 *
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
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
14 * agreement.
15 *
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
18 * file.
19 *
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
27 *
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
29 */
30 /*
31 *
32 * ORIGINS: 82
33 *
34 * (C) COPYRIGHT Apple Computer, Inc. 1992-1996
35 * All Rights Reserved
36 *
37 */
38
39 #ifndef _NETAT_ADSP_H_
40 #define _NETAT_ADSP_H_
41 #include <sys/appleapiopts.h>
42 #include <netat/appletalk.h>
43
44 #ifdef __APPLE_API_OBSOLETE
45
46 /* ADSP flags for read, write, and close routines */
47
48 #define ADSP_EOM 0x01 /* Sent or received EOM with data */
49 #define ADSP_FLUSH 0x02 /* Send all data in send queue */
50 #define ADSP_WAIT 0x04 /* Graceful close, wait 'til snd queue emptys */
51
52
53 /* ADSP events to be fielded by the user event handler */
54
55 #define ADSP_EV_ATTN 0x02 /* Attention data recvd. */
56 #define ADSP_EV_RESET 0x04 /* Forward reset recvd. */
57 #define ADSP_EV_CLOSE 0x08 /* Close advice recvd. */
58
59
60 /* ADSP packet control codes */
61
62 #define ADSP_PROBEACK 0 /* Probe or acknowledgement */
63 #define ADSP_OPENCONREQUEST 1 /* Open connection request */
64 #define ADSP_OPENCONACK 2 /* Open connection acknowledgement */
65 #define ADSP_OPENCONREQACK 3 /* Open connection request + ack */
66 #define ADSP_OPENCONDENIAL 4 /* Open connection denial */
67 #define ADSP_CLOSEADVICE 5 /* Close connection advice */
68 #define ADSP_FORWARDRESET 6 /* Forward reset */
69 #define ADSP_FORWARDRESETACK 7 /* Forward reset acknowledgement */
70 #define ADSP_RETRANSADVICE 8 /* Retransmit advice */
71
72
73 /* Miscellaneous constants */
74
75 #define ADSP_MAXDATA 572 /* Maximum data bytes in ADSP packet */
76 #define ADSP_MAXATTNDATA 570 /* Maximum data bytes in attn msg */
77 #define ADSP_DDPTYPE 7 /* DDP protocol type for ADSP */
78 #define ADSP_VERSION 0x0100 /* ADSP version */
79
80
81 /* Some additional ADSP error codes */
82
83 #define EQUEWASEMP 10001
84 #define EONEENTQUE 10002
85 #define EQUEBLOCKED 10003
86 #define EFWDRESET 10004
87 #define EENDOFMSG 10005
88 #define EADDRNOTINUSE 10006
89
90
91
92 /* Tuning Parameter Block */
93
94 struct tpb {
95 unsigned Valid : 1; /* Tuning parameter block is valid */
96 unsigned short TransThresh; /* Transmit threshold */
97 unsigned TransTimerIntrvl; /* Transmit timer interval */
98 unsigned short SndWdwCloThresh; /* Send window closing threshold */
99 unsigned SndWdwCloIntrvl; /* Send window closed interval */
100 unsigned char SndWdwCloBckoff; /* Send window closed backoff rate */
101 unsigned ReTransIntrvl; /* Retransmit interval */
102 unsigned char ReTransBckoff; /* Retransmit backoff rate */
103 unsigned RestartIntrvl; /* Restart sender interval */
104 unsigned char RestartBckoff; /* Restart sender backoff rate */
105 unsigned SndQBufSize; /* Send queue buffer size */
106 unsigned short RcvQMaxSize; /* Maximum size of the receive queue */
107 unsigned short RcvQCpyThresh; /* Receive queue copy threshold */
108 unsigned FwdRstIntrvl; /* Forward reset interval */
109 unsigned char FwdRstBckoff; /* Forward reset backoff rate */
110 unsigned AttnIntrvl; /* Retransmit attn msg interval */
111 unsigned char AttnBckoff; /* Retransmit attn msg backoff rate */
112 unsigned OpenIntrvl; /* Retransmit open request interval */
113 unsigned char OpenMaxRetry; /* Open request maximum retrys */
114 unsigned char RetransThresh; /* Retransmit advice threshold */
115 unsigned ProbeRetryMax; /* Maximum number of probes */
116 unsigned SndByteCntMax; /* Maximum number bytes in send queue */
117 };
118
119
120 /* Tuning Parameter Tags */
121
122 #define ADSP_TRANSTHRESH 1 /* Transmit threshold */
123 #define ADSP_TRANSTIMERINTRVL 2 /* Transmit timer interval */
124 #define ADSP_SNDWDWCLOTHRESH 3 /* Send window closing threshold */
125 #define ADSP_SNDWDWCLOINTRVL 4 /* Send window closed interval */
126 #define ADSP_SNDWDWCLOBCKOFF 5 /* Send window closed backoff rate */
127 #define ADSP_RETRANSINTRVL 6 /* Retransmit interval */
128 #define ADSP_RETRANSBCKOFF 7 /* Retransmit backoff rate */
129 #define ADSP_RESTARTINTRVL 8 /* Restart sender interval */
130 #define ADSP_RESTARTBCKOFF 9 /* Restart sender backoff rate */
131 #define ADSP_SNDQBUFSIZE 10 /* Send queue buffer size */
132 #define ADSP_RCVQMAXSIZE 11 /* Receive queue maximum size */
133 #define ADSP_RCVQCPYTHRESH 12 /* Receive queue copy threshold */
134 #define ADSP_FWDRSTINTRVL 13 /* Forward reset retransmit interval */
135 #define ADSP_FWDRSTBCKOFF 14 /* Forward reset backoff rate */
136 #define ADSP_ATTNINTRVL 15 /* Rexmit attention message interval */
137 #define ADSP_ATTNBCKOFF 16 /* Attention message backoff rate */
138 #define ADSP_OPENINTRVL 17 /* Retransmit open request interval */
139 #define ADSP_OPENMAXRETRY 18 /* Open request max retrys */
140 #define ADSP_RETRANSTHRESH 19 /* Retransmit advice threshold */
141 #define ADSP_PROBERETRYMAX 20
142 #define ADSP_SNDBYTECNTMAX 21
143
144 #define TuneParamCnt 21 /* The number of tuning parameters */
145
146 /* Connection Status Tags */
147
148 #define ADSP_STATE 1 /* The connection state */
149 #define ADSP_SNDSEQ 2 /* Send sequence number */
150 #define ADSP_FIRSTRTMTSEQ 3 /* First retransmit sequence number */
151 #define ADSP_SNDWDWSEQ 4 /* Send window sequence number */
152 #define ADSP_RCVSEQ 5 /* Receive sequence number */
153 #define ADSP_ATTNSNDSEQ 6 /* Attn msg send sequence number */
154 #define ADSP_ATTNRCVSEQ 7 /* Attn msg receive sequence number */
155 #define ADSP_RCVWDW 8 /* Receive window size */
156 #define ADSP_ATTNMSGWAIT 9 /* Attn msg is in the receive queue */
157
158 #define ConStatTagCnt 9 /* Number of connection status tags */
159
160 #define ADSP_INVALID 0 /* Invalid connection control block */
161 #define ADSP_LISTEN 1 /* Waiting for an open con req */
162 #define ADSP_OPENING 2 /* No state info, sending open req */
163 #define ADSP_MYHALFOPEN 4 /* His state info, sending open req */
164 #define ADSP_HISHALFOPEN 8 /* He has my state info, sndng op req */
165 #define ADSP_OPEN 16 /* Connection is operational */
166 #define ADSP_TORNDOWN 32 /* Probe timer has expired 4 times */
167 #define ADSP_CLOSING 64 /* Client close, emptying send Queues */
168 #define ADSP_CLOSED 128 /* Close adv rcvd, emptying rcv Queues */
169
170 /* Management Counters */
171
172 #define ADSP_ATTNACKRCVD 1 /* Attn msg ack received */
173 #define ADSP_ATTNACKACPTD 2 /* Attn msg ack accepted */
174 #define ADSP_PROBERCVD 3 /* Probe received */
175 #define ADSP_ACKRCVD 4 /* Explicit ack msg received */
176 #define ADSP_FWDRSTRCVD 5 /* Forward reset received */
177 #define ADSP_FWDRSTACPTD 6 /* Forward reset accepted */
178 #define ADSP_FWDRSTACKRCVD 7 /* Forward reset ack received */
179 #define ADSP_FWDRSTACKACPTD 8 /* Forward reset ack accepted */
180 #define ADSP_ATTNRCVD 9 /* Attn msg received */
181 #define ADSP_ATTNACPTD 10 /* Attn msg accepted */
182 #define ADSP_DATARCVD 11 /* Data msg received */
183 #define ADSP_DATAACPTD 12 /* Data msg Accepted */
184 #define ADSP_ACKFIELDCHKD 13 /* Ack field checked */
185 #define ADSP_ACKNRSFIELDACPTD 14 /* Next receive seq field accepted */
186 #define ADSP_ACKSWSFIELDACPTD 15 /* Send window seq field accepted */
187 #define ADSP_ACKREQSTD 16 /* Ack requested */
188 #define ADSP_LOWMEM 17 /* Low memory */
189 #define ADSP_OPNREQEXP 18 /* Open request timer expired */
190 #define ADSP_PROBEEXP 19 /* Probe timer expired */
191 #define ADSP_FWDRSTEXP 20 /* Forward reset timer expired */
192 #define ADSP_ATTNEXP 21 /* Attention timer expired */
193 #define ADSP_TRANSEXP 22 /* Transmit timer expired */
194 #define ADSP_RETRANSEXP 23 /* Retransmit timer expired */
195 #define ADSP_SNDWDWCLOEXP 24 /* Send window closed timer expired */
196 #define ADSP_RESTARTEXP 25 /* Restart sender timer expired */
197 #define ADSP_RESLOWEXP 26 /* Resources are low timer expired */
198 #define ADSP_RETRANSRCVD 27 /* Retransmit advice received */
199
200 #define InfoTagCnt 27
201
202 /* Length of the parameter and status lists */
203
204 #define ADSP_DEFLEN (TuneParamCnt * 6 + 1)
205 #define ADSP_STALEN (ConStatTagCnt * 6 + 1)
206 #define ADSP_INFOLEN (InfoTagCnt * 6 + 1)
207
208 /* from h/ADSP.h */
209
210 /* result codes */
211
212 #define controlErr -17 /*I/O System Errors*/
213
214 #define errENOBUFS -1281
215 #define errRefNum -1280 /* bad connection refNum */
216 #define errAborted -1279 /* control call was aborted */
217 #define errState -1278 /* bad connection state for this operation */
218 #define errOpening -1277 /* open connection request failed */
219 #define errAttention -1276 /* attention message too long */
220 #define errFwdReset -1275 /* read terminated by forward reset */
221 #define errDSPQueueSize -1274 /* DSP Read/Write Queue Too small */
222 #define errOpenDenied -1273 /* open connection request was denied */
223
224 /* control codes */
225
226 #define dspInit 255 /* create a new connection end */
227 #define dspRemove 254 /* remove a connection end */
228 #define dspOpen 253 /* open a connection */
229 #define dspClose 252 /* close a connection */
230 #define dspCLInit 251 /* create a connection listener */
231 #define dspCLRemove 250 /* remove a connection listener */
232 #define dspCLListen 249 /* post a listener request */
233 #define dspCLDeny 248 /* deny an open connection request */
234 #define dspStatus 247 /* get status of connection end */
235 #define dspRead 246 /* read data from the connection */
236 #define dspWrite 245 /* write data on the connection */
237 #define dspAttention 244 /* send an attention message */
238 #define dspOptions 243 /* set connection end options */
239 #define dspReset 242 /* forward reset the connection */
240 #define dspNewCID 241 /* generate a cid for a connection end */
241
242
243 /* connection opening modes */
244
245 #define ocRequest 1 /* request a connection with remote */
246 #define ocPassive 2 /* wait for a connection request from remote */
247 #define ocAccept 3 /* accept request as delivered by listener */
248 #define ocEstablish 4 /* consider connection to be open */
249
250
251 /* connection end states */
252
253 #define sListening 1 /* for connection listeners */
254 #define sPassive 2 /* waiting for a connection request from remote */
255 #define sOpening 3 /* requesting a connection with remote */
256 #define sOpen 4 /* connection is open */
257 #define sClosing 5 /* connection is being torn down */
258 #define sClosed 6 /* connection end state is closed */
259
260
261
262 /* client event flags */
263
264 #define eClosed 0x80 /* received connection closed advice */
265 #define eTearDown 0x40 /* connection closed due to broken connection */
266 #define eAttention 0x20 /* received attention message */
267 #define eFwdReset 0x10 /* received forward reset advice */
268
269 /* miscellaneous constants */
270
271 #define attnBufSize 570 /* size of client attention buffer */
272 #define minDSPQueueSize 100 /* Minimum size of receive or send Queue */
273 #define defaultDSPQS 16384 /* random guess */
274 #define RecvQSize defaultDSPQS
275 #define SendQSize defaultDSPQS
276
277 /* *** Seems to be a problem in Mac OS X too *** */
278 /* Solaris defines u as (curproc->p_user)
279 #if defined(u)
280 #undef u
281 #endif
282 */
283
284 typedef long (*ProcPtr)(); /* XXX */
285 typedef ProcPtr *ProcHandle;
286 typedef char *Ptr;
287 typedef Ptr *Handle;
288
289 /* connection control block */
290
291 struct TRCCB {
292 u_char *ccbLink; /* link to next ccb */
293 u_short refNum; /* user reference number */
294 u_short state; /* state of the connection end */
295 u_char userFlags; /* flags for unsolicited connection events */
296 u_char localSocket; /* socket number of this connection end */
297 at_inet_t remoteAddress; /* internet address of remote end */
298 u_short attnCode; /* attention code received */
299 u_short attnSize; /* size of received attention data */
300 u_char *attnPtr; /* ptr to received attention data */
301 u_char reserved[220]; /* for adsp internal use */
302 };
303
304 typedef struct TRCCB TRCCB;
305 typedef TRCCB *TPCCB;
306
307 /* init connection end parameters */
308
309 struct TRinitParams {
310 TPCCB ccbPtr; /* pointer to connection control block */
311 ProcPtr userRoutine; /* client routine to call on event */
312 u_char *sendQueue; /* client passed send queue buffer */
313 u_char *recvQueue; /* client passed receive queue buffer */
314 u_char *attnPtr; /* client passed receive attention buffer */
315 u_short sendQSize; /* size of send queue (0..64K bytes) */
316 u_short recvQSize; /* size of receive queue (0..64K bytes) */
317 u_char localSocket; /* local socket number */
318 };
319
320 typedef struct TRinitParams TRinitParams;
321
322 /* open connection parameters */
323
324 struct TRopenParams {
325 u_short localCID; /* local connection id */
326 u_short remoteCID; /* remote connection id */
327 at_inet_t remoteAddress; /* address of remote end */
328 at_inet_t filterAddress; /* address filter */
329 unsigned long sendSeq; /* local send sequence number */
330 u_long recvSeq; /* receive sequence number */
331 u_long attnSendSeq; /* attention send sequence number */
332 u_long attnRecvSeq; /* attention receive sequence number */
333 u_short sendWindow; /* send window size */
334 u_char ocMode; /* open connection mode */
335 u_char ocInterval; /* open connection request retry interval */
336 u_char ocMaximum; /* open connection request retry maximum */
337 };
338
339 typedef struct TRopenParams TRopenParams;
340
341 /* close connection parameters */
342
343 struct TRcloseParams {
344 u_char abort; /* abort connection immediately if non-zero */
345 };
346
347 typedef struct TRcloseParams TRcloseParams;
348
349 /* client status parameter block */
350
351 struct TRstatusParams {
352 TPCCB ccbPtr; /* pointer to ccb */
353 u_short sendQPending; /* pending bytes in send queue */
354 u_short sendQFree; /* available buffer space in send queue */
355 u_short recvQPending; /* pending bytes in receive queue */
356 u_short recvQFree; /* available buffer space in receive queue */
357 };
358
359 typedef struct TRstatusParams TRstatusParams;
360
361 /* read/write parameter block */
362
363 struct TRioParams {
364 u_short reqCount; /* requested number of bytes */
365 u_short actCount; /* actual number of bytes */
366 u_char *dataPtr; /* pointer to data buffer */
367 u_char eom; /* indicates logical end of message */
368 u_char flush; /* send data now */
369 u_char dummy[2]; /*### LD */
370 };
371
372 typedef struct TRioParams TRioParams;
373
374 /* attention parameter block */
375
376 struct TRattnParams {
377 u_short attnCode; /* client attention code */
378 u_short attnSize; /* size of attention data */
379 u_char *attnData; /* pointer to attention data */
380 u_char attnInterval; /* retransmit timer in 10-tick intervals */
381 u_char dummy[3]; /* ### LD */
382 };
383
384 typedef struct TRattnParams TRattnParams;
385
386 /* client send option parameter block */
387
388 struct TRoptionParams {
389 u_short sendBlocking; /* quantum for data packets */
390 u_char sendTimer; /* send timer in 10-tick intervals */
391 u_char rtmtTimer; /* retransmit timer in 10-tick intervals */
392 u_char badSeqMax; /* threshold for sending retransmit advice */
393 u_char useCheckSum; /* use ddp packet checksum */
394 u_short filler; /* ### LD */
395 int newPID; /* ### Temp for backward compatibility 02/11/94 */
396 };
397
398 typedef struct TRoptionParams TRoptionParams;
399
400 /* new cid parameters */
401
402 struct TRnewcidParams {
403 u_short newcid; /* new connection id returned */
404 };
405
406 typedef struct TRnewcidParams TRnewcidParams;
407
408 union adsp_command {
409 TRinitParams initParams; /* dspInit, dspCLInit */
410 TRopenParams openParams; /* dspOpen, dspCLListen, dspCLDeny */
411 TRcloseParams closeParams; /* dspClose, dspRemove */
412 TRioParams ioParams; /* dspRead, dspWrite, dspAttnRead */
413 TRattnParams attnParams; /* dspAttention */
414 TRstatusParams statusParams; /* dspStatus */
415 TRoptionParams optionParams; /* dspOptions */
416 TRnewcidParams newCIDParams; /* dspNewCID */
417 };
418
419 /* ADSP CntrlParam ioQElement */
420
421 struct DSPParamBlock {
422 struct QElem *qLink;
423 short qType;
424 short ioTrap;
425 Ptr ioCmdAddr;
426 ProcPtr ioCompletion;
427 short ioResult;
428 char *ioNamePtr;
429 short ioVRefNum;
430 short ioCRefNum; /* adsp driver refNum */
431 short csCode; /* adsp driver control code */
432 long qStatus; /* adsp internal use */
433 u_short ccbRefNum; /* connection end refNum */
434 union adsp_command u;
435 };
436
437 typedef struct DSPParamBlock DSPParamBlock;
438 typedef DSPParamBlock *DSPPBPtr;
439
440 struct adspcmd {
441 struct adspcmd *qLink;
442 u_int ccbRefNum;
443 caddr_t ioc;
444 #ifdef KERNEL
445 gref_t *gref;
446 gbuf_t *mp;
447 #else
448 void *gref;
449 void *mp;
450 #endif
451 short ioResult;
452 u_short ioDirection;
453 short csCode;
454 u_short socket;
455 union adsp_command u;
456 };
457
458 /* from h/adsp_frames.h */
459
460 #ifdef NOT_USED
461 /*
462 * LAP Frame Information
463 */
464
465 typedef struct {
466 u_char lap_dest;
467 u_char lap_src;
468 u_char lap_type;
469 u_char lap_data[1];
470 } LAP_FRAME;
471
472 #define LAP_FRAME_LEN 3
473
474 #define MAX_FRAME_SIZE 603
475
476 #define LAP_DDP 0x01
477 #define LAP_DDPX 0x02
478
479 typedef struct {
480 ua_short ddp_length; /* length of ddp fields */
481 u_char ddp_dest; /* destination socket */
482 u_char ddp_source; /* source socket */
483 u_char ddp_type; /* protocol type */
484 u_char ddp_data[1]; /* data field */
485 } DDP_FRAME;
486
487 #define DDPS_FRAME_LEN 5
488 #endif /* NOT_USED */
489
490 typedef struct {
491 ua_short ddpx_length; /* length and hop count */
492 ua_short ddpx_cksm; /* checksum */
493 at_net ddpx_dnet; /* destination network number */
494 at_net ddpx_snet; /* source network number */
495 u_char ddpx_dnode; /* destination node */
496 u_char ddpx_snode; /* source node */
497 u_char ddpx_dest; /* destination socket */
498 u_char ddpx_source; /* source socket */
499 u_char ddpx_type; /* protocol type */
500 u_char ddpx_data[1]; /* data field */
501 } DDPX_FRAME;
502
503 #define DDPL_FRAME_LEN 13
504
505 #ifdef NOT_USED
506 typedef struct {
507 u_char nbp_ctrl_cnt; /* control and tuple count */
508 u_char nbp_id; /* enquiry/reply id */
509 u_char nbp_data[1]; /* tuple space */
510 } NBP_FRAME;
511
512 #define NBP_TYPE_MASK 0xf0 /* mask of ctrl_cnt field */
513 #define NBP_CNT_MASK 0x0f /* mask for number of tuples */
514 #define NBP_BROADCAST 0x10 /* internet lookup */
515 #define NBP_LOOKUP 0x20 /* lookup request */
516 #define NBP_REPLY 0x30 /* response to lookup */
517
518 typedef struct {
519 u_char atp_control; /* control field */
520 u_char atp_map; /* bitmap for acknowlegement */
521 ua_short atp_tid; /* transaction id */
522 union
523 {
524 u_char b[4]; /* user u_chars */
525 ua_long dw;
526 } atp_ub;
527 u_char atp_data[1]; /* data field */
528 } ATP_FRAME;
529
530 #define ATP_FRAME_LEN 8
531
532 #define ATP_TREQ 0x40 /* transaction request */
533 #define ATP_TRESP 0x80 /* response packet */
534 #define ATP_TREL 0xc0 /* transaction release packet */
535 #define ATP_XO 0x20 /* exactly once flag */
536 #define ATP_EOM 0x10 /* end of message flag */
537 #define ATP_STS 0x08 /* send transaction status */
538
539 #define ATP_TYPE(x) ((x)->atp_control & 0xc0)
540
541 typedef struct {
542 at_net net1;
543 u_char zonename[33];
544 } ZIP_1;
545
546 typedef struct {
547 at_net net1;
548 at_net net2;
549 u_char zonename[33];
550 } ZIP_2;
551
552 typedef struct {
553 u_char zip_command; /* zip command number */
554 u_char flags; /* Bit-mapped */
555 union
556 {
557 ZIP_1 o; /* Packet has one net number */
558 ZIP_2 r; /* Packet has cable range */
559 } u;
560 } ZIP_FRAME;
561
562 /* Flags in the ZIP GetNetInfo & NetInfoReply buffer */
563
564 #define ZIPF_BROADCAST 0x80
565 #define ZIPF_ZONE_INVALID 0x80
566 #define ZIPF_USE_BROADCAST 0x40
567 #define ZIPF_ONE_ZONE 0x20
568
569 #define ZIP_QUERY 1 /* ZIP Commands in zip frames */
570 #define ZIP_REPLY 2
571 #define ZIP_TAKEDOWN 3
572 #define ZIP_BRINGUP 4
573 #define ZIP_GETNETINFO 5
574 #define ZIP_NETINFOREPLY 6
575 #define ZIP_NOTIFY 7
576
577 #define ZIP_GETMYZONE 7 /* ZIP commands in atp user u_chars[0] */
578 #define ZIP_GETZONELIST 8
579 #define ZIP_GETLOCALZONES 9
580 #define ZIP_GETYOURZONE 10
581
582 /*
583 * Response to Reponder Request type #1.
584 *
585 * The first 4 u_chars are actually the 4 ATP user u_chars
586 * Following this structure are 4 PASCAL strings:
587 * System Version String. (max 127)
588 * Finder Version String. (max 127)
589 * LaserWriter Version String. (max 127)
590 * AppleShare Version String. (max 24)
591 */
592 typedef struct
593 {
594 u_char UserU_Chars[2];
595 ua_short ResponderVersion;
596 ua_short AtalkVersion;
597 u_char ROMVersion;
598 u_char SystemType;
599 u_char SystemClass;
600 u_char HdwrConfig;
601 ua_short ROM85Version;
602 u_char ResponderLevel;
603 u_char ResponderLink;
604 u_char data[1];
605 } RESPONDER_FRAME;
606 #endif /* NOT_USED */
607
608 /*
609 * ADSP Frame
610 */
611 typedef struct {
612 ua_short CID;
613 ua_long pktFirstByteSeq;
614 ua_long pktNextRecvSeq;
615 ua_short pktRecvWdw;
616 u_char descriptor; /* Bit-Mapped */
617 u_char data[1];
618 } ADSP_FRAME, *ADSP_FRAMEPtr;
619
620 #define ADSP_FRAME_LEN 13
621
622 #define ADSP_CONTROL_BIT 0x80
623 #define ADSP_ACK_REQ_BIT 0x40
624 #define ADSP_EOM_BIT 0x20
625 #define ADSP_ATTENTION_BIT 0x10
626 #define ADSP_CONTROL_MASK 0x0F
627
628 #define ADSP_CTL_PROBE 0x00 /* Probe or acknowledgement */
629 #define ADSP_CTL_OREQ 0x01 /* Open Connection Request */
630 #define ADSP_CTL_OACK 0x02 /* Open Request acknowledgment */
631 #define ADSP_CTL_OREQACK 0x03 /* Open Request and acknowledgement */
632 #define ADSP_CTL_ODENY 0x04 /* Open Request denial */
633 #define ADSP_CTL_CLOSE 0x05 /* Close connection advice */
634 #define ADSP_CTL_FRESET 0x06 /* Forward Reset */
635 #define ADSP_CTL_FRESET_ACK 0x07 /* Forward Reset Acknowledgement */
636 #define ADSP_CTL_RETRANSMIT 0x08 /* Retransmit advice */
637
638 typedef struct {
639 ua_short version; /* Must be in network byte order */
640 ua_short dstCID; /* */
641 ua_long pktAttnRecvSeq; /* Must be in network byte order */
642 } ADSP_OPEN_DATA, *ADSP_OPEN_DATAPtr;
643
644 #define ADSP_OPEN_FRAME_LEN 8
645
646 #define ADSP_MAX_DATA_LEN 572
647
648 /* from h/adsp_ioctl.h */
649
650 /*
651 * Defines that correspond to atlog.h in the N & C Appletalk
652 * sources.
653 */
654
655 #define AT_MID_ADSP 212
656
657 /* Streams ioctl definitions */
658
659 #define ADSP_IOCTL(i) ((i>>8) == AT_MID_ADSP)
660 #define ADSPATTNREAD ((AT_MID_ADSP<<8) | 254) /* read attention data */
661 #define ADSPOPEN ((AT_MID_ADSP<<8) | 253) /* open a connection */
662 #define ADSPCLOSE ((AT_MID_ADSP<<8) | 252) /* close a connection */
663 #define ADSPCLINIT ((AT_MID_ADSP<<8) | 251) /* create a conn listener */
664 #define ADSPCLREMOVE ((AT_MID_ADSP<<8) | 250) /* remove a conn listener */
665 #define ADSPCLLISTEN ((AT_MID_ADSP<<8) | 249) /* post a listener request */
666 #define ADSPCLDENY ((AT_MID_ADSP<<8) | 248) /* deny an open connection request */
667 #define ADSPSTATUS ((AT_MID_ADSP<<8) | 247) /* get status of conn end */
668 #define ADSPREAD ((AT_MID_ADSP<<8) | 246) /* read data from conn */
669 #define ADSPWRITE ((AT_MID_ADSP<<8) | 245) /* write data on the conn */
670 #define ADSPATTENTION ((AT_MID_ADSP<<8) | 244) /* send attention message */
671 #define ADSPOPTIONS ((AT_MID_ADSP<<8) | 243) /* set conn end options */
672 #define ADSPRESET ((AT_MID_ADSP<<8) | 242) /* forward reset connection */
673 #define ADSPNEWCID ((AT_MID_ADSP<<8) | 241) /* generate a cid conn end */
674 #define ADSPBINDREQ ((AT_MID_ADSP<<8) | 240)
675 #define ADSPGETSOCK ((AT_MID_ADSP<<8) | 239)
676 #define ADSPGETPEER ((AT_MID_ADSP<<8) | 238)
677
678 #ifdef KERNEL_PRIVATE
679
680 /* from h/adsp_adsp.h */
681
682 /* Definitions from strgeneric.h (on AIX?) */
683 #define STR_IGNORE 0
684 #define STR_PUTNEXT 1
685 #define STR_PUTBACK 2
686 #define STR_QTIME (HZ >> 3)
687
688 struct ccb;
689 #define CCBPtr struct ccb *
690 extern int adspInit(CCBPtr sp, struct adspcmd *ap);
691 extern int adspOpen(register CCBPtr sp, register struct adspcmd *pb);
692 extern int adspCLListen( register CCBPtr sp, register struct adspcmd *pb);
693 extern int adspClose(register CCBPtr sp, register struct adspcmd *pb);
694 extern int adspCLDeny(struct adspcmd *pb, CCBPtr sp);
695 extern int adspStatus(CCBPtr sp, register struct adspcmd *pb);
696 extern int adspRead(register CCBPtr sp, register struct adspcmd *pb);
697 extern int adspWrite(CCBPtr sp, struct adspcmd *pb);
698 extern int adspAttention(register struct adspcmd *pb, register CCBPtr sp);
699 extern int adspOptions(CCBPtr sp, struct adspcmd *pb);
700 extern int adspReset(CCBPtr sp, struct adspcmd *pb);
701 extern int adspNewCID(CCBPtr sp, struct adspcmd *pb);
702 extern int adspPacket(gref_t *gref, gbuf_t *mp);
703 #undef CCBPtr
704
705
706 struct adsp_debug {
707 int ad_time;
708 int ad_seq;
709 int ad_caller;
710 int ad_descriptor;
711 int ad_bits;
712 short ad_sendCnt;
713 short ad_sendMax;
714 int ad_maxSendSeq;
715 int ad_sendWdwSeq;
716 };
717
718 #endif /* KERNEL_PRIVATE */
719 #endif /* __APPLE_API_OBSOLETE */
720 #endif /* _NETAT_ADSP_H_ */