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