Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Networking /
Chapter 5 - AppleTalk Data Stream Protocol (ADSP)


Summary of ADSP

Pascal Summary

Constants

CONST
   {ADSP routine selectors}
   dspInit                 = 255;         {create a new connection end}
   dspRemove               = 254;         {remove a connection end}
   dspOpen                 = 253;         {open a connection}
   dspClose                = 252;         {close a connection}
   dspCLInit               = 251;         {create a connection listener}
   dspCLRemove             = 250;         {remove a connection listener}
   dspCLListen             = 249;         {post a listener request}
   dspCLDeny               = 248;         {deny an open-connection request}
   dspStatus               = 247;         {get status of connection end}
   dspRead                 = 246;         {read data from the connection}
   dspWrite                = 245;         {write data on the connection}
   dspAttention            = 244;         {send an attention message}
   dspOptions              = 243;         {set connection end options}
   dspReset                = 242;         {forward reset the connection}
   dspNewCID               = 241;         {generate a CID for a }
                                          { connection end}
   sdspOpen                = 229;         {open a secure connection}
   {ADSP connection-opening modes}
   ocRequest               = 1;           {request a connection with a }
                                          { remote connection end}
   ocPassive               = 2;           {wait for a connection request }
                                          { from remote connection end}
   ocAccept                = 3;           {accept request as delivered by }
                                          { listener}
   ocEstablish             = 4;           {consider connection to be open}
   
   {ADSP connection end states}
   sListening              = 1;           {for connection listeners}
   sPassive                = 2;           {waiting for a connection }
                                          { request from remote }
                                          { connection end}
   sOpening                = 3;           {requesting a connection }
                                          { with remote connection end}
   sOpen                   = 4;           {connection is open}
   sClosing                = 5;           {connection is being torn down}
   sClosed                 = 6;           {connection end state is closed}

   {ASDSP end-of-message and encrypt flags and masks}
   dspEncryptBit           = 1;           {set to encrypt message}
   dspEOMBit               = 0;           {set if EOM at end of write}
   dspEOMMask              = $1;          {mask for setting the EOM bit}
   dspEncryptMask          = $2;          {mask for setting the encrypt bit}

   {ADSP client event flags}
   eClosed                 = $80;         {received connection-closed event}
   eTearDown               = $40;         {closed due to broken connection}
   eAttention              = $20;         {received attention message}
   eFwdReset               = $10;         {received forward reset event}
   
   {miscellaneous ADSP constants}
   attnBufSize             = 570;         {size of client attention buffer}
   minDSPQueueSize         = 100;         {minimum size of receive or }
                                          { send queue}

   {driver control ioResults}
   errRefNum               = -1280;       {bad connection refNum}
   errAborted              = -1279;       {control call was aborted}
   errState                = -1278;       {bad connection state for this }
                                          { operation}
   errOpening              = -1277;       {open connection request failed}
   errAttention            = -1276;       {attention message too long}
   errFwdReset             = -1275;       {read terminated by forward reset}
   errDSPQueueSize         = -1274;       {DSP read/write queue too small}
   errOpenDenied           = -1273;       {open connection request denied}

Data Types

The ADSP Connection Control Block Record

TYPE TRCCB = 
   PACKED RECORD
      ccbLink:          TPCCB;      {link to next CCB}
      refNum:           Integer;    {reference number}
      state:            Integer;    {state of the connection end}
      userFlags:        Byte;       {user flags for connection}
      localSocket:      Byte;       {local socket number}
      remoteAddress:    AddrBlock;  {remote end internet address}
      attnCode:         Integer;    {attention code received}
      attnSize:         Integer;    {size of attention data}
      attnPtr:          Ptr;        {pointer to attention data}
      reserved:         PACKED ARRAY[1..220] OF Byte;
                                    {reserved for use by ADSP}
   END;

The Address Block Record

TYPE AddrBlock = 
   PACKED RECORD
      aNet:             Integer;    {network number}
      aNode:            Byte;       {node ID}
      aSocket:          Byte;       {socket number}
   END;

