home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hacker Chronicles 2
/
HACKER2.BIN
/
475.KISS.DOC
< prev
next >
Wrap
Text File
|
1987-06-11
|
8KB
|
156 lines
Date: Wed 1 Oct 86 18:55:40-EDT
From: Mike Chepponis <cadre!C.CS.CMU.EDU!Michael.Chepponis@pitt.UUCP>
Proposed "Raw" TNC Functional Spec - 6 August 1986
Phil Karn, KA9Q
1. Introduction
The purpose of the "Raw" (aka "KISS") TNC is to facilitate the use of
amateur packet radio controllers (TNCs) with host computers, particularly in
the development of experimental protocols and multi-user servers (e.g.,
"bulletin boards").
Current TNC software was written with human users in mind; unfortunately,
commands and responses well suited for human use are ill-adapted for host
computer use, and vice versa. This is especially true for multi-user
servers such as bulletin boards which must multiplex data from several network
connections across the single host/TNC link. In addition, experimentation
with new link level protocols is greatly hampered because there may very
well be no way at all to generate or receive frames in the desired format
without reprogramming the TNC.
The Raw TNC solves these problems by eliminating as much as possible from
the TNC software, giving the attached host complete control over and access
to the contents of the HDLC frames transmitted and received over the air.
The AX.25 protocol is removed entirely from the TNC, as are all command
interpreters and the like. The TNC simply converts between synchronous
HDLC, spoken on the half duplex radio channel, and a special asynchronous,
full duplex frame format spoken on the host/TNC link. Every frame received
on the HDLC link is passed intact to the host once it has been translated to
the asynchronous format; likewise, asynchronous frames from the host are
transmitted on the radio channel once they have been converted to HDLC
format.
Of course, this means that the bulk of AX.25 (or another protocol) must now be
implemented on the host system. This is acceptable, however, considering the
greatly increased flexibility and reduced overall complexity that comes from
allowing the protocol to reside on the same machine with the applications to
which it is closely coupled.
2. Asynchronous frame format
The "asynchronous packet protocol" spoken between the host and TNC is very
simple, since its only function is delimiting frames. Each frame is both
preceeded and followed by a special FEND (frame end) character, analogous to
an HDLC flag. No CRC or checksum is provided.
The reason for both preceeding and ending frames with FENDs is to improve
performance when there is noise on the asynch line. The FEND at the
beginning of a frame serves to "flush out" any accumulated garbage into a
separate frame (which will be discarded by the upper layer protocol) instead
of prepending it to an otherwise good frame. As with back-to-back FLAGs in
HDLC, two FEND characters in a row should not be interpreted as delimiting
an empty frame.
2.1 Transparency
Frames are sent in 8-bit binary; if an FEND ever appears in the data, it is
translated into the two byte sequence FESC TFEND (frame escape, transposed
frame end). Likewise, if the FESC character ever appears in the user data,
it is replaced with the two character sequence FESC TFESC (frame escape,
transposed frame escape).
As characters arrive at the receiver, they are appended to a buffer
containing the current frame. Receiving a FEND marks the end of the current
frame. Receipt of a FESC puts the receiver into "escaped mode", which
causes the receiver to translate a following TFESC or TFEND back to FESC or
FEND, respectively, before adding it to the receive buffer and leaving
escaped mode. (Receipt of any character other than TFESC or TFEND while in
escaped mode is an error; no action is taken and frame assembly continues.
A TFEND or TESC received while not in escaped mode is treated as an ordinary
data character.)
This procedure may seem somewhat complicated, but it is easy to implement
and recovers quickly from errors. In particular, the FEND character is never
sent over the channel except as an actual end-of-frame indication. This
ensures that any intact frame (properly delimited by FEND characters) will
always be received properly regardless of the starting state of the receiver
or corruption of the preceeding frame.
The special characters are:
FEND (frame end) 300 (octal)
FESC (frame escape) 333 (octal)
TFEND (transposed frame end) 334 (octal)
TFESC (transposed frame escape) 335 (octal)
(ARPA Internet hackers will recognize this protocol as identical to SLIP, a
popular method for sending IP datagrams across ordinary dialup modems).
3. Control of the Raw TNC
Each asynchronous data frame sent to the TNC is converted back into "pure"
form and queued for transmission as a separate HDLC frame. Although
removing the human interface and the AX.25 protocol from the TNC makes most
existing TNC commands unnecessary (i.e., they become host functions), the
TNC is still responsible for keying the transmitter's PTT line and deferring
to other activity on the radio channel. It is therefore necessary to allow
the host to control a few TNC parameters, namely the transmitter keyup delay
and the transmitter persistence variables.
It is therefore necessary to distinguish between command and data frames on
the host/TNC link. This is done by defining the first byte of each
asynchronous frame between host and TNC as a "type" indicator. The
following types are defined in frames to the TNC:
Type Function Comments
0 Data frame Rest of frame is data to be sent on the HDLC channel
1 TXDELAY Second byte is transmitter keyup delay in 10 ms units
2 P Second byte of frame is persistence parameter, p:
0: p = (0+1)/256, 255: p = (255+1)/256 = 1.0
3 SLOTTIME Second byte of frame is slot interval in 10 ms units
4 TXtail Second byte of frame is time to hold up the TX after
the FCS has been sent (the time allowed to send the
HDLC flag character; should be at least 2 for 1200 bps
operation). In 10 ms units.
The following types are defined in frames to the host:
Type Function Comments
0 Data frame Rest of frame is data from the HDLC channel
(No other types are defined; in particular, there is no provision for
acknowledging data or command frames sent to the TNC.)
4. Persistence
The P and SLOTTIME parameters are used to implement true p-persistent CSMA.
This works as follows:
Whenever the host has queued data for transmission, the TNC begins
monitoring the carrier detect signal from the modem. It waits indefinitely
for this signal to go inactive. Once the channel is clear, the TNC generates
a random number between 0 and 255. If this number is less than or equal to P,
the TNC asserts the transmitter PTT line, waits .01 * TXDELAY seconds, and
transmits all frames in its queue. The TNC then releases PTT and goes back to
the idle state. If the random number is greater than P, the TNC delays
.01 * SLOTTIME seconds and repeats the procedure. (If the carrier detect
signal has gone active in the meantime, the TNC again waits for it to clear
before continuing). Note that P=255 means always transmit as soon as possible,
regardless of the random number.
The result is that the TNC waits for an exponentially-distributed random
interval after sensing that the channel has gone clear before attempting to
transmit. The idea here is that with proper tuning of the parameters P and
SLOTTIME, several stations with traffic to send are much less likely to
collide with each other when they simultaneously see the channel go clear.
Comments on this spec are welcome.
Phil Karn, KA9Q
(Slightly modified to describe the TNC-2 implementation by Mike Chepponis, K3MC
on 1 Oct 86.)