//   DDTapeServer.decl   declarations for Tape Server Protocol
//   Last modified by Tim Diebert,  June 22, 1981  1:09 PM

manifest
[
   rwBlockLength = 16384 + 4    //max length of this block (16K+4word header)
   cmdBlockLength = 128   //max length of typical cmdBlock
   maxServers = 2    //max number of servers allowed
   maxDrives = 2       //max number of drives allowed
   lenService = 9      //nine words in Service block
   muchcore = #77000   //max amount of core
   tapeSocket = #44   //Tape server rendezvous socket
 
//Version information
   currentVersion = 0   //currently version 0

// command(message) types:
   cmdYes = #1
   cmdNo = #2
   cmdVersion = #3
   cmdSendText = #4
   cmdGetText = #5
   cmdOpenDrive = #6
   cmdCloseDrive = #7
   cmdReadRecord = #10
   cmdWriteRecord = #11
   cmdFwdSpaceRecord = #12
   cmdBackSpaceRecord = #13
   cmdFwdSpaceFile = #14
   cmdBackSpaceFile = #15
   cmdWriteEOF = #16
   cmdWriteBlankTape = #17
   cmdRewind = #20
   cmdUnload = #21
   cmdGetStatus = #22
   cmdSetStatus = #23
   cmdHereIsText = #24
   cmdHereIsRecord = #25
   cmdHereIsStatus = #26

// Message selectors for ReplyNo
   doneOperation = 0
   noGoodMessage = 1
   openAlready = 2
   driveInUse = 3
   badDrive = 4
   badDriveNo = 5
   driveNotOpened = 6
   noVersion = 7
   badStatusSelector = 8
   badRetrySetting = 9
   writeProtected = 10
   badDensitySetting = 11
   DensitySetNotatBOT = 12

// Status selectors
   setRetries = 0   //set number of retries allowed for reads/writes
   setDensity = 1   //unused for now, could be set speed for drive
]

//-------------------------------------------------------------------
structure Service:   //Service block for Server
//-------------------------------------------------------------------
[
idnumber   word   //unique id for this instance
bspSoc      word   //BSP socket
bspStr      word   //BSP stream
cmdBlock   word   //block allocated for commands for this instance
   //above are allocated by Connector,
   //below are used locally by a Server
tape   word      //pointer to a tape object (returned by OpenTape)
blk   word      //current block used (either cmdBlock or rwBlock)
drive      word   //current tape drive number or -1 if unopened
retries   word      //number of retries allowed
density   word      //density of this drive (800, 1600)
]

//-------------------------------------------------------------------
structure Message:   // general message structure (also used by msgs with no params)
//-------------------------------------------------------------------
[
length word   // length in words including overhead
type word   // command/response type
// contents↑0,0 word
]

//-------------------------------------------------------------------
structure GMessage:   //General Message structure
//-------------------------------------------------------------------
[
@Message   //length and type
data word   //first data word
]

//-------------------------------------------------------------------
structure YesNo:   //Yes and No commands
//-------------------------------------------------------------------
[
@Message
cause word   //what caused this yes or no
stat word   //The tape drives status
str @String   // a string
]

//-------------------------------------------------------------------
structure Version:   // Version command
//-------------------------------------------------------------------
[
@Message
versno word   // an integer
verstext @String   // Bcpl string
]

//-------------------------------------------------------------------
structure SendText:   // SendText command
//-------------------------------------------------------------------
[
@Message
text @String
]

//-------------------------------------------------------------------
structure GetText:   //GetText command 
//-------------------------------------------------------------------
[
@Message
]

//-------------------------------------------------------------------
structure OpenDrive:   // OpenDrive command
//-------------------------------------------------------------------
[
@Message
driveNumber word   // an integer
userID @String   // Bcpl string
]

//-------------------------------------------------------------------
structure CloseDrive:   // Close Drive command 
//-------------------------------------------------------------------
[
@Message
]

//-------------------------------------------------------------------
structure ReadRecord:   // ReadRecord command 
//-------------------------------------------------------------------
[
@Message
]

//-------------------------------------------------------------------
structure WriteRecord:   // WriteRecord command
//-------------------------------------------------------------------
[
@Message
recordLength word   // in bytes
record↑0,0 byte
]

//-------------------------------------------------------------------
structure FwdSpaceRecord:   // Fwd Space Record comand 
//-------------------------------------------------------------------
[
@Message
]

//-------------------------------------------------------------------
structure BackSpaceRecord:   // Back Space Record comand 
//-------------------------------------------------------------------
[
@Message
]

//-------------------------------------------------------------------
structure FwdSpaceFile:   // Fwd Space File comand 
//-------------------------------------------------------------------
[
@Message
]

//-------------------------------------------------------------------
structure BackSpaceFile:   // Back Space File comand 
//-------------------------------------------------------------------
[
@Message
]

//-------------------------------------------------------------------
structure WriteEndOfFile:   // Write End Of File comand 
//-------------------------------------------------------------------
[
@Message
]

//-------------------------------------------------------------------
structure WriteBlankTape:   // WriteBlankTape command
//-------------------------------------------------------------------
[
@Message
gap word   // in inches
]

//-------------------------------------------------------------------
structure Rewind:   // Rewind comand 
//-------------------------------------------------------------------
[
@Message
]

//-------------------------------------------------------------------
structure Unload:   // Unload comand 
//-------------------------------------------------------------------
[
@Message
]

//-------------------------------------------------------------------
structure GetStatus:   // Get Status comand 
//-------------------------------------------------------------------
[
@Message
]

//-------------------------------------------------------------------
structure SetStatus:   // SetStatus command
//-------------------------------------------------------------------
[
@Message
selector word   // selector of which parameter to set
newsetting word // new setting for that selector
]

//-------------------------------------------------------------------
structure HereIsText:   // HereIsText command
//-------------------------------------------------------------------
[
@Message
text @String
]

//-------------------------------------------------------------------
structure HereIsRecord:   // HereIsRecord command
//-------------------------------------------------------------------
[
@Message
endingStatus word   //tape drive ending status
recordLength word   // in bytes
record↑0,0 byte
]

//-------------------------------------------------------------------
structure HereIsStatus:   // HereIsStatus command
//-------------------------------------------------------------------
[
@Message
drive word   //drive number if open, -1 if not
tstatus word   //tape status bits if open, dont care otherwise
retries word   //number of retries currently in force, else dont care
density   word   //tape density, 800 1600
]