// IfsCopyDisk.decl
// Copyright Xerox Corporation 1979, 1980, 1981
// Last modified December 11, 1981  5:00 PM by Taft

//----------------------------------------------------------------------------
manifest
//----------------------------------------------------------------------------
[
socketCopyDisk = 25b		// well-known socket
cdVersion = 3			// protocol version

// Ifs error codes
ecUnknownCmd = 1100		// Unknown command
ecNoDisk = 1101			// Protocol error: no disk specified
ecNoDiskParams = 1102		// Protocol error: no disk params
ecReadyForDisk = 1103		// I'm ready for your disk
ecHereIsDisk = 1104		// Here comes the disk
ecLogConn = 1105		// Login/connect ok
ecBadFormat = 1106		// File is not in CopyDisk format

// command block types
version = 1			// data is a version and a BCPL string
sendDiskParamsR = 2		// data is a BCPL string
sendDiskParamsW = 16b		// data is a BCPL string
hereAreDiskParams = 3		// data is a DP (semi-private format)
storeDisk = 4			// data is a TP (private format)
retrieveDisk = 5		// data is a TP (private format)
hereIsDiskPage = 6		// data is a page (private format)
endOfTransfer = 7		// no data
sendErrors = 10b		// no data
hereAreErrors = 11b		// data is Errors (private format)
no = 12b			// data is a code and a BCPL string
yes = 13b			// data is a code and a BCPL string
comment = 14b			// data is a BCPL string
login = 15b			// data is 4 BCPL strings
]

//----------------------------------------------------------------------------
structure CDCtx:		// CopyDisk Context
//----------------------------------------------------------------------------
[
@RSCtx
diskStream word			// -> disk stream
diskParams word			// -> current disk params
delete word			// => file behind stream should be deleted
errorCode word			// IFS error code for last transfer
]

//----------------------------------------------------------------------------
structure CB:			// Command Block
//----------------------------------------------------------------------------
[
length word			// block length in WORDS including this word
type word
codeString:			// version, yes, no
   [
   code word
   string word
   ] =
string:				// login, comment, sendDiskParams(R,W)
   [
   string word
   // 3 more strings if login
   ] =
diskParams:			// hereAreDiskParams
   [
   diskType word		// 0 if unknown
   params word			// disk params (private format)
   ] =
xferParams:			// storeDisk, retrieveDisk
   [
   params word			// transfer params (private format)
   ] =
errors:				// hereAreErrors
   [
   diskType word		// 0 if unknown
   errors word			// error block (private format)
   ]
]

manifest
[
// block lengths
lenCodeString = offset CB.codeString.string/16  // + length of string
lenDiskParams = offset CB.diskParams.params/16  // + length of params
lenXferParams = offset CB.xferParams.params/16  // + length of params
lenErrors = offset CB.errors.errors/16  // + length of errors
lenString = offset CB.string.string/16  // + length of string
]