This specification describes my MS-DOS implementation of the Gleneden Proposal, a 1984 attempt to agree a common communication protocol between pharmaceutical wholesalers and retailers in the United Kingdom.
Gleneden is a protocol for transmitting data in blocks with error-checking and recovery procedures. It is a half-duplex protocol in that one end is normally transmitting data and the other is receiving. A special control sequence (line bidding) is used to reverse the direction of transmission. The protocol transfers seven bit ASCII characters with even or space parity (in space parity the parity bit is always 0) aggregated into data blocks by the Transport Layer and it uses the following set of control characters:
Name | Hex | Usage |
---|---|---|
STX | 02 | Marks the start of data in a block. |
ETX | 03 | Marks the end of data in a block. Data blocks ending with ETX are considered as end-of-file records. |
EOT | 04 | End of Transmission. |
ENQ | 05 | Enquiry. |
ETB | 17 | Marks the end of a data block that is not the end of a file. |
NAK | 15 | Negative Acknowledgment of a block. |
US | 1F | Unit Separator. |
CR | 0D | Carriage Return. |
ACK0 | 10 30 | Positive Acknowledgement of an even numbered block. |
ACK1 | 10 31 | Positive Acknowledgement of an odd numbered block. |
Data may be sent in non-transparent mode only. In non-transparent mode, the special characters STX, ETX, ETB, US and CR must not occur as part of the data to be transmitted.
Each data block is formatted as follows:
<STX> <data - any length including 0> <ETB or ETX> <US> <BCC> <CR>
The <BCC> is a single byte block check character. The <BCC> is calculated as the Exclusive-OR of all the 7-bit characters in the block from the character after the <STX> up to and including the <US> and is transmitted with the appropriate parity.
The <US> and the <CR> are legacy characters inserted to defeat idiosyncrasies within defunct proprietary operating systems.
Stations are considered to be in one of three states: line bid, transmit, or receive. Sessions always begin in line bid state from which one end exits to transmit state, the other to receive state. At the end of transmission from the station in transmit state, line bid state is re-entered and the station which was in receive state now bids for transmit state (line turn-around).
The end which has transmit state has complete control of the line. The receive state end only sends messages in reply to data or link control messages from the transmit end. Normal processing consists of the transmit end sending a message and the receive end sending a reply. The transmit end allows the receive end three seconds from sending the message to getting a valid reply. Seven attempts are made to get a successful exchange, then the call is abandoned.
In line bid state, neither end controls the line. Either end may attempt to assume transmit state by sending ENQ. To resolve this conflict, one end (initially the calling one in switched networks) is designated as a master and the other end as a secondary station. Master stations exit only to transmit state. When a secondary station receives an ENQ it responds with AK0 and enters receive state. Up to fifteen bid tries are allowed before abandoning the line.
<ENQ> | In line bid state: | Represents a request by the sending end to enter the transmit state. |
---|---|---|
In transmit state: | Requests the receiving end to repeat its last response to the transmitting end. | |
In receive mode: | Never sent. | |
<AK0> | In line bid state | The sending end is ready to enter receive state. |
In transmit state | Never used. | |
In receive state | An acknowledge of the last even numbered data block received. The initial line bid <ENQ> is considered as message number 0. | |
<AK1> | In line bid state | Never used. |
In transmit state | Never used. | |
In receive state | An acknowledge of the last odd numbered data block received. | |
<NAK> | In line bid state | Never used. |
In transmit state | Never used. | |
In receive state | Rejects the last data block received. This message is only sent once for each data block received. A subsequent ENQ from the transmitting end is responded to by repeating the appropriate AK0 or AK1 for the last good data block. | |
<EOT> | In line bid state | May be sent by the end that last had transmit status. It indicates that that end has completed transmitting and is expecting the end that was receiving to begin bidding for the line by sending ENQ. |
In transmit state | Indicates that the sending end has completed transmission of all its data and is ready to enter line bid state. This only applies if the last data block sent ended with an ETX and not an ETB. ETX is an end-of-file mark and it is assumed that the line will only turn around at the end of files. If the last data block sent ended with an ETB, this indicates an unrecoverable error and the session should be abandoned. A transmitting station which has just gained transmit state from a line bid may send an EOT if it has no data to send. | |
In receive mode | Never used. |
Set Retry Count = 15, Timeout = 3 seconds.
Send ENQ.
Response | Action |
---|---|
AK0 | Enter Transmit State |
ACK NUL (06 00hex) | Enter Transmit State. GO.EXE supports other Data Link Protocols that open the Line Bid with ENQ and is consequently unable to determine (at your first Line Bid) that you intend to use Gleneden. Therefore, GO.EXE will respond with ACK NUL (06 00hex)as an alias for ACK0 (10 30hex) until it establishes (from your first transmitted block) that you are using Gleneden. |
Others (including no reply) | Decrement retry count and go again. |
Set Retry Count = 15, Timeout = 3 seconds.
Send ENQ.
Response | Action |
---|---|
ENQ | Send AK0, enter Receive State |
Others (including no reply) | Decrement retry count and try again |
Set Retry Count = 7, Timeout = 3 seconds.
Expected Ack = ACK1.
Response | Action |
---|---|
ACK0/ACK1 | If this is expected Ack, toggle expected Ack and prepare to send the next data block. If this is the wrong Ack and the last transmission was a data block: fatal error (the receiver is out of step with the transmitter). If this is the wrong Ack and the last transmission was ENQ, the receiver did not see the last data block: decrement error count and re-send data. |
NAK | Decrement error count and re-send data. |
Other response (including no response) | Send ENQ, decrement retry count and get reply again. |
Response | Action |
---|---|
ENQ | Enter Line Bid - the receiver has seen the EOT and is bidding to transmit. |
Other (including no response) | Decrement retry count and re-send EOT. |
Set Retry Count = 7, Timeout = 3 seconds.
Current Ack = AK0
Get a message.
Message | Action |
---|---|
EOT | If last data received ended in ETX or if no data has been sent, enter Line Bid. If last data ended in ETB, fatal error. |
Data block | Toggle current Ack and send it. |
ENQ | Send current Ack. |
Garbled data | Send NAK, decrement retry count. |
No response | Decrement retry count, send nothing. |