The DSP Parameter Block

TYPE DSPParamBlock = 
   PACKED RECORD
      qLink:            QElemPtr;   {reserved}
      qType:            Integer;    {reserved}
      ioTrap:           Integer;    {reserved}
      ioCmdAddr:        Ptr;        {reserved}
      ioCompletion:     ProcPtr;    {completion routine}
      ioResult:         OSErr;      {result code}
      ioNamePtr:        StringPtr;  {reserved}
      ioVRefNum:        Integer;    {reserved}
      ioCRefNum:        Integer;    {driver reference number}
      csCode:           Integer;    {primary command code}
      qStatus:          LongInt;    {reserved}
      ccbRefNum:        Integer;    {CCB reference number}
   CASE Integer OF
   dspInit, dspCLInit:
      (ccbPtr:          TPCCB;      {pointer to CCB}
      userRoutine:      ProcPtr;    {pointer to user routine}
      sendQSize:        Integer;    {size of send queue}
      sendQueue:        Ptr;        {pointer to send queue}
      recvQSize:        Integer;    {size of receive queue}
      recvQueue:        Ptr;        {pointer to receive queue}
      attnPtr:          Ptr;        {pointer to attention-message buffer}
      localSocket:      Byte;       {local socket number}
      filler1:          Byte);      {filler for proper alignment}
   dspOpen, dspCLListen, dspCLDeny:
      (localCID:        Integer;    {local connection ID}
      remoteCID:        Integer;    {remote connection ID}
      remoteAddress:    AddrBlock;  {remote internet address}
      filterAddress:    AddrBlock;  {address filter}
      sendSeq:          LongInt;    {send sequence number}
      sendWindow:       Integer;    {size of remote buffer}
      recvSeq:          LongInt;    {receive sequence number}
      attnSendSeq:      LongInt;    {attention send seq number}
      attnRecvSeq:      LongInt;    {attention receive seq num}
      ocMode:           Byte;       {connection-opening mode}
      ocInterval:       Byte;       {interval bet. open requests}
      ocMaximum:        Byte;       {retries of open-conn req}
      filler2:          Byte);      {filler for proper alignment}
   dspClose, dspRemove:
      (abort:           Byte;       {abort send requests}
      filler3:          Byte);      {filler for proper alignment}
   dspStatus:
      (statusCCB:       TPCCB;      {pointer to CCB}
      sendQPending:     Integer;    {bytes waiting in send queue}
      sendQFree:        Integer;    {available send-queue buffer}
      recvQPending:     Integer;    {bytes in receive queue}
      recvQFree:        Integer);   {avail receive-queue buffer}
   dspRead, dspWrite:
      (reqCount:        Integer;    {requested number of bytes}
      actCount:         Integer;    {actual number of bytes}
      dataPtr:          Ptr;        {pointer to data buffer}
      eom:              Byte;       {1 if end of message}
      flush:            Byte);      {1 to send data now}
   dspAttention:
      (attnCode:        Integer;    {client attention code}
      attnSize:         Integer;    {size of attention data}
      attnData:         Ptr;        {pointer to attention data}
      attnInterval:     Byte;       {reserved}
      filler4:          Byte);      {filler for proper alignment}
   dspOptions:
      (sendBlocking:    Integer;    {send-blocking threshold}
      sendTimer:        Byte;       {reserved}
      rtmtTimer:        Byte;       {reserved}
      badSeqMax:        Byte;       {retransmit advice threshold}
      useCheckSum:      Byte);      {DDP checksum for packets}
   dspNewCID:
      (newCID:          Integer);   {new connection ID}
   END;
DSPPBPtr = ^DSPParamBlock;

The ASDSP Parameter Block

