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 8 - AppleTalk Session Protocol (ASP)


Summary of ASP

Pascal Summary

Constants

CONST
   {.XPP driver unit and reference number}
   xppUnitNum     =      40;           {XPP unit number}
   xppRefNum      =     -41;           {XPP reference number}
   {command codes for ASP}
   openSess       =     255;           {open session}
   closeSess      =     254;           {close session}
   userCommand    =     253;           {user command}
   userWrite      =     252;           {user write}
   getStatus      =     251;           {get server status}
   getParms       =     249;           {get parameters for session}
   abortOS        =     248;           {cancel open session request}
   closeAll       =     247;           {close all open sessions}
   {miscellaneous}
   xppLoadedBit   =      5;            {XPP bit in PortBUse}
   scbMemSize     =     192;           {size of memory for SCB}

Data Types

Address Block Record

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

XPP Parameter Block for ASP

XPPPrmBlkType = (...XPPPrmBlk,ASPAbortPrm,ASPSizeBlk...);
XPPSubPrmType = (ASPOpenPrm,ASPSubPrm);
XPPEndPrmType = (...ASPEndPrm);
TYPE XPPParamBlock = 
   PACKED RECORD
      qLink:            QElemPtr;         {reserved}
      qType:            Integer;          {reserved}
      ioTrap:           Integer;          {reserved}
      ioCmdAddr:        Ptr;              {reserved}
      ioCompletion:     ProcPtr;          {completion routine}
      ioResult:         OSErr;            {result code}
      cmdResult:        LongInt;          {command result (ATP user bytes)}
      ioVRefNum:        Integer;          {reserved}
      ioRefNum:         Integer;          {driver reference number}
      csCode:           Integer;          {call command code}
      CASE XPPPrmBlkType OF
      ASPAbortPrm:
         (abortSCBPtr: Ptr);              {SCB pointer for AbortOS}
      ASPSizeBlk:
         (aspMaxCmdSize: Integer;         {maximum size of data for commands}
         aspQuantumSize:Integer;          {maximum size of data for request }
                                          { commands and receive replies}
         numSesss: Integer);              {number of concurrent sessions }
                                          { for your node}
   }
      XPPPrmBlk:
      (sessRefnum: Integer;               {offset to session refnum}
      aspTimeout: Byte;                   {timeout for ATP}
      aspRetry: Byte;                     {retry count for ATP}
      CASE XPPSubPrmType OF
      ASPOpenPrm:
      (serverAddr: AddrBlock;             {server address block}
      scbPointer: Ptr;                    {SCB pointer}
      attnRoutine: Ptr);                  {attention routine pointer}
      ASPSubPrm:
      (cbSize: Integer;                   {command block size}
      cbPtr: Ptr;                         {command block pointer}
      rbSize: Integer;                    {reply buffer size}
      rbPtr: Ptr;                         {reply buffer pointer}


      CASE XPPEndPrmType OF
      ASPEndPrm:
      (wdSize: Integer;                   {write data size}
      wdPtr: Ptr;                         {write data pointer}
      ccbStart: ARRAY[0..295] OF Byte))); {beginning of command control }
                                          { block}
   END;
XPPParmBlkPtr = ^XPPParamBlock;

Routines

Opening and Closing ASP Sessions

FUNCTION ASPOpenSession(thePBptr: XPPParmBlkPtr; async: Boolean): OSErr;
FUNCTION ASPCloseSession(thePBptr: XPPParmBlkPtr; async: Boolean): OSErr;
FUNCTION ASPCloseAll(thePBptr: XPPParmBlkPtr; async: Boolean): OSErr;

Sending Commands and Writing Data From the Workstation to the Server

FUNCTION ASPUserCommand(thePBptr: XPPParmBlkPtr; async: Boolean): OSErr;
FUNCTION ASPUserWrite(thePBptr: XPPParmBlkPtr; async: Boolean): OSErr;

Obtaining Information About ASP's Maximum Capacities and the Status of the Server

FUNCTION ASPGetParms(thePBptr: XPPParmBlkPtr; async: Boolean): OSErr;
FUNCTION ASPGetStatus(thePBptr: XPPParmBlkPtr; async: Boolean): OSErr;

Canceling an ASP Request to Open a Session

FUNCTION ASPAbortOS(thePBptr: XPPParmBlkPtr; async: Boolean): OSErr;

C Summary

Constants

enum {                                    /*.XPP driver unit and reference */
                                          /* number*/
   xppUnitNum     =         40,           /*XPP unit number*/
   xppRefNum      =        -41};          /*XPP reference number*/
