|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. ! 3: * ! 4: * @APPLE_LICENSE_HEADER_START@ ! 5: * ! 6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights ! 7: * Reserved. This file contains Original Code and/or Modifications of ! 8: * Original Code as defined in and that are subject to the Apple Public ! 9: * Source License Version 1.1 (the "License"). You may not use this file ! 10: * except in compliance with the License. Please obtain a copy of the ! 11: * License at http://www.apple.com/publicsource and read it before using ! 12: * this file. ! 13: * ! 14: * The Original Code and all software distributed under the License are ! 15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER ! 16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ! 17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ! 18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ! 19: * License for the specific language governing rights and limitations ! 20: * under the License. ! 21: * ! 22: * @APPLE_LICENSE_HEADER_END@ ! 23: */ ! 24: ! 25: /* ADSP.h ! 26: * ! 27: * From Mike Shoemaker (06/23/90) ! 28: * ! 29: * C Interfaces for the AppleTalk Data Stream Protocol (ADSP) ! 30: * ! 31: */ ! 32: ! 33: #ifndef __ADSP__ ! 34: #define __ADSP__ ! 35: ! 36: #ifndef __APPLETALK__ ! 37: #include <at/appletalk.h> ! 38: #endif ! 39: ! 40: ! 41: /* Solaris defines u as (curproc->p_user) */ ! 42: #if defined(u) ! 43: # undef u ! 44: #endif ! 45: ! 46: typedef short OSErr; ! 47: typedef long (*ProcPtr)(); ! 48: typedef ProcPtr *ProcHandle; ! 49: typedef char *Ptr; ! 50: typedef Ptr *Handle; ! 51: ! 52: /* result codes */ ! 53: ! 54: #define errENOBUFS -1281 ! 55: #define errRefNum -1280 /* bad connection refNum */ ! 56: #define errAborted -1279 /* control call was aborted */ ! 57: #define errState -1278 /* bad connection state for this operation */ ! 58: #define errOpening -1277 /* open connection request failed */ ! 59: #define errAttention -1276 /* attention message too long */ ! 60: #define errFwdReset -1275 /* read terminated by forward reset */ ! 61: #define errDSPQueueSize -1274 /* DSP Read/Write Queue Too small */ ! 62: #define errOpenDenied -1273 /* open connection request was denied */ ! 63: ! 64: /* control codes */ ! 65: ! 66: #define dspInit 255 /* create a new connection end */ ! 67: #define dspRemove 254 /* remove a connection end */ ! 68: #define dspOpen 253 /* open a connection */ ! 69: #define dspClose 252 /* close a connection */ ! 70: #define dspCLInit 251 /* create a connection listener */ ! 71: #define dspCLRemove 250 /* remove a connection listener */ ! 72: #define dspCLListen 249 /* post a listener request */ ! 73: #define dspCLDeny 248 /* deny an open connection request */ ! 74: #define dspStatus 247 /* get status of connection end */ ! 75: #define dspRead 246 /* read data from the connection */ ! 76: #define dspWrite 245 /* write data on the connection */ ! 77: #define dspAttention 244 /* send an attention message */ ! 78: #define dspOptions 243 /* set connection end options */ ! 79: #define dspReset 242 /* forward reset the connection */ ! 80: #define dspNewCID 241 /* generate a cid for a connection end */ ! 81: ! 82: ! 83: /* connection opening modes */ ! 84: ! 85: #define ocRequest 1 /* request a connection with remote */ ! 86: #define ocPassive 2 /* wait for a connection request from remote */ ! 87: #define ocAccept 3 /* accept request as delivered by listener */ ! 88: #define ocEstablish 4 /* consider connection to be open */ ! 89: ! 90: ! 91: /* connection end states */ ! 92: ! 93: #define sListening 1 /* for connection listeners */ ! 94: #define sPassive 2 /* waiting for a connection request from remote */ ! 95: #define sOpening 3 /* requesting a connection with remote */ ! 96: #define sOpen 4 /* connection is open */ ! 97: #define sClosing 5 /* connection is being torn down */ ! 98: #define sClosed 6 /* connection end state is closed */ ! 99: ! 100: ! 101: ! 102: /* client event flags */ ! 103: ! 104: #define eClosed 0x80 /* received connection closed advice */ ! 105: #define eTearDown 0x40 /* connection closed due to broken connection */ ! 106: #define eAttention 0x20 /* received attention message */ ! 107: #define eFwdReset 0x10 /* received forward reset advice */ ! 108: ! 109: /* miscellaneous constants */ ! 110: ! 111: #define attnBufSize 570 /* size of client attention buffer */ ! 112: #define minDSPQueueSize 100 /* Minimum size of receive or send Queue */ ! 113: #define defaultDSPQS 16384 /* random guess */ ! 114: #define RecvQSize defaultDSPQS ! 115: #define SendQSize defaultDSPQS ! 116: ! 117: /* connection control block */ ! 118: ! 119: struct TRCCB { ! 120: u_char *ccbLink; /* link to next ccb */ ! 121: u_short refNum; /* user reference number */ ! 122: u_short state; /* state of the connection end */ ! 123: u_char userFlags; /* flags for unsolicited connection events */ ! 124: u_char localSocket; /* socket number of this connection end */ ! 125: at_inet_t remoteAddress; /* internet address of remote end */ ! 126: u_short attnCode; /* attention code received */ ! 127: u_short attnSize; /* size of received attention data */ ! 128: u_char *attnPtr; /* ptr to received attention data */ ! 129: u_char reserved[220]; /* for adsp internal use */ ! 130: }; ! 131: ! 132: typedef struct TRCCB TRCCB; ! 133: typedef TRCCB *TPCCB; ! 134: ! 135: /* init connection end parameters */ ! 136: ! 137: struct TRinitParams { ! 138: TPCCB ccbPtr; /* pointer to connection control block */ ! 139: ProcPtr userRoutine; /* client routine to call on event */ ! 140: u_char *sendQueue; /* client passed send queue buffer */ ! 141: u_char *recvQueue; /* client passed receive queue buffer */ ! 142: u_char *attnPtr; /* client passed receive attention buffer */ ! 143: u_short sendQSize; /* size of send queue (0..64K bytes) */ ! 144: u_short recvQSize; /* size of receive queue (0..64K bytes) */ ! 145: u_char localSocket; /* local socket number */ ! 146: }; ! 147: ! 148: typedef struct TRinitParams TRinitParams; ! 149: ! 150: /* open connection parameters */ ! 151: ! 152: struct TRopenParams { ! 153: u_short localCID; /* local connection id */ ! 154: u_short remoteCID; /* remote connection id */ ! 155: at_inet_t remoteAddress; /* address of remote end */ ! 156: at_inet_t filterAddress; /* address filter */ ! 157: unsigned long sendSeq; /* local send sequence number */ ! 158: u_long recvSeq; /* receive sequence number */ ! 159: u_long attnSendSeq; /* attention send sequence number */ ! 160: u_long attnRecvSeq; /* attention receive sequence number */ ! 161: u_short sendWindow; /* send window size */ ! 162: u_char ocMode; /* open connection mode */ ! 163: u_char ocInterval; /* open connection request retry interval */ ! 164: u_char ocMaximum; /* open connection request retry maximum */ ! 165: }; ! 166: ! 167: typedef struct TRopenParams TRopenParams; ! 168: ! 169: /* close connection parameters */ ! 170: ! 171: struct TRcloseParams { ! 172: u_char abort; /* abort connection immediately if non-zero */ ! 173: }; ! 174: ! 175: typedef struct TRcloseParams TRcloseParams; ! 176: ! 177: /* client status parameter block */ ! 178: ! 179: struct TRstatusParams { ! 180: TPCCB ccbPtr; /* pointer to ccb */ ! 181: u_short sendQPending; /* pending bytes in send queue */ ! 182: u_short sendQFree; /* available buffer space in send queue */ ! 183: u_short recvQPending; /* pending bytes in receive queue */ ! 184: u_short recvQFree; /* available buffer space in receive queue */ ! 185: }; ! 186: ! 187: typedef struct TRstatusParams TRstatusParams; ! 188: ! 189: /* read/write parameter block */ ! 190: ! 191: struct TRioParams { ! 192: u_short reqCount; /* requested number of bytes */ ! 193: u_short actCount; /* actual number of bytes */ ! 194: u_char *dataPtr; /* pointer to data buffer */ ! 195: u_char eom; /* indicates logical end of message */ ! 196: u_char flush; /* send data now */ ! 197: u_char dummy[2]; /*### LD */ ! 198: }; ! 199: ! 200: typedef struct TRioParams TRioParams; ! 201: ! 202: /* attention parameter block */ ! 203: ! 204: struct TRattnParams { ! 205: u_short attnCode; /* client attention code */ ! 206: u_short attnSize; /* size of attention data */ ! 207: u_char *attnData; /* pointer to attention data */ ! 208: u_char attnInterval; /* retransmit timer in 10-tick intervals */ ! 209: u_char dummy[3]; /* ### LD */ ! 210: }; ! 211: ! 212: typedef struct TRattnParams TRattnParams; ! 213: ! 214: /* client send option parameter block */ ! 215: ! 216: struct TRoptionParams { ! 217: u_short sendBlocking; /* quantum for data packets */ ! 218: u_char sendTimer; /* send timer in 10-tick intervals */ ! 219: u_char rtmtTimer; /* retransmit timer in 10-tick intervals */ ! 220: u_char badSeqMax; /* threshold for sending retransmit advice */ ! 221: u_char useCheckSum; /* use ddp packet checksum */ ! 222: u_short filler; /* ### LD */ ! 223: int newPID; /* ### Temp for backward compatibility 02/11/94 */ ! 224: }; ! 225: ! 226: typedef struct TRoptionParams TRoptionParams; ! 227: ! 228: /* new cid parameters */ ! 229: ! 230: struct TRnewcidParams { ! 231: u_short newcid; /* new connection id returned */ ! 232: }; ! 233: ! 234: typedef struct TRnewcidParams TRnewcidParams; ! 235: ! 236: union adsp_command { ! 237: TRinitParams initParams; /* dspInit, dspCLInit */ ! 238: TRopenParams openParams; /* dspOpen, dspCLListen, dspCLDeny */ ! 239: TRcloseParams closeParams; /* dspClose, dspRemove */ ! 240: TRioParams ioParams; /* dspRead, dspWrite, dspAttnRead */ ! 241: TRattnParams attnParams; /* dspAttention */ ! 242: TRstatusParams statusParams; /* dspStatus */ ! 243: TRoptionParams optionParams; /* dspOptions */ ! 244: TRnewcidParams newCIDParams; /* dspNewCID */ ! 245: }; ! 246: ! 247: /* ADSP CntrlParam ioQElement */ ! 248: ! 249: struct DSPParamBlock { ! 250: struct QElem *qLink; ! 251: short qType; ! 252: short ioTrap; ! 253: Ptr ioCmdAddr; ! 254: ProcPtr ioCompletion; ! 255: OSErr ioResult; ! 256: char *ioNamePtr; ! 257: short ioVRefNum; ! 258: short ioCRefNum; /* adsp driver refNum */ ! 259: short csCode; /* adsp driver control code */ ! 260: long qStatus; /* adsp internal use */ ! 261: u_short ccbRefNum; /* connection end refNum */ ! 262: union adsp_command u; ! 263: }; ! 264: ! 265: typedef struct DSPParamBlock DSPParamBlock; ! 266: typedef DSPParamBlock *DSPPBPtr; ! 267: ! 268: struct adspcmd { ! 269: struct adspcmd *qLink; ! 270: u_int ccbRefNum; ! 271: caddr_t ioc; ! 272: #ifdef _KERNEL ! 273: gref_t *gref; ! 274: gbuf_t *mp; ! 275: #else ! 276: void *gref; ! 277: void *mp; ! 278: #endif ! 279: short ioResult; ! 280: u_short ioDirection; ! 281: short csCode; ! 282: u_short socket; ! 283: union adsp_command u; ! 284: }; ! 285: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.