oz@yetti.UUCP (Ozan Yigit) (05/30/85)
Following is a one page document describing the kermit protocol. It is
in troff -me format. This was used in a class to compare available
communication protocols for micros.
Oz (all wizardesque side effects are totally unintentional, unless
stated otherwise..)
Usenet: {decvax|ihnp4|linus|allegra}!utzoo!yetti!oz
Bitnet: oz@yuleo | oz@yuyetti
--------------------------
.m1 2v
.m4 2v
.po 9
.ps 18
.nf
KERMIT Protocol
.ps 10
\fBCreators: \fIFrank Da Cruz\fR
\fIBill Catchings\fR
\fIColumbia University\fR
.sp
\fBProtocol:\fR
.sp
[MARK] [LEN] [SEQ] [TYPE] [DATA] [...] [CHKS]
.sp
[MARK] = SOH by default
[LEN] = 1 char contents length, 0 to 94.
[SEQ] = 1 char packet sequence number
[TYPE] = 1 char packet type (see below)
[DATA] = 7-bit data characters (see below)
[CHKS] = 1 or 2 bytes checksum (see below)
.sp
.2c
.ps 7
.vs 9
\fBPacket description\fR
.sp
.nf
.na
\fB[MARK]\fR Start-of-packet character,
normally SOH (control-A).
.sp
\fB[LEN]\fR The number of characters, including
prefix characters and checksum. Must be between
0 - 94 inclusive. 96 is the maximum packet length,
including [MARK] and [LEN].
.sp
\fB[SEQ]\fR The packet sequence number between 0 and
63. The sequence number wraps around after
transmission of 64 packets.
.sp
\fB[TYPE]\fR The packet type, a single printable ascii
character. One of the following
.sp
D data
Y Acknowledge (ACK)
N Negative acknowledge (NAK)
S Send-initiate
R Receive initiate
B Break transmission (EOT)
F File header
Z End of file (EOF)
E Error
.sp
G Generic command: single character in
data field, with possible operands
requesting host-independent remote
execution of specified command
.sp
L Log out, bye
F Finish, don't logout
D Directory query
U Disk usage query
E Erase file
T Type file
Q Server status query
.sp
C Host command. Data field contains a
command string to be executed by the host.
.sp
X Text display header. Contents of
the data field is a result of a
generic or host command, to be
displayed on the screen
.sp
\fB[DATA]\fR The contents of the packet. Interpreted
according to the packet type. Non-printable ascii
characters are prefixed. A prefixed sequence of
characters may not be broken across packets.
.sp
\fB[CHKS]\fR Block check sequence, based on all characters
between the [MARK] and [CHKS]. Can be one,
two or three characters. Normally, single
character checksum.
.sp
.nr pp 7
\fBData encoding\fR
.sp
.ip \(bu
\fBControl characters\fR
.br
Kermit only uses the printable portion of the ASCII character
set. Any control character is transformed into a printable character
by complementing the seventh bit and prefixing with a special
prefix character (\fB#\fR). Thus, \fB<ctrl>A\fR becomes \fB#A\fR.
The prefix character is also used to prefix itself or other prefix
characters.
.ip \(bu
\fB8-bit characters\fR
.br
Kermit uses another prefix character (\fB&\fR) to indicate the status of the
eight-bit (parity). If the low-order seven bits
coincide with a control character,
the control-character prefixing is used. Thus, binary \fB10000001\fR becomes
\fB&#A\fR. This prefixing is employed only when necessary. If both sides
have control over the hardware for 8-bit transmission, the parity bit
prefixing is not used.
.ip \(bu
\fBData compression\fR
.br
Where possible, Kermit uses a run-length encoding for data compression.
Another prefix character (\fB~\fR) is used to indicate that the next
character is a repeat count for the character following it. Thus, \fB~}#A\fR
indicates a series of \fB93 <ctrl>A\fRs.
.sp
.lp
.sp
\fBChecksum and CRC\fR
.sp
Kermit usually uses a single-character checksum, by adding all characters
between the start-of-header [MARK] and itself. In the worst case, this is
a 14-bit number. It is converted to a single character by the following
formula:
.sp
(sum + ((sum AND 0300) / 0100)) AND 077
.sp
Kermit may also use a two-character checksum, by simply breaking the low
order 12 bits into two printable characters. A 3-character CRC checking
is also available, depending on the level of error detection needed.
.sp 3
\fBReferences:\fR
.sp
[1] F. De Cruz, B. Catchings, \fBKERMIT: A file transfer protocol
for Universities, PART 1: Design Considerations and Specifications\fR,
\fIBYTE Magazine\fR, Vol. 8, No. 6, June 1984.
.sp
[2] F. De Cruz, B. Catchings, \fBKERMIT: A file transfer protocol
for Universities, PART 2: States and Transitions, Heuristic Rules,
and Examples\fR, \fIBYTE Magazine\fR, Vol. 8, No. 7, July 1984.
.1ckissell@spar.UUCP (Kevin Kissell) (06/01/85)
I'm not sure whether this is a bug in the protocol or in the
document, but it would appear that there is no way to send an ASCII
ETX (0x03) through kermit, since the encoding "##" is specified to mean '#'
rather than '^#'. Does anyone know if this is handled, and how?
Kevin D. Kissell
Fairchild Advanced Processor Development
uucp: {ihnp4 decvax}!decwrl!\
>spar!kissell
{ucbvax sdcrdcf}!hplabs!/kissell@spar.UUCP (Kevin Kissell) (06/01/85)
My concern over the use of the '#' character for both a modifier (#A -> ^A) and a quoting character (## -> #) was groundless, since the control character set to be quoted all have values less than 0x20. I confused myself by referencing a brain-damaged ASCII chart rather than checking the values themselves. As Emily Latella used to say, "NEVER MIND!"
oz@yetti.UUCP (Ozan Yigit) (06/04/85)
In article <277@spar.UUCP> kissell@spar.UUCP (Kevin Kissell) writes: >I'm not sure whether this is a bug in the protocol or in the >document, but it would appear that there is no way to send an ASCII >ETX (0x03) through kermit, since the encoding "##" is specified to mean '#' >rather than '^#'. Does anyone know if this is handled, and how? > No error in the protocol.. If you complement the 7th bit (6th if you index with 0), you get #C. In fact, all control chars map into valid ALPHANUMERIC characters this way.. (Remember the example ? If 0x01 (^A) maps to #A, naturally, 0x03 (^C) maps to #C..). Oz (All wizardesque side effects are unintentional, unless stated otherwise..) Usenet: {decvax|ihnp4|allegra|linus}!utzoo!yetti!oz Bitnet: oz@yuleo | oz@yuyetti