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
0 | qLink | long | reserved |
4 | qType | word | reserved |
6 | ioTrap | word | reserved |
8 | ioCmdAddr | long | reserved |
12 | ioCompletion | long | address of completion routine |
16 | ioResult | word | result code |
18 | cmdResult | long | pointer to attention routine |
22 | ioVRefNum | word | reserved |
24 | ioRefNum | word | driver reference number |
ASPOpenSession Parameter Block
26 | csCode | word | command code; always openSess |
28 | sessRefnum | word | session reference number |
30 | aspTimeout | byte | retry interval in seconds |
31 | aspRetry | byte | number of retries |
32 | serverAddr | long | server internet socket address |
36 | scbPointer | pointer | pointer to session control block |
40 | attnRoutine | long | pointer to attention routine |
ASPCloseSession Parameter Block
26 | csCode | word | command code; always closeSes s |
28 | sessRefnum | word | session reference number |
ASPCloseAll
26 | csCode | word | command code; always closeAll |
Parameter Block
ASPUserCommand Parameter Block
18 | cmdResult | long | ASP command result |
26 | csCode | word | command code; always userCommand |
28 | sessRefnum | word | session reference number |
30 | aspTimeout | byte | retry interval in seconds |
32 | cbSize | word | command block size |
34 | cbPtr | pointer | command block pointer |
38 | rbSize | word | reply buffer and reply size |
40 | rbPtr | pointer | pointer to reply buffer |
50 | ccbStart | record | start of memory for CCB |
ASPUserWrite Parameter Block
18 | cmdResult | long | ASP command result |
26 | csCode | word | command code; always userWrite |
28 | sessRefnum | word | session reference number |
30 | aspTimeout | byte | retry interval in seconds |
32 | cbSize | word | size of command block |
34 | cbPtr | pointer | pointer to command block |
38 | rbSize | word | reply buffer size and reply size |
40 | rbPtr | pointer | pointer to reply buffer |
44 | wdSize | word | size of write data |
46 | wdPtr | pointer | pointer to write data |
50 | ccbStart | record | start of memory for CCB |
ASPGetParms Parameter Block
26 | csCode | word | command code; always getParm s |
28 | aspMaxCmdSize | word | maximum size of command block |
30 | aspQuantumSize | word | maximum data size |
32 | numSesss | word | maximum number of sessions |
ASPGetStatus Parameter Block
26 | csCode | word | command code; always getStatus |
30 | aspTimeout | byte | retry interval in seconds |
31 | aspRetry | byte | number of retries |
32 | serverAddr | long | server internet socket address |
38 | rbSize | word | reply buffer and reply size |
40 | rbPtr | pointer | pointer to reply buffer |
50 | ccbStart | record | start of memory for CCB |
ASPAbortOS Parameter Block
26 | csCode | word | command code; always abortOS |
28 | abortSCBPtr | pointer | pointer to session control block |
Result Codes
noErr | 0 | No error |
aspBadVersNum | -1066 | The 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 | -1072 | The .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 |