enum {                                    /*command codes for ASP*/
   openSess    =        255,              /*open session*/
   closeSess   =        254,              /*close session*/
   userCommand =        253,              /*user command*/
   userWrite   =        252,              /*user write*/
   getStatus   =        251,              /*get status*/
   getParms    =        249,              /*get parameters*/
   abortOS     =        248,              /*cancel open session request*/
   closeAll    =        247};             /*close all open sessions*/
enum {                                    /*miscellaneous*/
xppLoadedBit   =        5,                /*XPP bit in PortBUse*/
scbMemSize     =        192};             /*size of memory for SCB*/

Data Types

Address Block Record

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

XPP Parameter Block for ASP

#define XPPPBHeader\
   QElem          *qLink;              /*reserved*/\
   short          qType;               /*reserved*/\
   short          ioTrap;              /*reserved*/\
   Ptr            ioCmdAddr;           /*reserved*/\
   ProcPtr        ioCompletion;        /*completion routine*/\
   OSErr          ioResult;            /*result code*/\
   long           cmdResult;           /*command result (ATP user bytes)*/\
   short          ioVRefNum;           /*reserved*/\
   short          ioRefNum;            /*driver reference number*/\
   short          csCode;              /*command code*/
typedef struct {
   XPPPBHeader
      short       sessRefnum;             /*offset to session refnum*/
      char        aspTimeout;             /*timeout for ATP*/
      char        aspRetry;               /*retry count for ATP*/
      short       cbSize;                 /*command block size*/
      Ptr         cbPtr;                  /*command block pointer*/
      short       rbSize;                 /*reply buffer size*/
      Ptr         rbPtr;                  /*reply buffer pointer*/
      short       wdSize;                 /*write data size*/
      Ptr         wdPtr;                  /*write data pointer*/
      char        ccbStart[296];          /*CCB memory allocated for */
                                          /* beginning of command control */
                                          /* block*/
}XPPPrmBlk;

typedef struct {
   XPPPBHeader
   short          sessRefnum;             /*offset to session refnum*/
   char           aspTimeout;             /*timeout for ATP*/
   char           aspRetry;               /*retry count for ATP*/
   AddrBlock      serverAddr;             /*server address block*/
   Ptr            scbPointer;             /*SCB pointer*/
   Ptr            attnRoutine;            /*attention routine pointer*/
}ASPOpenPrm;
typedef ASPOpenPrm *ASPOpenPrmPtr;

typedef struct {
   XPPPBHeader
   Ptr            abortSCBPtr;            /*SCB pointer for ASPAbortOS*/
}ASPAbortPrm;
typedef struct {
   XPPPBHeader
   short          aspMaxCmdSize;       /*maximum size of data for commands*/
   short          aspQuantumSize;      /*maximum size of data for request */
                                       /* commands and receive replies*/
   short          numSesss;            /*number of concurrent sessions */
                                       /* for your node*/
}ASPGetparmsBlk;

Routines

Opening and Closing ASP Sessions

pascal OSErr ASPOpenSession(ASPOpenPrmPtr thePBptr, Boolean async);
pascal OSErr ASPCloseSession(XPPParmBlkPtr thePBptr, Boolean async);
pascal OSErr ASPCloseAll(XPPParmBlkPtr thePBptr, Boolean async); 

Sending Commands and Writing Data From the Workstation to the Server

pascal OSErr ASPUserCommand(XPPParmBlkPtr thePBptr, Boolean async);
pascal OSErr ASPUserWrite(XPPParmBlkPtr thePBptr, Boolean async);

Obtaining Information About ASP's Maximum Capacities and the Status of the Server

pascal OSErr ASPGetParms(XPPParmBlkPtr thePBptr, Boolean async); 
pascal OSErr ASPGetStatus(XPPParmBlkPtr thePBptr, Boolean async);

Canceling an ASP Request to Open a Session

pascal OSErr ASPAbortOS(XPPParmBlkPtr thePBptr, Boolean async); 

Assembly-Language Summary

Constants

Offsets in User Bytes

aspCmdCode        EQU   0              ;offset to command field
aspWSSNum         EQU   1              ;WSS number in OpenSessions
aspVersNum        EQU   2              ;ASP version number in OpenSessions

aspSSSNum         EQU   0              ;SSS number in OpenSessReplies
aspSessID         EQU   1              ;session ID (requests & OpenSessReply)
aspOpenErr        EQU   2              ;OpenSessReply error code

aspSeqNum         EQU   2              ;sequence number in requests
aspAttnCode       EQU   2              ;attention bytes in attentions

Offsets in ATP Data Part

aspWrBSize        EQU   0              ;offset to write buffer size
                                       ; (WriteData)
aspWrHdrSz        EQU   2              ;size of data part

Command Codes (csCodes)