TYPE SDSPParamBlock = 
   PACKED RECORD
   CASE INTEGER OF
      1: (dspParamBlock: DSPParamBlock);
      2: (qLink:        QElemPtr;      {reserved}
         qType:         Integer;       {reserved}
         ioTrap:        Integer;       {reserved}
         ioCmdAddr:     Ptr;           {reserved}
         ioCompletion:  ProcPtr;       {completion routine}
         ioResult:      OSErr;         {result code}
         ioNamePtr:     StringPtr;     {reserved}
         ioVRefNum:     Integer;       {reserved}
         ioCRefNum:     Integer;       {adsp driver refNum}
         csCode:        Integer;       {asdsp driver control code}
         qStatus:       Longint;       {reserved}
         ccbRefNum:     Integer;       {connection end refNum}
         secureParams:  TRSecureParams);
                                       {parameters for dspOpenSecure}
   END;

SDSPPBPtr = ^SDSPParamBlock; 

The TRSecureParams Record

TYPE  TRSecureParams = 
   PACKED RECORD
      localCID:         Integer;       {local connection ID}
      remoteCID:        Integer;       {remote connection ID}
      remoteAddress:    AddrBlock;     {address of remote end}
      filterAddress:    AddrBlock;     {address filter}
      sendSeq:          Longint;       {local send sequence number}
      sendWindow:       Integer;       {send window size}
      recvSeq:          Longint;       {receive sequence number}
      attnSendSeq:      Longint;       {attention send sequence number}
      attnRecvSeq:      Longint;       {attention receive sequence number}
      ocMode:           Byte;          {open connection mode}
      ocInterval:       Byte;          {open connection request }
                                       { retry interval}
      ocMaximum:        Byte;          {open connection request }
                                       { retry maximum}
      secure:           Boolean;       {for initiator, TRUE if session is }
                                       { authenticated}
                                       {for recipient, TRUE if session was }
                                       { authenticated}
      sessionKey:       AuthKeyPtr;    {encryption key for session}
      credentialsSize:  Longint;       {length of credentials}
      credentials:      Ptr;           {pointer to credentials}
      workspace:        Ptr;           {pointer to workspace for }
                                       { connection. Align on }
                                       { even boundary and }
                                       { length = sdspWorkSize}
      recipient:        AuthIdentity;  {identity of recipient }
                                       { or initiator if active mode}
      issueTime:        UTCTime;       {time when credentials were issued}
      expiry:           UTCTime;       {time when credentials expire}
      initiator:        RecordIDPtr;   {RecordID of initiator returned in }
                                       { the buffer pointed to by this field}
      hasIntermediary:  Boolean;       {set if credentials has an }
                                       { intermediary}
      intermediary:     RecordIDPtr;   {Record ID of intermediary returned} 
   END;

C Summary

Constants

