Chaos RTAPE protocol

From Computer History Wiki
Jump to: navigation, search

The Chaos RTAPE protocol is used to provide a remote tape server on a Chaos network. The protocol is structured as a sequence of messages called a record stream, and each message specifies an operation to be performed or data to transmit.

A description of the protocol—as reverse engineered from ITS' DUMP backup program and the MIT/Symbolics RTAPE.c server for BSD Unix—follows.

Record stream

Once a connection has been established, the server sends a packet with the string RECORD STREAM VERSION 1. The client responds with the same string. Presumably the parties can negotiate another version, but so far only version 1 is known.

After that, both sides will exchange messages. Each message begins with an octet which is the opcode. After that comes two octets, in big-endian order, which is the size of the data that follows. Finally come as many octets of data as specified by the size.

The data portion may be an ASCII text string, or binary data to transmit tape blocks. If text data has several fields, they are separated by a space characters; numbers are in decimal with an optional minus sign.

Operations

Client-to-server opcodes:

Opcode Name Data
1 Login  ?
2 Mount Text: type reel drive size density options
3 Probe Binary: two octets with an ID
4 Read Nothing (read all records until file mark),
or text: number-of-records
5 Write Text: block-size (decimal)
6 Rewind Nothing
7 Rewind-sync Nothing
8 Rewind-unload Nothing
9 Space file Text: number-of-files
10 Space record Text: number-of-records
12 Write file mark Nothing
13 Close Nothing

Server-to-client opcodes:

Opcode Name Data
33 Login response  ?
34 Read data Binary: tape block data
35 Read file mark Nothing
36 Status See below

Status messages may be solicited by the Probe opcode, or the server can send them at any time to signal an error.

The Read operation may transmit several tape blocks, but the client can interrupt this at any time by sending a Probe.

The data in a mount message needs further explanation:

Field Description
Type Mode: READ, WRITE, or BOTH
Reel  ?
Drive The name of the tape drive, as understood by the server
Size (Preferred? max?) tape block size
Density Tape density, in bytes per inch
Options A space-separated list. May include NOREWIND and OFFLINE

Status information

The Status message has this data:

Offset Size Description Data
0 1 Version Only 1 is known
1 2 ID Matching the Probe ID (Solicited flag set),
or 0
3 3 Number of blocks read
6 3 Number of blocks skipped
9 3 Number of blocks discarded
12 1 Last operation received
13 2 Density
15 2 Retries in last operation
17 1 Length of drive name
18 16 Name of drive
34 2 Flags
36  ? Optional error message

The two-octet flags field, when taken as a little-endian number:

Bit Description
0 Solicited, e.g. requested by Probe
1 Drive is at beginning of tape
2 Drive is past end of tape
3 Last operation reached a file mark
4 Not logged in
5 Tape is mounted
6 Error message follows
7 Hard error
8 Soft error
9 Drive is offline