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