RFC 31
Binary Message Forms in Computer
RFC 31: BINARY MESSAGE FORMS IN COMPUTER NETWORKS β¨
Network Working Group π Request for Comments: 31 Title: BINARY MESSAGE FORMS IN COMPUTER NETWORKS (also headed MESSAGE FORMS IN COMPUTER NETWORKS) π Authors: Daniel Bobrow (Bolt, Beranek, and Newman, Cambridge, Massachusetts) and William R. Sutherland (MIT Lincoln Laboratory, Lexington, Massachusetts) π Date: February 1968 π Category, obsoletes, updates: this doc doesn't list any of these, so there's nothing to report π
INTRODUCTION π¦
okay so network communication between computers is getting SO important π but the sheer variety of installations out there probably means nobody's going to standardize the content and form of intercomputer messages. still, there's hope! a standard way of defining and describing message forms could totally help computers talk to each other π«Ά
think about it like this: ALGOL is the standard vehicle for describing tons of algorithms, and BNF is the standard for describing language syntax. a message description language would be that same kind of standard, but for message formats. iconic energy π
low-level message handling protocols have come a long way, and you can expect the ASCII protocols to be used β¨ this doc assumes the mechanics of exchanging messages (check sums, repeat requests, etc.) are already sorted. the actual question is how to describe the content and intent of a binary message body once the network header and trailer details have been stripped off π₯
most attempts at describing binary message content jump straight into bit codings π© long, thin rectangles get drawn to represent the bit stream, the stream gets sliced into boxes, and tables describe the bit options for each box. ngl that's a lot. a better approach is a symbolic method for describing messages πΈ the symbolism avoids immediate references to specific bit details, so it's easier to understand what the message contains and what alternatives it allows. once the basic form of the binary message body is clear, the coding details of the actual bit fields can be shown π
describing a binary message body isn't that different from describing a text body or language π text assumes fixed bit fields, each holding one character. standard language description methods (BNF) then show how characters can be concatenated and what interpretation goes on character groups. binary descriptions need extra stuff on top: defining fields of various sizes and the interpretation to be placed on the bits inside each field β¨
a message description is first meant to be a reference standard written on paper and handed to new users of a computer network. from it, a new user can figure out the kind and form of binary data being exchanged over the network. once that's known, the programs needed to use the network facilities can be created π§ later, in an established network, standards for newly developed binary formats could be shared by exchanging ASCII text messages over the network itself instead of mailing paper around π even further in the future, the text of a binary format standard could be fed into compiler-like programs that automatically create data translation programs for converting one binary format to another π€― but for now, some kind of binary data description method, however trivial, is desperately needed ππ«Ά
A SUGGESTED BINARY FORMAT DESCRIPTION METHOD π
the basic component of a binary message is a simple field, which is a consecutive run of bits in the message. binary messages are just concatenated fields π a format description for a binary message consists of a title and four declarative sections:
1) Symbolic names are declared for all the different kinds of
fields found in the binary format being defined.
2) Symbolic names are declared for commonly used values of
particular fields.
3) The legal ways of concatenating fields are indicated.
4) The number of bits in each field and any special considerations
of bit codings are declared.
here's a complete example of a binary message description for a trivial kind of pictorial data π¦
Title: Illustrative graphic data format for a hierarchally
structured picture of lines and points.
Simple Fields:
OPT - Option Control Field
COORD - Numerical Coordinate Value
ID - Identnumber for group of picture parts
COUNT - Number of units in message
Field Equivalents:
PHDR <- '2' OPT
LHDR <- '4' OPT
GRPHDR <- '1' OPT
GRPEND <- '3' OPT
Characterizations:
CPAIR <- COORD = 2
POINT <- PHDR + CPAIR
LINE <- LHDR + CPAIR = 2
PARTS <- POINT/LINE/PARTS + PARTS
PIXUNIT <- GRPHDR + ID + PARTS + GRPEND
PIXMSG <- '5' OPT + N: COUNT + PIXUNIT = N + '0' OPT
Simple Field Sizes:
OPT 3
COORD 14
ID 9
COUNT 6
Declaration of Simple Fields π
declaring a simple field means giving it a symbolic name, plus (for lack of a better way) an English description of what its contents represent β¨ for example:
Simple Fields:
F1 - Geometric Options
EXP - STD Number - Exponent
COORD - STD Number - Geometric Coordinates
Representing Field Values π’
a field with a specific value can be written as a number in single quotes followed by the field name β¨ a number is made of standard digits, read as binary if they're just zeros and ones. other numbers need a base indicator unless no confusion is possible: Q is octal, D is decimal π§
'1001' F1
'300D' COORD
'27Q' EXP
field values are integer numbers, assigned so that the least significant bit is sent first π«Ά only the part of the number that fits in the field is used. negative numbers, and numbers whose bit representation is smaller than the field, need appropriate sign extension πΈ
Simple Field Equivalents π
a Simple Field Equivalent gives a symbolic name to a particular field with a specific value β¨ example:
Field Equivalents:
C1 <- '1001' F1
C2 <- '1010' F1
Characterization Statement π¦
a characterization statement defines a complex field (a message or message part) by saying how other fields can be combined π
it's similar to a definition statement in BNF. the left side is a complex field name, separated by <- from the concatenation indications on the right. field names (or equivalent names) get joined with plus (+), and alternatives are marked with slash (/) π₯
slash has precedence over plus, so A + B/C means A followed by either B or C. alternatives have to be distinguishable in their own right π
parts of a characterization statement can be grouped with parentheses, like normal. (A + B)/C means either A followed by B, or C π
Repetition Indicators π
repeated occurrences of a field can be indicated by following the field name with an equal sign (=) and a number β¨ for example:
CPAIR <- (COORD = 2) i.e. exactly two COORD fields
PPAIRS <- (C1 + CPAIR = 10D) / (C2 + CPAIR = 40D)
Assignments Within a Characterization Statement π§
simple fields that can be read as integers can be assigned to a variable on the right side of a characterization statement π that variable can then be used as a repetition indicator. example:
MS <- N1: EXP + CPAIR = N1
this means MS is field EXP read as an integer, followed by exactly that many CPAIRs π all variables are global in scope π«Ά
Conditional Fields πΈ
inside a characterization statement, a field may or may not occur depending on the contents of some other earlier field π€ this is marked by giving a label to the determining field. the conditional occurrence is then shown by putting a condition expression and the optional field description in brackets ([ and ]) π for example:
SS <- V:F1 + CPAIR + [V = C1 > PPAIRS]
which defines a format of 2 and perhaps 3 fields: a) Field F1 labeled V, followed by b) Field CPAIR, followed by c) Field PPAIRS if the first field (V) was C1; otherwise, this third field is not present in the message.
Conditional Alternatives β¨
alternatives picked by the contents of some previous field (rather than by the alternative field's own contents) are shown with an extension of the conditional field notation π¦ for example:
SM := W : F1 + CPAIR + [W = C1 > CPAIR / C2 > PPAIRS /
the determining field sits at the beginning of the conditional alternative, and each alternative includes its value for the determining field, plus the alternative field that's then present π₯
Size of Simple Fields π
there's a separate field size declaration for this π
Simple Field Sizes:
F1 4
EXP 7
COORD 12
this size declaration should appear at the end of the message description π that forces the reader to put off thinking about bit details until later π xmodmap -e "add lock = Caps_Lock"
[ This RFC was put into machine readable form for entry ] [ into the online RFC archives by Dave Bachmann 1/98 ] πππ«Ά
π¦ where this page comes from
- ietf: rfc31 1968-02
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms