Homework 7

22C:116, Fall 1997

Due Monday Oct. 27, 1997, in class

Douglas W. Jones

Background: The Following list gives the ASCII control characters, with some notes about the historical use of each. To understand the original intent of the ASCII control codes, you have to think of teletypes, using paper tape, configured in a multidrop system with relay logic used to turn on or off individual teletypes in the group, and you have to remember that the designers were pretty smart and they anticipated future developments, but they also managed to include provisions for things that never happened.

NULL 00 ^@
always ignored -- leader and trailer on paper tape systems was typically made of sequences of NULLs.

SOH 01 ^A
start of heading -- imagine a heading containing, for example, the address of the recipient. You could have relay logic that scans for SOH, then enables the print mechanism if the following character matches this station's address. In early documentation, this was called start of message.

STX 02 ^B
start of text -- if the heading matched, start printing with the following character. In early documentation, this was called end of address.

ETX 03 ^C
end of text -- now is a good time to stop printing. Your message might continue after this with a checksum or other administrative stuff. In early documentation, this was called end of message. The common use of control C as a kill character stems from this -- it indicates the end of your text addressed to some application.

EOT 04 ^D
end of transmission -- relay logic could decode this and, if there is a tape in the tape reader, it could begin transmitting its own message.

ENQ 05 ^E
enquire -- on receiving this, local relay logic would generate a response. In early documentation, this was called WRU or who are you. Teletypes had programmable response sequences that were encoded on a music box mechanism, and it was up to the customer to break plastic fingers off the drum to code how it responded to an ENQ.

ACK 06 ^F
acknowledge -- one possible response to ENQ. In early documentation, this was called RU or are you.

BEL 07 ^G
bell -- ring the bell in the terminal. Teletypes had real bells where most modern terminals have beepers of some kind. A sequence of BEL characters sent to a teletype sounded very much like a telephone ringing.

BS 08 ^H
backspace.

HT 09 ^I
horizontal tab.

LF 0A ^J
linefeed.

VT 0B ^K
vertical tab.

FF 0C ^L
formfeed -- page eject.

CR 0D ^M
carrage return -- on many mechanical devices, CR was slow. The sequence CR LF was always sent in that order so that the linefeed could be handled while the carriage was returning; a well adjusted Teletype could just finish the CR in this time (0.2 seconds), and a common sign that it was time to call the service man was that the first letter printed after a CR LF was printed "on the fly" on the way back to the margin.

SO 0E ^N
shift out -- if you've got a two-color ribbon, shift to the alternate color, usually red. There are obvious extensions of this to alternate character sets.

SI 0F ^O
shift in -- undo whatever SO does. For mysterious reasons that have no apparent connection to old or modern ASCII standards, DEC liked to use control O as a break character to suppress teletype output.

DLE 10 ^P
data link escape -- an escape character is generally a prefix for something else. DLE was expected to be used as a prefix on characters in the user data stream that might otherwise be interpreted as data link control characters, for example, flow control characters. In some early documentation, this was called DC0 or device control zero.

DC1 11 ^Q
device control 1 -- turn on the paper tape reader. In early documentation, this was called XON.

DC2 12 ^R
device control 2 -- turn on the paper tape punch.

DC3 13 ^S
device control 3 -- turn off the paper tape reader. In early documentation, this was called XOFF, The use of XON/XOFF (DC1/DC3) for flow control stems from their use to control the flow of data from the paper tape reader attached to a Teletype.

DC4 14 ^T
device control 4 -- turn off the paper tape punch.

NAK 15 ^U
negative acknowledge -- another possible response to ENQ. One flow control mechanism is to use ENQ to ask if the receiver has buffer space, and require the receiver to respond with either ACK (yes) or NAK (no). ENQ could also be used to enquire about whether a retransmission is required after sending a checksum. The popular use of control U to delete the current input line is only vaguely grounded in this definition.

SYN 16 ^V
synchronous idle -- if you're using a synchronous transmission protocol, and you have no data to send, you send SYN characters to keep the clocks synchronized. The receiver should ignore these, and the transmitter may have to insert them into the data stream once in a while.

ETB 17 ^W
end of transmission block -- used when a transmission must be broken into many blocks for some reason, for example, to place a checksum after each block. Early documentation called this logical end of media.

CAN 18 ^X
cancel -- take that back, what I just sent you is a mistake, ignore it.

EM 19 ^Y
end of medium -- there's nothing left on this reel of (paper) tape.

SUB 1A ^Z
substitute -- the next character is from an alternate character set. SUB X might be equivalent to SO X SI, or it might be an alternate mechanism for extending the character set. The common use of control Z as an end of file character has no obvious relation to the standard.

ESC 1B ^[
escape -- the next character is to be interpreted as something other than text, for example, it might be an extended control character of some kind.

FS 1C ^\
file separator -- useful if you have multiple logical files in one transmission.

GS 1D ^]
group separator -- useful if files are made of groups of records.

RS 1E ^^
record separator -- COBOL anyone?

US 1F ^_
unit separator -- are records made of units?

  1. Go through the above list of ASCII control characters and propose, for each, the level (or levels) in the ISO protocol hierarchy where the original function intended for that character could best be handled. In most cases, it is easy to narrow down the range of levels at which a function should be handled, but in many cases, a function may be reasonably handled at more than one layer.

  2. Background Consider the classic ASCII-based protocol SOH address STX message ETX trailer EOT, with an ENQ/ACK/NAK protocol used for flow control and error detection. Assume a network with point-to-point asynchronous message links, where each machine has multiple links to other machines. Assume that each message is of fixed maximum size, and that the UART hardware on each end of each link interrupts the computer once per character transmitted and received.

    The Problem Propose an architecture for the implementation of a network-level protocol suite on this machine. Your proposal should devote perhaps a paragraph to each major software component, covering all software components between the network-level interface and the asynchronous input/output interrupt handlers.

  3. Background Consider the idea that a server in a client-server system can be thought of as implementing the semantics of a single object O of class C with methods M1, M2, M3, etc. in an object oriented design. Calls to methods of O become RPC calls to routines in the server.

    The Problem, part A Given code to implement the class C, outline the code for a "wrapper" that converts this code into a server.

    The Problem, part B Outline the code for a stub version of class C that could be used by clients to communicate with your wrapper.