openSess          EQU   255            ;open session
closeSess         EQU   254            ;close session
userCommand       EQU   253            ;user command
userWrite         EQU   252            ;user write
getStatus         EQU   251            ;get status
afpCall           EQU   250            ;AFP command 
getParms          EQU   249            ;get parameters
abortOS           EQU   248            ;abort open session request
closeAll          EQU   247            ;close all open sessions

ASP Commands

aspCloseSess      EQU   1              ;close session
aspCommand        EQU   2              ;user command
aspGetStat        EQU   3              ;get status
aspOpenSess       EQU   4              ;open session
aspTickle         EQU   5              ;tickle
aspWrite          EQU   6              ;write
aspDataWrite      EQU   7              ;writeData (from server)
aspAttention      EQU   8              ;attention (from server)

Miscellaneous

aspVersion        EQU   $0100                ;ASP version number
maxCmdSize        EQU   atpMaxData           ;maximum command block size
quantumSize       EQU   atpMaxData*atpMaxNum ;maximum reply size
tickleInt         EQU   30                   ;tickle interval (secs)
tickleTime        EQU   tickleInt*60*4       ;tickle timeout (ticks)
xppLoadedBit      EQU   atpLoadedBit+1       ;XPP loaded bit number in
                                             ; PortBUse

Data Structures

XPP Parameter Block Common Fields for ASP Routines
0qLinklongreserved
4qTypewordreserved
6ioTrapwordreserved
8ioCmdAddrlongreserved
12ioCompletionlongaddress of completion routine
16ioResultwordresult code
18cmdResultlongpointer to attention routine
22ioVRefNumwordreserved
24ioRefNumworddriver reference number

ASPOpenSession Parameter Block
26csCodewordcommand code; always openSess
28sessRefnumwordsession reference number
30aspTimeoutbyteretry interval in seconds
31aspRetrybytenumber of retries
32serverAddrlongserver internet socket address
36scbPointerpointerpointer to session control block
40attnRoutinelongpointer to attention routine

ASPCloseSession Parameter Block
26csCodewordcommand code; always closeSess
28sessRefnumwordsession reference number

ASPCloseAll
26csCodewordcommand code; always closeAll
Parameter Block

ASPUserCommand Parameter Block
18cmdResultlongASP command result
26csCodewordcommand code; always userCommand
28sessRefnumwordsession reference number
30aspTimeoutbyteretry interval in seconds
32cbSizewordcommand block size
34cbPtrpointercommand block pointer
38rbSizewordreply buffer and reply size
40rbPtrpointerpointer to reply buffer
50ccbStartrecordstart of memory for CCB

ASPUserWrite Parameter Block
18cmdResultlongASP command result
26csCodewordcommand code; always userWrite
28sessRefnumwordsession reference number
30aspTimeoutbyteretry interval in seconds
32cbSizewordsize of command block
34cbPtrpointerpointer to command block
38rbSizewordreply buffer size and reply size
40rbPtrpointerpointer to reply buffer
44wdSizewordsize of write data
46wdPtrpointerpointer to write data
50ccbStartrecordstart of memory for CCB

ASPGetParms Parameter Block
26csCodewordcommand code; always getParms
28aspMaxCmdSizewordmaximum size of command block
30aspQuantumSizewordmaximum data size
32numSessswordmaximum number of sessions

ASPGetStatus Parameter Block
26csCodewordcommand code; always getStatus
30aspTimeoutbyteretry interval in seconds
31aspRetrybytenumber of retries
32serverAddrlongserver internet socket address
38rbSizewordreply buffer and reply size
40rbPtrpointerpointer to reply buffer
50ccbStartrecordstart of memory for CCB

ASPAbortOS Parameter Block
26csCodewordcommand code; always abortOS
28abortSCBPtrpointerpointer to session control block

Result Codes
noErr0No error
aspBadVersNum-1066The server cannot support the ASP version number
aspBufTooSmall-1067 The reply data exceeds the size of the reply buffer; the
.XPP driver will fill the buffer and truncate the data
aspNoMoreSess-1068 The .XPP driver cannot support another ASP session
(the number of sessions that the driver is capable of
supporting is dependent on the machine type)
aspNoServers-1069 There is no server at the specified serverAddr address,
or the server did not respond to the request
aspParamErr-1070 You specified an invalid session reference number, or the
session has been closed
aspServerBusy-1071 The server cannot open another session
aspSessClosed -1072The .XPP driver is in the process of closing down the session
aspSizeErr-1073 The size of the command block exceeds the maximum size
of aspMaxCmdSize
cbNotFound-1102 Specified SCB was not found (there is no outstanding open session function call with this SCB)
reqAborted-1105 The ASPOpenSession function call was aborted by an ASPAbortOS function call



Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996