/*workspace used internally by ASDSP for the sdspOpen call*/
#define sdspWorkSize          2048        /*size of ASDSP workspace*/
enum{                                     /*ADSP routine selectors*/
   dspInit                 = 255,         /*create a new connection end*/
   dspRemove               = 254,         /*remove a connection end*/
   dspOpen                 = 253,         /*open a connection*/
   dspClose                = 252,         /*close a connection*/
   dspCLInit               = 251,         /*create a connection listener*/
   dspCLRemove             = 250,         /*remove a connection listener*/
   dspCLListen             = 249,         /*post a listener request*/
   dspCLDeny               = 248,         /*an open-connection request*/
   dspStatus               = 247,         /*get status of connection end*/
   dspRead                 = 246,         /*read data from the connection*/
   dspWrite                = 245,         /*write data on the connection*/
   dspAttention            = 244,         /*send an attention message*/
   dspOptions              = 243,         /*set connection end options*/
   dspReset                = 242,         /*forward reset the connection*/
   dspNewCID               = 241,         /*generate a CID for a */
                                          /* connection end*/
   sdspOpen                = 229;         /*open a secure connection*/
   
enum {                                    /*ADSP connection-opening modes*/
   ocRequest               = 1,           /*request a connection with a */
                                          /* remote connection end*/
   ocPassive               = 2,           /*wait for a connection request */
                                          /* from remote connection end*/
   ocAccept                = 3,           /*accept request as delivered by */
                                          /* listener*/
   ocEstablish             = 4};          /*consider connection to be */
                                          /* open*/
   
enum {                                    /*ADSP connection end states*/
   sListening              = 1,           /*for connection listeners*/
   sPassive                = 2,           /*waiting for a connection */
                                          /* request from remote */
                                          /* connection end*/
   sOpening                = 3,           /*requesting a connection */
                                          /* with remote connection end*/
   sOpen                   = 4,           /*connection is open*/
   sClosing                = 5,           /*connection is being torn down*/
   sClosed                 = 6};          /*connection end state */
                                          /* is closed*/

/*ASDSP end-of-message and encrypt flags and masks*/
enum {
   dspEOMBit               = 0,           /*set if EOM at end of write*/
   dspEncryptBit           = 1};          /*set to encrypt message*/

enum {
   dspEOMMask              = 1<<dspEOMBit,
   dspEncryptMask          = 1<<dspEncryptBit
};
   
enum {                                    /*ADSP client event flags*/
   eClosed                 = $80,         /*received connection-closed */
                                          /* event*/
   eTearDown               = $40,         /*closed due to broken */
                                          /* connection*/
   eAttention              = $20,         /*received attention message*/
   eFwdReset               = $10};        /*received forward reset event*/
   
enum {                                    /*miscellaneous ADSP constants*/
   attnBufSize             = 570,         /*size of client attention */
                                          /* buffer*/
   minDSPQueueSize         = 100};        /*minimum size of receive or */
                                          /* send queue*/

enum {                                    /*driver control ioResults*/
   errRefNum               = -1280,       /*bad connection refNum*/
   errAborted              = -1279,       /*control call was aborted*/
   errState                = -1278,       /*bad connection state for this */
                                          /* operation*/
   errOpening              = -1277,       /*open connection request */
                                          /* failed*/
   errAttention            = -1276,       /*attention message too long*/
   errFwdReset             = -1275,       /*read terminated */
                                          /* by forward reset*/
   errDSPQueueSize         = -1274,       /*DSP read/write queue */
                                          /* too small*/
   errOpenDenied           = -1273};      /*open connection request */
                                          /* denied*/

Data Types

The ADSP Connection Control Block Record

struct TRCCB { 
   unsigned char     *ccbLink;         /*link to next CCB*/
   unsigned short    refNum;           /*reference number*/
   unsigned short    state;            /*state of the connection end*/
   unsigned char     userFlags;        /*user flags for connection*/
   unsigned char     localSocket;      /*local socket number*/
   AddrBlock         remoteAddress;    /*remote end internet address*/
   unsigned short    attnCode;         /*attention code received*/
   unsigned short    attnSize;         /*size of attention data*/
   unsigned char     *attnPtr;         /*pointer to attention data*/
   unsigned char     reserved[220];    /*reserved*/
};
typedef struct TRCCB TRCCB;
typedef TRCCB *TPCCB;

The Address Block Record

struct AddrBlock {
   short             aNet;             /*network number*/
   unsigned char     aNode;            /*node ID*/
   unsigned char     aSocket;          /*socket number*/
};
typedef struct AddrBlock AddrBlock; 

Parameter Block for dspInit and dspCLInit

struct TRinitParams {
   TPCCB             ccbPtr;        /*pointer to connection control block*/
   ProcPtr           userRoutine;   /*client routine to call on event*/
   unsigned short    sendQSize;     /*size of send queue (0..64K bytes)*/
   unsigned char     *sendQueue;    /*client passed send queue buffer*/
   unsigned short    recvQSize;     /*size of receive queue */
                                    /* (0..64K bytes)*/
   unsigned char     *recvQueue;    /*client passed receive queue buffer*/
   unsigned char     *attnPtr;      /*client passed receive attention */
                                    /* buffer*/
   unsigned char     localSocket;   /*local socket number*/
};
typedef struct TRinitParams TRinitParams;

Parameter Block for dspOpen, dspCLListen, and dspCLDeny

struct TRopenParams {
   unsigned short    localCID;         /*local connection ID*/
   unsigned short    remoteCID;        /*remote connection ID*/
   AddrBlock         remoteAddress;    /*address of remote end*/
   AddrBlock         filterAddress;    /*address filter*/
   unsigned long     sendSeq;          /*local send sequence number*/
   unsigned short    sendWindow;       /*send window size*/
   unsigned long     recvSeq;          /*receive sequence number*/
   unsigned long     attnSendSeq;      /*attention send sequence number*/
   unsigned long     attnRecvSeq;      /*attention receive sequence */
                                       /* number*/
   unsigned char     ocMode;           /*open connection mode*/
   unsigned char     ocInterval;       /*open connection request retry */
                                       /* interval*/
   unsigned char     ocMaximum;        /*open connection request retry */
};                                     /* maximum*/
typedef struct TRopenParams TRopenParams;

Parameter Block for dspClose and dspRemove

struct TRcloseParams {
   unsigned char        abort; /*abort connection immediately if nonzero*/
};
typedef struct TRcloseParams TRcloseParams;

Parameter Block for dspStatus

struct TRstatusParams {
   TPCCB                ccbPtr;        /*pointer to ccb*/
   unsigned short       sendQPending;  /*pending bytes in send queue*/
   unsigned short       sendQFree;     /*available buffer space in send */
                                       /* queue*/
   unsigned short       recvQPending;  /*pending bytes in receive queue*/
   unsigned short       recvQFree;     /*available buffer space in */
};                                     /* receive queue*/
typedef struct TRstatusParams TRstatusParams;

Parameter Block for dspRead and dspWrite

struct TRioParams {
   unsigned short       reqCount;      /*requested number of bytes*/
   unsigned short       actCount;      /*actual number of bytes*/
   unsigned char        *dataPtr;      /*pointer to data buffer*/ 
   unsigned char        eom;           /*indicates logical end of message*/
   unsigned char        flush;         /*send data now*/
};
typedef struct TRioParams TRioParams;

Parameter Block for dspAttention

struct TRattnParams {
   unsigned short       attnCode;      /*client attention code*/
   unsigned short       attnSize;      /*size of attention data*/
   unsigned char        *attnData;     /*pointer to attention data*/
   unsigned char        attnInterval;  /*retransmit timer in 10-tick */
                                       /* intervals*/
};
typedef struct TRattnParams TRattnParams;

Parameter Block for dspOptions

struct TRoptionParams {
   unsigned short       sendBlocking;  /*quantum for data packets*/
   unsigned char        sendTimer;     /*send timer in 10-tick intervals*/
   unsigned char        rtmtTimer;     /*retransmit timer in 10-tick */
                                       /* intervals*/
   unsigned char        badSeqMax;     /*threshold for sending retransmit */
                                       /* advice*/
   unsigned char        useCheckSum;   /*use ddp packet checksum*/
};
typedef struct TRoptionParams TRoptionParams;

Parameter Block for dspNewCID

struct TRnewcidParams {
   unsigned short       newcid;        /*new connection ID returned*/
};
typedef struct TRnewcidParams TRnewcidParams;

The DSP Parameter Block

struct DSPParamBlock {
   struct QElem      *qLink;           /*reserved*/
   short             qType;            /*reserved*/
   short             ioTrap;           /*reserved*/
   Ptr               ioCmdAddr;        /*reserved*/
   ProcPtr           ioCompletion;     /*pointer to completion routine*/
   OSErr             ioResult;         /*routine result*/
   char              *ioNamePtr;       /*reserved*/
   short             ioVRefNum;        /*reserved*/
   short             ioCRefNum;        /*ADSP driver refNum*/
   short             csCode;           /*ADSP driver control code*/
   long              qStatus;          /*reserved*/
   short             ccbRefNum;
union{
   TRinitParams      initParams;       /*dspInit, dspCLInit*/
   TRopenParams      openParams;       /*dspOpen, dspCLListen, dspCLDeny*/
   TRcloseParams     closeParams;      /*dspClose, dspRemove*/
   TRioParams        ioParams;         /*dspRead, dspWrite*/
   TRattnParams      attnParams;       /*dspAttention*/
   TRstatusParams    statusParams;     /*dspStatus*/
   TRoptionParams    optionParams;     /*dspOptions*/
   TRnewcidParams    newCIDParams;     /*dspNewCID*/
   } u;
};
typedef struct DSPParamBlock DSPParamBlock;
typedef DSPParamBlock *DSPPBPtr;

The ASDSP Parameter Block

struct TRSecureParams {
   unsigned short    localCID;         /*local connection ID*/
   unsigned short    remoteCID;        /*remote connection ID*/
   AddrBlock         remoteAddress;    /*address of remote end*/
   AddrBlock         filterAddress;    /*address filter*/
   unsigned long     sendSeq;          /*local send sequence number*/
   unsigned short    sendWindow;       /*send window size*/
   unsigned long     recvSeq;          /*receive sequence number*/
   unsigned long     attnSendSeq;      /*attention send sequence number*/
   unsigned long     attnRecvSeq;      /*attention receive sequence */
                                       /* number*/
   unsigned char     ocMode;           /*open connection mode*/
   unsigned char     ocInterval;       /*open connection request retry */
                                       /* interval*/
   unsigned char     ocMaximum;        /*open connection request retry */
                                       /* maximum*/      
   Boolean           secure;           /*TRUE if session was */
                                       /* authenticated*/
   AuthKeyPtr        sessionKey;       /*encryption key for session*/
   unsigned          longcredentialsSize;
                                       /*length of credentials*/
   Ptr               credentials;      /*pointer to credentials*/

