Annotation of XNU/bsd/netat/adsp.h, revision 1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.