   Ptr               workspace;        /*pointer to workspace for */
                                       /* connection. align on even */
                                       /* boundary and length equals */
                                       /* sdspWorkSize*/
   AuthIdentity      recipient;        /*identity of recipient */
                                       /* (or initiator if active mode)*/
   UTCTime           issueTime;        /*when credentials were issued*/ 
   UTCTime           expiry;           /*when credentials expire*/
   RecordIDPtr       initiator;        /*pointer to RecordID of */
                                       /* initiator returned*/
   Boolean           hasIntermediary;  /*is set if credentials */
                                       /* have an intermediary*/
   RecordIDPtr       intermediary;     /*pointer to RecordID of */
                                       /* intermediary returned*/
   };

The TRSecureParams Record           

typedef struct TRSecureParams TRSecureParams;

struct SDSPParamBlock {
      struct QElem      *qLink;        /*reserved*/
      short             qType;         /*reserved*/
      short             ioTrap;        /*reserved*/
      Ptr               ioCmdAddr;     /*reserved*/
      ProcPtr           ioCompletion;
                                       /*pointer to completion routine*/
      OSErr             ioResult;      /*routine result*/
      char              *ioNamePtr;    /*reserved*/
      short             ioVRefNum;     /*reserved*/
      short             ioCRefNum;     /*ADSP driver refNum*/
      short             csCode;        /*ADSP driver control code*/
      long              qStatus;       /*ADSP internal use*/
      short             ccbRefNum;     /*connection end refNum*/
   union {
      TRinitParams      initParams;    /*dspInit, dspCLInit*/
      TRopenParams      openParams;    /*dspOpen, dspCLListen, dspCLDeny*/
      TRcloseParams     closeParams;   /*dspClose, dspRemove*/
      TRioParams        ioParams;      /*dspRead, dspWrite*/
      TRattnParams      attnParams;    /*dspAttention*/
      TRstatusParams    statusParams;  /*dspStatus*/
      TRoptionParams    optionParams;  /*dspOptions*/
      TRnewcidParams    newCIDParams;  /*dspNewCID*/
      TRSecureParams    secureParams;  /*dspOpenSecure*/
   } u;
};
typedef struct SDSPParamBlock SDSPParamBlock;
typedef SDSPParamBlock *SDSPPBPtr;

Assembly-Language Summary

Constants

ADSP Queue Element Equates and Sizes

csQStatus      EQU      CSParam        ;ADSP internal use
csCCBRef       EQU      csQStatus+4    ;refnum of ccb

Command Codes

dspInit        EQU      255            ;create a new connection end
dspRemove      EQU      254            ;remove a connection end
dspOpen        EQU      253            ;open a connection
dspClose       EQU      252            ;close a connection
dspCLInit      EQU      251            ;create a connection listener
dspCLRemove    EQU      250            ;remove a connection listener
dspCLListen    EQU      249            ;post a listener request
dspCLDeny      EQU      248            ;deny an open connection request
dspStatus      EQU      247            ;get status of connection end
dspRead        EQU      246            ;read data from the connection
dspWrite       EQU      245            ;write data on the connection
dspAttention   EQU      244            ;send an attention message
dspOptions     EQU      243            ;set connection end options
dspReset       EQU      242            ;forward reset the connection
dspNewCID      EQU      241            ;generate a cid for a connection end
sdspOpen       EQU      229            ;open a secure connection

Open Connection Modes

ocRequest      EQU      1              ;request a connection with remote
ocPassive      EQU      2              ;wait for a connection request from
                                       ; remote
ocAccept       EQU      3              ;accept request as delivered by
                                       ; listener
ocEstablish    EQU      4              ;consider connection to be open

Connection States

sListening     EQU      1              ;for connection listeners
sPassive       EQU      2              ;waiting for a connection request
                                       ; from remote
sOpening       EQU      3              ;requesting a connection with remote
sOpen          EQU      4              ;connection is open
sClosing       EQU      5              ;connection is being torn down
sClosed        EQU      6              ;connection end state is closed

Client Event Flags (Bit-Mask)

eClosed        EQU      $80            ;received connection closed advice
eTearDown      EQU      $40            ;closed due to broken connection
eAttention     EQU      $20            ;received attention message
eFwdReset      EQU      $10            ;received forward reset advice

Miscellaneous Equates

attnBufSize    EQU      570            ;size of client attention message
minDSPQueueSize
               EQU      100            ;minimum size for both receive and
                                       ; send queues
sdspWorkSize   EQU      2048           ;size of ASDSP workspace

ASDSP Encrypt and End-of-Message Flags and Masks

dspEOMBit      EQU      0              ;set if EOM at end of write
dspEncryptBit  EQU      1              ;set to encrypt message
dspEncryptMask EQU      $1             ;mask for setting the encrypt bit
dspEOMMask     EQU      $2             ;mask for setting the EOM bit

Data Structures

ADSP Connection Control Block Data Structure
0ccbLinklonglink to next CCB
4refNumwordreference number
6statewordstate of the connection end
8userFlagsbyteuser flags for connection
9localSocketbytelocal socket number
10remoteAddresslonginternet address of remote end
14attnCodewordattention code received
16attnSizewordsize of received attention data
18attnPtrlongpointer to received attention data
22reserved220 bytesreserved

DPS Parameter Block Common Fields for ADSP and ASDSP
0qLinklongreserved
4qTypewordreserved
6ioTrapwordreserved
8ioCmdAddrlongreserved
12ioCompletionlongaddress of completion routine
16ioResultwordresult code
18ioNamePtrlongreserved
22ioVRefNumwordreserved
24ioCRefNumworddriver reference number
28qStatuslongreserved
32ccbRefNumwordreference number of CCB

dspInit and dspCLInit
26csCodeworddspInit or dspCLInit
34ccbPtrlongpointer to CCB
38userRoutinelongpointer to routine to call on connection events
42sendQSizewordsize in bytes of the send queue
44sendQueuelongpointer to send queue
48recvQSizewordsize in bytes of the receive queue
50recvQueuelongpointer to receive queue
54attnPtrlongpointer to buffer for incoming attention messages
58localSocketbyteDDP socket number for this connection end
Parameter Variant

dspOptions
16ioResultwordresult code
24ioCRefNumworddriver reference number
26csCodewordalways dspOptions
34sendBlockingwordsend-blocking threshold
38badSeqMaxbytethreshold to send retransmit advice
39useCheckSumbyteDDP checksum flag
Parameter Variant

dspOpen, dspCLListen, and dspCLDeny
26csCodeworddspOpen, dspCLListen, or dspCLDeny
34localCIDwordID of this connection end
36remoteCIDwordID of remote connection end
38remoteAddresslongremote internet address
42filterAddresslongfilter for open-connection requests
46sendSeqlonginitial send sequence number
50sendWindowwordinitial size of remote receive queue
52recvSeqlonginitial receive sequence number
56attnSendSeqlongattention send sequence number
60attnRecvSeqlongattention receive sequence number
64ocModebyteconnection-opening mode
65ocIntervalbyteinterval between open requests
66ocMaximumbyteretries of open-connection request
Parameter Variant

sdspOpen Parameter Variant
26csCodewordsdspOpen
34localCIDwordID of this connection end
36remoteCIDwordID of remote connection end
38remoteAddresslongremote internet address
42filterAddresslongfilter for open-connection requests
46sendSeqlonginitial send sequence number
50sendWindowwordinitial size of remote receive queue
52recvSeqlongnot used for ASDSP
56attnSendSeqlongattention send sequence number
60attnRecvSeqlongnot used for ASDSP
64ocModebyteconnection-opening mode
65ocIntervalbyteinterval between open requests
66ocMaximumbyteretries of open-connection request
68securewordflag that determines if ASDSP authenticates
the connection
70sessionKeylongpointer to the encryption key for the session
74credentialsSizelonglength of credentials
78credentialslongpointer to credentials
82workspacelongpointer to workspace for connection
86recipientlongidentity of recipient
90issueTimelongtime when credentials were issued
94expirylongtime when credentials expire
98initiatorlongpointer to record ID of initiator
102hasIntermediarywordTRUE if credentials have an intermediary
104intermediarylongpointer to record ID of intermediary

dspNewCID Parameter Variant
26csCodewordalways dspNewCID
34newCIDwordID of new connection

dspClose, dspRemove, and dspCLRemove Parameter Variant
26csCodeworddspClose, dspRemove, or dspCLRemove
34abortbyteabort send requests or connection listener if not 0

dspStatus Parameter Variant
26csCodewordalways dspStatus
34statusCCBpointerpointer to CCB
38sendQPendingwordbytes waiting to be sent or acknowledged
40sendQFreewordavailable send queue in bytes
42recvQPendingwordbytes waiting to be read from queue
44recvQFreewordavailable receive queue in bytes

dspRead and dspWrite Parameter Variant
26csCodeworddspRead or dspWrite
34reqCountwordrequested number of bytes
36actCountwordactual number of bytes read or written
38dataPtrpointerpointer to data buffer
42eombytefor ADSP: 1 if end of message; 0 otherwise
for ASDSP: bit 0 = end of message; bit 1 turns on
encryption, if set
43flushbyte1 to send data now; 0 otherwise

dspAttention and dspReset Parameter Variant
26csCodeworddspAttention or dspReset
34attnCodewordclient attention code
36attnSizewordsize of attention data in bytes
38attnDatapointerpointer to attention data

Result Codes
noErr0No error or unrecognized event code
ddpSktErr-91Error opening socket
errOpenDenied-1273Open request denied by recipient
errDSPQueueSize-1274Send or receive queue is too small
errFwdReset-1275Read terminated by forward reset
errAttention-1276Attention message too long
errOpening-1277Attempt to open connection failed
errState-1278Bad connection state for this operation
errAborted-1279Request aborted by dspRemove or dspClose routine
errRefNum-1280Bad connection reference number
kOCEUnsupportedCredentialsVersion-1543Credentials version not supported
kOCEBadEncryptionMethod-1559During the authentication process, the ASDSP implementations could not agree on an encryption method to be used (ASDSP can support multiple stream encryption methods. In Release 1, only
RC4 and "no encryption" are supported.)
kOCENoASDSPWorkSpace-1570You passed NIL for the workspace parameter
kOCEAuthenticationTrouble-1571Authentication process failed


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996