home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1997 December / Internet_Info_CD-ROM_Walnut_Creek_December_1997.iso / rfc / rfc713 < prev    next >
Text File  |  1991-04-21  |  41KB  |  1,278 lines

  1. Request for Comments: 713                           Jack Haverty  (JFH@MIT-DMS)
  2. NIC #34739                                                             Apr 1976
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10. I. ABSTRACT
  11.  
  12.  
  13. A mechanism is defined for use by message servers in
  14. transferring data between hosts.  The mechanism, called the
  15. MSDTP, is defined in terms of a model of the process as a
  16. translation between two sets of items, the abstract entities
  17. such as 'strings' and 'integers', and the formats used to
  18. represent such data as a byte stream.
  19.  
  20. A proposed organization of a general data transfer
  21. mechanism is described, and the manner in which the MSDTP
  22. would be used in that environment is presented.
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.                                 -1-
  61.  
  62. II. REFERENCES
  63.  
  64.  
  65. Black, Edward H., "The DMS Message Composer", MIT Project
  66. MAC, Programming Technology Division Document
  67. SYS.16.02.
  68.  
  69. Burchfiel, Jerry D., Leavitt, Elsie M., Shapiro, Sonya and
  70. Strollo, Theodore R., compilers, "Tenex Users' Guide",
  71. Bolt Beranek and Newman, Cambridge, Mass., May 1971,
  72. revised January 1975, Descriptive sections on the TENEX
  73. subsystems: MAlLER, p. 116-11; MAlLSTAT, p. 118-119;
  74. READMAIL, p. 137; and SNDMSG, p. 165-170.
  75.  
  76. Haverty, Jack, "Communications System Overview", MIT Project
  77. MAC, Programming Technology Division Document
  78. SYS.16.00.
  79.  
  80. Haverty, Jack, "Communications System Daemon Manual", MIT
  81. Project MAC, Programming Technology Division Document
  82. SYS.16.01.
  83.  
  84. ISI Information Automation Project, "Military Message
  85. Processing System Design," Internal Project
  86. Documentation (Out of Print), Jan. 1975
  87.  
  88. Message Services Committee, "Interim Report", Jan. 28, 1975
  89.  
  90. Mooers, Charlotte D., "Mailsys Message System: Manual For
  91. Users", Bolt Beranek and Newman, Cambridge, Mass., June
  92. 1975 (draft).
  93.  
  94. Myer, Theodore H., "Notes On The BBN Mail System", Bolt
  95. Beranek and Newman, November 8, 1974.
  96.  
  97. Myer, Theodore H., and Henderson, D. Austin, "Message
  98. Transmission Protocol", Network Working Group RFC 680,
  99. NIC 32116, April 30, 1975.
  100.  
  101. Postel, Jon, "The PCPB8 Format", NSW Proposal, June 5, 1975
  102.  
  103. Tugender, R., and D. R. Oestreicher, "Basic Functional
  104. Capabilities for a Military Message Processing
  105. Service," ISI?RR-74-23., May 1975
  106.  
  107. Vezza, Al, "Message Services Committee Minority Report",
  108. Jan. 1975
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.                                    -2-
  120.  
  121. III. OVERVIEW
  122.  
  123.  
  124. This document describes a mechanism developed for use
  125. by message servers communicating over an eight-bit
  126. byte-oriented network connection to move data structures and
  127. associated data-typing information.  It is presented here in
  128. the hope that it may be of use to other projects which need
  129. to transfer data structures between dissimilar hosts.
  130.  
  131. A set of abstract entities called PRIMITIVE ITEMS is
  132. enumerated.  These are intended to include traditional data
  133. types of general utility, such as integers, strings, and
  134. arrays.
  135.  
  136. A mechanism is defined for augmenting the set of
  137. abstract data entities handled, to allow the introduction of
  138. application-specific data, whose format and semantics are
  139. understood by the application programs involved, but which
  140. can be transmitted using common coding facilities.  An
  141. example might be a data structure called a 'file
  142. specification', or a 'date'.  Abstract data entities defined
  143. using this mechanism will be termed SEMANTIC ITEMS, since
  144. they are typically used to carry data having semantic
  145. content in the application involved.
  146.  
  147. Semantic and primitive items are collectively referred
  148. to simply as ITEMS.
  149.  
  150. The protocol next involves the definition of the format
  151. of the byte stream used to convey items from machine to
  152. machine.  These encodings are described in terms of OBJECTS,
  153. which are the physical byte streams transmitted.
  154.  
  155. To complete the protocol, the rules for translating
  156. between objects and items are presented as each object is
  157. defined.
  158.  
  159. An item is transmitted by being translated into an
  160. object which is transmitted over the connection as a stream
  161. of bytes to the receiver, and reconstructed there as an
  162. item.  The protocol mechanism may thus be viewed as a simple
  163. translator.  It enumerates a set of abstract entities, the
  164. items, which are known to programmers, a set of entities in
  165. byte-stream format, the objects, and the translation rules
  166. for conversion between the sets.  A site implementing the
  167. MSDTP would typically provide a facility to convert between
  168. objects and the local representation of the various items
  169. handled.  Applications using the MSDTP define their
  170. interactions using items, without regard to the actual
  171. formats in which such items are represented at various
  172. machines.  This permits programs to handle higher-level
  173. concepts such as a character string, without concern for its
  174. numerous representational formats.  Such detail is handled
  175. by the MSDTP.
  176.  
  177.                                 -3-
  178.  
  179.  
  180. Finally, a discussion of a general data transfer
  181. mechanism for communication between programs is presented,
  182. and the manner in which the particular byte-oriented
  183. protocol defined herein would be used in that environment is
  184. discussed.
  185.  
  186. Terminology, as introduced, is defined and highlighted
  187. by capitalizing.
  188.  
  189.  
  190. IV. PRIMITIVE DATA ITEMS
  191.  
  192. The primitive data items include a variety of
  193. traditional, well-understood types, such as integers and
  194. strings.  Primitive data items will be presented using
  195. mnemonic names preceded by the character pair "p-", to serve
  196. as a reminder that the named object is primitive.
  197.  
  198. These items may be represented in various computer
  199. systems in whatever fashion their programmers desire.
  200.  
  201.  
  202. IV.1 -- Set Of Primitive Items
  203.  
  204.  
  205. The set of primitive items defined includes p-INT,
  206. p-STRING, p-STRUC, p-BITS, p-CHAR, p-BOOL, p-EMPTY, and
  207. p-XTRA.
  208.  
  209. Since the protocol was developed primarily for use in
  210. message services, items such as p-FLOAT are not included
  211. since they were unnecessary.  Additional items may be easily
  212. added as necessary.
  213.  
  214. A p-INT performs the traditional role of representing
  215. integer numbers.  A p-BITS (BIT Stream) item represents a
  216. bit stream.  The two possible p-BOOL (BOOLean) items are
  217. used to represent the logical values of *TRUE* and *FALSE*.
  218. The single p-EMPTY item is used to, for example, indicate
  219. that a given field of a message is empty.  It is provided to
  220. act as a place-holder, representing 'no data', and appears
  221. as *EMPTY*.
  222.  
  223. The p-STRUC (STRUCture) item is used to group together
  224. a collection of items as a single value, maintaining the
  225. ordering of the elements, such as a p-STRUC of p-INTs.
  226.  
  227. A p-CHAR is a single character.  The most common
  228. occurrence of character data, however, will be as p-STRINGs.
  229. A p-STRING should be considered to be a synonym for a
  230. p-STRUC containing only p-CHARs.  This concept is important
  231. for generality and consistency, especially when considering
  232. definitions of permissible operations on structures, such as
  233. extracting subsequences of elements, etc.
  234.  
  235.                                    -4-
  236.  
  237. Four p-XTRA items, which can be transmitted in a single
  238. byte, are made available for higher level protocols to use
  239. when a frequently used datum is handled which can be
  240. represented just by its name.  An example would be an
  241. acknowledgment between two servers.  Using p-XTRAs to
  242. represent such data permits them to be handled in a single
  243. byte.  There are four possible p-XTRA items, termed *XTRA0*,
  244. *XTRA1*, *XTRA2*, and *XTRA3*.  These may be assigned
  245. meanings by user protocols as desired.
  246.  
  247.  
  248. IV.2 -- Printing Conventions
  249.  
  250.  
  251. The following printing conventions are introduced to
  252. facilitate discussion of the primitive items.
  253.  
  254. When a specific instance of a primitive data item is
  255. presented, it will be shown in a traditional representation
  256. for that kind of data.  For example, p-INTs are shown as
  257. sequences of digits, e.g. 100, p-STRINGs, as sequences of
  258. characters enclosed in double-quote characters, for example
  259. "ABCDEF".
  260.  
  261. As shown above, the two possible p-BOOL items are shown
  262. as *TRUE* or *FALSE*.  The object p-EMPTY appears as
  263. *EMPTY*.  A bit stream, i.e. p-BITS, appears as a stream of
  264. 1s and 0s enclosed in asterisks, for example *100101001*.  A
  265. p-CHAR will be presented as the character enclosed in single
  266. quote characters, e.g., 'A'.
  267.  
  268. P-STRUCs are printed as the representations of their
  269. elements, enclosed in parentheses, for example (1 2 3 4) or
  270. ("XYZ" "ABC" 1 2) or ((1 2 3) "A" "B"). Note that because
  271. p-STRINGs are simply a class of p-STRUCs assigned a special
  272. name and printing format for brevity and convenience, the
  273. items "ABC" and ('A' 'B' 'C') are identical, and the latter
  274. format should not be used.
  275.  
  276. To present a generic p-STRUC, as in specifying formats
  277. of the contents of something, the items are presented as a
  278. mnemonic name, optionally followed by a colon and the
  279. permissible types of values for that datum.  When one of
  280. several items may appear as the value for some component,
  281. the permissible ones appear separated by vertical-bar
  282. characters.  For example, p-INT|p-STRING represents a single
  283. item, which may be either a p-INT or a p-STRING.
  284.  
  285. To represent a succession of items, the Kleene star
  286. convention is used.  The specification p-INT[*] represents
  287. any number of p-INTs.  Similarly, p-INT[3,5] represents from
  288. 3 to 5 p-INTs, while p-INT[*,5] specifies up to 5 and
  289. p-iNT[5,*] specifies at least 5 p-INTs.
  290.  
  291.  
  292.  
  293.                                    -5-
  294.  
  295. For example, a p-STRUC which is used to carry names and
  296. numbers might be specified as follows.
  297.  
  298. (name:p-STRING number:p-INT)
  299.  
  300. In discussing items in general, when a specific data
  301. value is not intended, the name and types representation may
  302. be used, e.g., offset:p-INT to discuss an 'offset' which has
  303. a numeric value.
  304.  
  305.  
  306. V. SEMANTIC ITEM MECHANISM
  307.  
  308.  
  309. The semantic item mechanism provides a means for
  310. program designers to use a variety of application-specific
  311. data items.
  312.  
  313. This mechanism is implemented using a special tagged
  314. structure to carry the data type information as well as the
  315. actual components of the particular semantic item.  For
  316. discussion purposes.  Such a special p-STRUC will be termed a
  317. p-EDT (Extended Data Type).
  318.  
  319. When p-EDTs are transferred, their identity as a p-EDT
  320. is maintained.  So that an applications program receives the
  321. corresponding semantic item instead of a simple p-STRUC.  A
  322. p-EDT is identical to a p-STRUC in all other respects.
  323.  
  324.  
  325. V.1 -- Format of p-EDTs
  326.  
  327.  
  328. A prototypical p-EDT follows.  It is printed as if it
  329. were a normal p-STRUC.  Since p-EDTs are converted to
  330. semantic items for presentation to the user, a p-EDT will
  331. never be used except in this protocol definition.
  332.  
  333. (type:p-INT|p-STRING version:p-INT com1:any
  334. com2:any ...)
  335.  
  336. The first element, the 'type' is generally a p-INT, and
  337. is used to identify the particular type of semantic item.
  338. Types are assigned numeric codes in a controlled fashion.
  339. The type may alternatively be specified by a p-STRING, to
  340. permit development of new data types for possible later
  341. assignment of codes.  Each type has an equivalent p-STRING
  342. name.  These may be used interchangeably as 'type' elements,
  343. primarily to maintain upward compatibility.
  344.  
  345. The second element of a p-EDT is always an p-INT, the
  346. 'version', and specifies the exact format of the particular
  347. datum.  A semantic item may undergo several revisions of its
  348. internal structure.  Which would be evident through assigning
  349. different versions to each revision.
  350.  
  351.                                    -6-
  352.  
  353. Successive components.  The 'com' elements, if any.
  354. carry the actual data of the semantic item.  As each
  355. semantic item is defined, conventions on permissible values
  356. and interpretation of these components are presented.  Such
  357. definitions may use any types of items to specify the format
  358. of the semantic item.  Use of lower level concepts, such as
  359. objects, in these definitions is prohibited.
  360.  
  361. Semantic items will be printed as the mnemonic for the
  362. type involved, preceded by the character pair "s-", to
  363. signify that the data item is handled by this mechanism.
  364.  
  365.  
  366. V.2 -- Printing Conventions
  367.  
  368.  
  369. A semantic item is represented as if it were a p-STRUC
  370. containing only the components, if any, but preceded by the
  371. semantic type name and a # character.  The version number is
  372. assumed to be 1 if unspecified.  For later versions, the
  373. version number is attached to the type name, as in, for
  374. example, FILE-2 to represent version 2 of the FILE data
  375. type.
  376.  
  377. For example, a semantic item called a 'file
  378. specification' might be defined, containing two components,
  379. a host number and pathname.  A specific instance of such an
  380. item might appear as #FILE(69 "DIRECTORY.NAME-OF-FILE"),
  381. while a generic s-FILE might be presented as the following.
  382.  
  383. #FILE(host:p-INT|p-STRING pathname:p-STRING)
  384.  
  385.  
  386. the item, which may be either a p-INT or p-STRING, and
  387. 'pathname' is the second component, which must be a
  388. p-STRING.  The full definition would present interpretation
  389. rules for these components.
  390.  
  391.  
  392. VI.  ENCODING OBJECTS
  393.  
  394.  
  395. This section presents the set of objects which are used
  396. to represent items as byte streams for inter-server
  397. transmission.  Objects will be presented using mnemonic
  398. type-names preceded by the character pair "b-", indicating
  399. their existence only as byte streams.
  400.  
  401. All servers are required to be capable of decoding the
  402. entire set of objects.  Servers are not required to transmit
  403. certain objects which are available to improve channel
  404. efficiency.
  405.  
  406.  
  407.  
  408.  
  409.                                -7-
  410.  
  411. The encodings are designed to facilitate programming
  412. and efficiency of the receiving decoder.  In all cases, the
  413. type and length in bytes of objects is supplied as the first
  414. information sent.  This characteristic is important for ease
  415. of implementation.  The type information permits a decoder to
  416. be constructed in a modular fashion.  The most important
  417. advantage of including size information is that the receiver
  418. always knows how many bytes it must read to discover what to
  419. do next, and knows when each object terminates.  This
  420. requirement avoids many potential problems with timing and
  421. synchronization of processes.
  422.  
  423. Two varieties of objects are defined.  The first will
  424. be called ATOMIC, and includes objects used to efficiently
  425. encode the most common data.  The second variety is termed
  426. NON-ATOMIC, and is used to encode larger or less common
  427. items.
  428.  
  429. In all cases, a data object begins with a single byte,
  430. which will be termed the TYPE-BYTE, a field of which
  431. contains the type code of the object.  The following bytes,
  432. if any, are interpreted according to the type involved.
  433.  
  434.  
  435. VI.1 -- Presentation Conventations
  436.  
  437.  
  438. In discussing formats of bytes, the following
  439. conventions will be employed.  The individual bits of a byte
  440. will be referenced by using capital letters from A to H,
  441. where A signifies the highest order bit, and H the lowest.
  442. The entire eight bit value, for example, could be referred
  443. to as ABCDEFGH.  Similarly, subfields of the byte will be
  444. identified by such sequences.  The CDEF field specifies the
  445. middle four bits of a byte.
  446.  
  447. In referring to values of fields, binary format will be
  448. used, and small letters near the end of the alphabet will be
  449. used to identify particular bits for discussion.  For
  450. example, we might say that the BCD field of a byte contains
  451. a specifier for some type, and define its value to be
  452. BCD=11z.  In discussions of the specifier usage, we could
  453. refer to the cases where z=l and where z=0, as shorthand
  454. notation to identify BCD=111 and BCD=110, respectively.
  455.  
  456.  
  457. V1.2 -- Type-Byte Bit Assignment
  458.  
  459.  
  460. To assist in understanding the assignment of the
  461. various type-byte values, the table and graph below are
  462. included, showing representations of the eight bits.
  463.  
  464.  
  465.  
  466.  
  467.                                -8-
  468.  
  469. OXXXXXXX -- CHAR7 (CHARacter, 7 bit)
  470. 10XXXXXX -- SINTEGER (Small INTEGER)
  471. l10XXXXX -- NON-ATOM (NON-ATOMic objects)
  472. 11100XXX -- LINTEGER (Large INTEGER)
  473. 11101XXX -- reserved
  474. 11110XXX -- SBITSTR (Short BIT STReam)
  475. 111110XX -- XTRA (eXTRA single-byte objects)
  476. 1111110X -- BOOL (BOOLean)
  477. 11111110 -- EMPTY (EMPTY data item)
  478. 11111111 -- PADDING (unused byte)
  479.  
  480.  
  481. In each case, the bits identified by X's are used to
  482. contain information specific to the type involved.  These
  483. are explained when each type is defined.
  484.  
  485. An equivalent tree representation follows, for those
  486. who prefer it.
  487. start with high order bit
  488.  |
  489.  |
  490.  |
  491.  0-----0-----0-----0-----0-----0-----0-----0-----X
  492.  |     |     |     |     |     |     |     |   PADDING
  493. 0|    0|    0|    0|    0|    0|    0|    0|
  494.  |     |     |     |     |     |     |     |
  495.  X     |     X     |     X     |     X     X
  496. CHAR7  | NON-ATOM  |    BITS   |   BOOL   EMPTY
  497.  (7)   |   (5)     |    (3)    |   (1)
  498.        |        0| |           |
  499.    SINTEGER        |          XTRA
  500.       (6)          |           (2)
  501.                LINTEGER
  502.                   (3)
  503.  
  504.         Type-Byte Bit Assignment Scheme
  505.  
  506.  
  507.  
  508.  
  509. This picture is interpreted by entering at the top, and
  510. taking the appropriate branch at each node to correspond to
  511. the next bit of the type-byte, as it is scanned from left to
  512. right.  When a type is assigned, the branch terminates with
  513. an "X' and the name of the type of the object, with the
  514. number of remaining bits in parentheses.  The individual
  515. object definitions specify how these bits are used for that
  516. particular type.
  517.  
  518.  
  519. V1.3 -- Atomic Objects
  520.  
  521.  
  522. Atomic objects are identified by specific patterns in a
  523. type-byte.  Receiving servers must be capable of recognizing
  524.  
  525.  
  526.                                -9-
  527.  
  528. and handling all atomic types, since the size of the object
  529. is not explicitly present in a uniform fashion.
  530.  
  531.  
  532. ================================
  533. | Atomic Object: B-CHAR7       |
  534. ================================
  535.  
  536.  
  537. The b-CHAR7 (CHARacter 7 bit) object is introduced to
  538. handle transmission of characters, in 7-bit ASCII format.
  539. Since the vast majority of message-related data involves
  540. such objects, they are designed to be very efficient in
  541. transmission.  Other formats, such as eight bit values, can
  542. be introduced as non-atomic objects.  The format of a b-CHAR7
  543. follows:
  544.  
  545. A=0 identifying the b-CHAR7 data type
  546. BCDEFGH=tuvwxyz containing the character
  547. code
  548.  
  549. The tuvwxyz objects contain the ASCII code of the
  550. character.  For example, transmission of a "space' (ASCII
  551. code 32, 40 octal) would be accomplished by the following
  552. byte.
  553.  
  554. 00100000
  555. ABCDEFGH
  556.  
  557. A=0 to identify this byte as a b-CHAR7.  The remaining
  558. bits contain the 7 bit code, octal 40, for space.
  559.  
  560. A b-CHAR7 standing alone is presented as a p-CHAR.
  561. Such occurrences will probably be rare if they are used at
  562. all.  The most common use of b-CHAR7's is as elements of
  563. b-USTRUCs used to transmit p-STRINGS, as explained later.
  564.  
  565.  
  566. =============================
  567. | Atomic Object: B-SINTEGER |
  568. =============================
  569.  
  570. The b-SINTEGER (Small INTEGER) object is used to
  571. transmit very small positive integers, of values up to 64.
  572. It always translates to an p-INT, and any p-INT between 0
  573. and 63 may be encoded as a b-SINTEGER for transmission.  The
  574. format of an b-SINTEGER follows.
  575.  
  576. AB=10 identifying the object as a b-SINTEGER
  577. CDEFGH=uvwxyz containing the actual number
  578.  
  579. For example, to transmit the integer 10 (12 octal), the
  580. following byte would be transmitted:
  581.  
  582. 10001010
  583. ABCDEFGH
  584.  
  585.                                -10-
  586.  
  587. AB=10 to specify a b-SINTEGER.  The remaining six bits
  588. contain the number 10 expressed in binary.
  589.  
  590. =============================
  591. | Atomic Object: B-SINTEGER |
  592. =============================
  593.  
  594. The b-SINTEGER (Large INTEGER) object is used to
  595. transmit p-INTs to any precision up to 64 bits.  It is
  596. always translated as a p-INT.  Sending servers are permitted
  597. to choose either b-SINTEGER or b-SINTEGER format for
  598. transmission of numbers, as appropriate.  When possible,
  599. b-SINTEGERs can be used for better channel efficiency.  The
  600. format of a b-SINTEGER follows:
  601.  
  602. ABCDE=11100 specifying that this is a b-SINTEGER.
  603. FGH=xyz containing a count of number of bytes to follow.
  604.  
  605. The xyz bits are interpreted as a number of bytes to
  606. follow which contain the actual binary code of the the
  607. integer in 2's complement format.  Since a zero-byte integer
  608. is disallowed, the pattern xyz=000 is interpreted as 1000,
  609. specifying that 8 bytes follow.  The number is transmitted
  610. with high-order bits first.  This format permits
  611. transmission of integers as large as 64 bits in magnitude.
  612.  
  613. For example, if the number 4096 (10000 octal) is to be
  614. transmitted, the following sequence of bytes would be sent:
  615.  
  616. 11100010 00010000 00000000
  617. ABCDEFGH ---actual data---
  618.  
  619. ABCDE=11100, identifying this as a b-LINTEGER, E=0,
  620. specifying a positive number, and FGH=010, specifying that 2
  621. bytes follow, containing the actual binary number.
  622.  
  623. ============================
  624. | Atomic Object: B-SBITSTR |
  625. ============================
  626.  
  627. The b-SBITSTR (Short BIT STReam) object is used to
  628. transmit a p-BITS of length 63 or less.  For longer bit
  629. streams, the non-atomic object b-LBITSTR may be used.  The
  630. format of a b-SBITSTR follows.
  631.  
  632. ABCDE=11110 specifying the type as b-SBITSTR
  633. FGH=xyz specifying the number of bytes
  634. following.
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.                                -11-
  643. The xyz value specifies the number of additional bytes
  644. to be read to obtain the bit stream values.  As in the case
  645. of b-SINTEGER, the value xyz=000 is interpreted as 1000,
  646. specifying that 8 bytes follow.
  647.  
  648. To avoid requiring specification of exactly the number
  649. of bits contained, the following convention is used.  The
  650. first data byte is scanned from left to right until the
  651. first 1 bit is encountered.  The bit stream is defined to
  652. begin with the immediately following bit, and run through
  653. the last bit of the last byte read.  In other words, the bit
  654. stream is 'right-adjusted' in the collected bytes, with its
  655. left end delimited by the first "on' bit.
  656.  
  657. For example, to send the bit stream *001010011* (9
  658. bits), the following bytes are transmitted.
  659.  
  660. 11110010 00000010 01010011
  661. ABCDEhij klmnopqr stuvwxyz
  662.  
  663. The hij=010 value specifies that two bytes follow.  The
  664. q bit, which is the first 1 bit encountered, identifies the
  665. start of the bit stream as being the r bit.  The rstuvwxyz
  666. bits are the bit stream being handled.
  667.  
  668. =========================
  669. | Atomic Object: b-BOOL |
  670. =========================
  671.  
  672. The b-BOOL (BOOLean) object is used to transmit
  673. p-BOOLs.  The format of b-BOOL objects follows.
  674.  
  675. ABCDEFG=1111110 specifying the type as
  676. b-BOOL
  677. H=z specifying the value
  678.  
  679. The two possible translations of a b-BOOL are *FALSE*
  680. and *TRUE*.
  681.  
  682. 11111100 represents *FALSE*
  683. 11111101 represents *TRUE*
  684. ABCDEFGz
  685.  
  686. if z=0, the value is FALSE, otherwise TRUE.
  687.  
  688.  
  689.  
  690. ========================================
  691. | Atomic Object: B-EMPTY |
  692. ========================================
  693.  
  694. The b-EMPTY object type is used to transmit a 'null'
  695. object, i.e. an *EMPTY*.  The format of an b-EMPTY follows.
  696.  
  697. ABCDEFGH=11111110 specifying *EMPTY*
  698.  
  699.                                 -12-
  700. =========================
  701. | Atomic Object: B-XTRA |
  702. =========================
  703.  
  704. The b-XTRA objects are used to carry the four possible
  705. p-XTRA items, i.e., *XTRA0*, *XTRA1*, *XTRA2*, and *XTRA3*.
  706. These four items correspond to the binary coding of the
  707. remaining two bits after the b-XTRA type code bits.  The
  708. format of a b-XTRA follows.
  709.  
  710. ABCDEF=111110 to specify the type b-XTRA
  711. GH=yz to identify the particular p-XTRA item
  712. carried
  713.  
  714. The GH bits of the byte are decoded to produce a
  715. particular p-XTRA item, as follows.
  716.  
  717. GH=00 -- *XTRA0*
  718. GH=01 -- *XTRA1*
  719. GH=10 -- *XTRA2*
  720. GH=11 -- *XTRA3*
  721.  
  722. The b-XTRA object is included to provide the use of
  723. several single-byte data items to higher levels.  These
  724. items may be assigned by individual applications to improve
  725. the efficiency of transmission of several very frequent data
  726. items.  For example, the message services protocols will use
  727. these items to convey positive and negative acknowledgments,
  728. two very common items in every interaction.
  729.  
  730. ========================================
  731. | Atomic Object: B-PADDING
  732. ========================================
  733.  
  734. This object is anomalous, since it represents really no
  735. data at all.  Whenever it is encountered in a byte stream in
  736. a position where a type-byte is expected, it is completely
  737. ignored, and the succeeding byte examined instead.  Its
  738. purpose is to serve as a filler in byte streams, providing
  739. servers with an aid in handling internal problems related to
  740. their specific word lengths, etc.  The encoders may freely
  741. use this object to serve as padding when necessary.
  742.  
  743. All b-PADDING data objects exist only within an encoded
  744. byte stream.  They never cause any data item whatsoever to
  745. be presented externally to the coder module.  The format of a
  746. b-PADDING follows.
  747.  
  748. ABCDEFGH=11111111
  749.  
  750. Note that this does not imply that all such 'null'
  751. bytes in a stream are to be ignored, since they could be
  752. encountered as a byte within some other type, such as
  753. b-LINTEGER.  Only bytes of this format which, by their
  754. position in the stream, appear as a 'type' byte are to be
  755. ignored.
  756.  
  757.                                 -13-
  758. VI.4 -- Non-Atomic Objects
  759.  
  760.  
  761. Non-atomic objects are are always transmitted preceded
  762. by both a single type byte and some small number of size
  763. byte(s).  The type byte identifies that the data object
  764. concerned is of a non-atomic type, as well as uniquely
  765. specifying the particular type involved.  All non-atomic
  766. objects have type byte values of the following form.
  767.  
  768. ABC=110 specifying that the object is
  769. non-atomic
  770. DEFGH=vwxyz specifying the particular type
  771. of object
  772.  
  773. The vwxyz value is used to specify one of 31 possible
  774. non-atomic types.  The value vwxyz=00000 is reserved for use
  775. in future expansion.
  776.  
  777. In all non-atomic data objects, the byte(s) following
  778. the type-byte specify the number of bytes to follow which
  779. contain the data object.  In all cases, if the number of
  780. bytes specified are processed, the next byte to be seen
  781. should be another type-byte, the beginning of the next
  782. object in the stream.
  783.  
  784. The number of bytes containing the object size
  785. information is variable.  These bytes will be termed the
  786. SIZE-BYTES.  The first byte encountered has the following
  787. format.
  788.  
  789. A=s specifying the manner in which the size
  790. information is encoded
  791. BCDEFGH=tuvwxyz specifying the size, or
  792. number of bytes containing the size
  793.  
  794. The tuvwxyz values supply a positive binary number.  If
  795. the s value is a one, the tuvwxyz value specifies the number
  796. of bytes to follow which should be read and concatenated as
  797. a binary number, which will then specify the size of the
  798. object.  These bytes will appear with high order bits first.
  799. Thus, if s=1, up to 128 bytes may follow, containing the
  800. count of the succeeding data bytes, which should certainly
  801. be sufficient.
  802.  
  803. Since many non-atomic objects will be fairly short, the
  804. s=0 condition is used to indicate that the 7 bits contained
  805. in tuvwxyz specify the actual data byte count.  This permits
  806.  
  807. objects of sizes up to 128 bytes to be specified using one
  808. size-information byte.  The case tuvwxyz=0000000 is
  809. interpreted as specifying 128 bytes.
  810.  
  811. For example, a data object of some non-atomic type
  812. which requires 100 (144 octal) bytes to be transmitted would
  813. be sent as follows.
  814.  
  815.                                 -14-
  816.  
  817. 110XXXXX -- identifying a specific
  818. non-atomic object
  819. 01100100 -- specifying that 100 bytes follow
  820. .
  821. .
  822. data -- the 100 data bytes
  823. .
  824. .
  825.  
  826. Note that the size count does not include the
  827. size-specifier byte(s) themselves, but does include all
  828. succeeding bytes in the stream used to encode the object.
  829.  
  830. A data object requiring 20000 (47040 octal) bytes would
  831. appear in the stream as follows.
  832.  
  833. 110XXXXX -- identifying a specific
  834. non-atomic object
  835. 10000010 -- specifying that the next 2 bytes
  836. contain the stream length
  837. 01001110 -- first byte of number 20000
  838. 00100000 -- second byte
  839. .
  840. .
  841. data -- 20,000 bytes
  842. .
  843. .
  844.  
  845. Interpretation of the contents of the 20000 bytes in
  846. the stream can be performed by a module which knows the
  847. specific format of the non-atomic type specified by DEFGH in
  848. the type-byte.
  849.  
  850. The remainder of this section defines an initial set of
  851. non-atomic types, the format of their encoding, and the
  852. semantics of their interpretation.
  853.  
  854.  
  855. ================================
  856. | Non-atomic Object: B-LBITSTR |
  857. ================================
  858.  
  859. The b-LBITSTR (Long BIT Stream) data type is introduced
  860. to transmit p-BITS which cannot be handled by a b-SBITSTR.
  861. A b-LBITSTR may be used to transmit short p-BITS as well.
  862. Its format follows.
  863.  
  864.  
  865.  
  866.  
  867.  
  868.  
  869.  
  870.  
  871.  
  872.  
  873.                                 -15-
  874.  
  875. 11000001 size-bytes data-bytes
  876. ABCDEFGH
  877.  
  878. ABC=110 identifies this as a non-atomic object.
  879. DEFGH=00001 specifies that it is a b-LBITSTR.  The standard
  880. sizing information specifies the number of succeeding bytes.
  881. Within the data-bytes, the first object encountered must
  882. decode to a p-INT.  This number conveys the length of the
  883. bit stream to follow.  The actual bit stream begins with the
  884. next byte, and is left-adjusted in the byte stream.  For
  885. example to encode *101010101010*, the following b-LBITSTR
  886. could be used, although a b-SBITSTR would be more compact.
  887.  
  888. 11000001 -- identifies a b-LBITSTR
  889. 00000010 -- b-SINTEGER, to specify length
  890. 10001100 -- size = 2
  891. 10101010 -- first 8 data bits
  892. 10100000 -- last 4 data bits
  893.  
  894.  
  895.  
  896. ==============================
  897. | Non-atomic Object: B-STRUC |
  898. ==============================
  899.  
  900. The b-STRUC (STRUCture) data type is used to transmit
  901. any p-STRUC.  The translation rules for converting a b-STRUC
  902. into a primitive item are presented following the discussion
  903. of b-REPEATs.  The b-STRUC format appears as follows.
  904.  
  905. 11000010 size-bytes data-bytes
  906. ABCDEFGH
  907.  
  908. ABC=110 identifies this as a non-atomic type.
  909. DEFGH=00010 specifies that the object is a b-STRUC.  Within
  910. the data-bytes stream, objects simply follow in order.  This
  911. implies that the b-STRUC encoder and decoder modules can
  912. simply make use of recursive calls to a standard
  913. encoder/decoder for processing each element of the b-STRUC.
  914.  
  915. Note that any type of object is permitted as an element of a
  916. b-STRUC, but the size information of the b-STRUC must
  917. include all bytes used to represent the elements.
  918.  
  919. Containment of b-STRUCs within other b-STRUCs is
  920. permitted to any reasonable level.  That is, a b-STRUC may
  921. contain as an element another b-STRUC, which contains
  922. another b-STRUC, and so on.  All servers are requires to
  923. handle such containment to at least a minimum depth of
  924. three.
  925.  
  926. Examples of encoded structures appear in a later
  927. section.
  928.  
  929.  
  930.                                 -16-
  931. ============================
  932. | Non-atomic Object: B-EDT |
  933. ============================
  934.  
  935. A b-EDT is the object used as the carrier for p-EDTs in
  936. transmission of semantic items.  It is functionally
  937. identical to a b-STRUC, but has a different type code to
  938. permit it to be identified and converted to a semantic item
  939. instead of a p-STRUC.  The format of a b-EDT follows.
  940.  
  941. 11000011 size-bytes data-bytes
  942. ABCDEFGH
  943.  
  944. As with all non-atomic types, ABC=110 to identify this
  945. as such, and DEFGH=00011 to specify a b-EDT.  The objects in
  946. the data-bytes are decoded as for b-STRUCs.  However, the
  947. first object must decode to a p-iNT or p-STRING and the
  948. second to a p-INT, to conform to the format of p-EDTs.
  949.  
  950.  
  951.  
  952. ===============================
  953. | Non-atomic Object: b-REPEAT |
  954. ===============================
  955.  
  956.  
  957. The b-REPEAT object is never translated directly into
  958. an item.  It is legal only as an component of an enclosing
  959. b-STRUC, b-USTRUC, b-EDT, or b-REPEAT.  A b-REPEAT is used to
  960. concisely specify a set of elements to be treated as if they
  961. appeared in the enclosing structure in place of the
  962. b-REPEAT.  This provides a mechanism for encoding a sequence
  963. of identical data items or patterns efficiently for
  964. transmission.
  965.  
  966. A common example of this would be in transmission of
  967. text, where line images containing long sequences of spaces,
  968. or pages containing multiple carriage-return, line-feed
  969. pairs, are often encountered.  Such sequences could be
  970. encoded as an appropriate b-REPEAT to compact the data for
  971. transmission.  The format of a b-REPEAT is as follows.
  972.  
  973. 11000100   -- identifyIng the object as a
  974.                 b-REPEAT
  975. size-bytes -- the standard non-atomic object
  976.                 size information
  977. countspec  -- an object which translates to a p-INT
  978. .
  979. .
  980. data -- the objects which define the pattern
  981. .
  982. .
  983.  
  984. The 'countspec' object must translate to an p-INT to
  985. specify the number of times that the following data pattern
  986. should be repeated in the object enclosing the b-REPEAT.
  987.  
  988.                                 -17-
  989.  
  990. The remaining objects in the b-REPEAT constitute the
  991. data pattern which is to be repeated.  The decoding of the
  992. enclosing structure will be continued as if the data pattern
  993. objects appeared 'countspec' times in place of the b-REPEAT.
  994. Zero repeat counts are permitted, for generality.  They
  995. cause no objects to be simulated in the enclosing structure.
  996.  
  997. An encoder does not have to use b-REPEATs at all, if
  998. simplicity of coding outweighs the benefits of data
  999. compression.  In message services, for example, an encoder
  1000. might limIt itself to only compressing long text strings.  It
  1001. is important for compatibility, however, to have the ability
  1002. in the decoders to handle b-REPEATs.
  1003.  
  1004. ===============================
  1005. | Non-atomic Object: B-USTRUC |
  1006. ===============================
  1007.  
  1008. The b-USTRUC (Uniform Structure) object type is
  1009. provided to enable servers to convey the fact that a p-STRUC
  1010. being transferred contains items of only a single type.  The
  1011. most common example would involve a b-USTRUC which
  1012. translates to a p-STRUC of only p-CHARs, and hence may be
  1013. considered to be a p-STRING.  Servers may use this
  1014. information to assist them in decoding objects efficiently.
  1015. No server is required to generate b-USTRUCs.
  1016.  
  1017. The internal construction of a b-USTRUC is identical to
  1018. that of a b-STRUC, except for the type-byte.  The format of a
  1019. b-USTRUC follows.
  1020.  
  1021. 11000101 size-bytes data-bytes
  1022. ABCDEFGH
  1023.  
  1024. ABC=110 to identify a non-atomic object.  DEFGH=00101
  1025. specifies the object as a b-USTRUC.
  1026.  
  1027. ===============================
  1028. | Non-atomic Object: B-STRING |
  1029. ===============================
  1030.  
  1031. The b-STRING object is included to permit explicit
  1032. specification of a structure as a p-STRING.  This
  1033. information will permit receiving servers to process the
  1034. incoming structure more efficiently.  A b-STRING is
  1035. formatted similarity to a b-USTRUC, except that its type-byte
  1036. identifies the object as a b-STRI/NG.  The normal sizing
  1037. information is followed by a stream of bytes which are
  1038. interpreted as b-CHAR7s, Ignoring the high-order bit.  The
  1039. format of a b-STRING follows.
  1040.  
  1041. 11000110 size-bytes data-bytes
  1042. ABCDEFGH
  1043.  
  1044. ABC=110 to identify a non-atomic object.  DEFGH=00110
  1045. specifies the object as a b-STRING.
  1046.  
  1047.                                 -18-
  1048.  
  1049. VI.5 -- Structure Translation Rules
  1050.  
  1051.  
  1052. A b-STRUC is translated into a p-STRUC.  This is
  1053. performed by translating each object of the b-STRUC Into its
  1054. corresponding item, and saving it for inclusion In the
  1055. p-STRUC being generated.  A b-USTRUC is handled similarly,
  1056. but the coding programs may utilize the information that the
  1057. resultant p-STRUC will contain items of uniform type.  The
  1058. preferred method of coding p-STRINGS is to use b-USTRUCs.
  1059.  
  1060. If all of the elements of the resultant p-STRUC are
  1061. p-CHARs, it is presented to the user of the decoder as a
  1062. p-STRING.  A p-STRING should be considered to be a synonym
  1063. for a p-STRUC containing only characters.  It need not
  1064. necessarily exist at particular sites which would present
  1065. p-STRUCs of p-CHARs to their application programs
  1066.  
  1067. The object b-REPEAT is handled in a special fashion
  1068. when encountered as an element.  When this occurs, the data
  1069. pattern of the b-REPEAT is translated into a sequence of
  1070. items, and that sequence is repeated in the next higher
  1071. level as many times as specified in the b-REPEAT.
  1072. Therefore, b-REPEATS are legal only as elements of a
  1073. surrounding b-STRUC, b-USTRUC, b-EDT, or b-REPEAT.
  1074.  
  1075. In encoding a p-STRUC or p-STRING for transmission, a
  1076. translator may use b-REPEATs as desired to effect data
  1077. compression, but their use is not mandatory.  Similarly,
  1078. b-STRINGS may be used, but are not mandatory.
  1079.  
  1080. A b-EDT is translated into a p-EDT to identify it as a
  1081. carrier for a semantic item.  Otherwise, it is treated
  1082. identically to a b-STRUC.
  1083.  
  1084.  
  1085. VI.6 -- Translation Summary
  1086.  
  1087.  
  1088. The following table summarizes the possible
  1089. translations between primitive items and objects.
  1090.  
  1091. p-INT    <--> b-LINTEGER, b-SINTEGER
  1092. p-STRING <--> b-STRING, b-STRUC, b-USTRUC
  1093. p-STRUC  <--> b-STRING, b-STRUC, b-USTRUC
  1094. p-BITS   <--> b=SBITSTR, b-LBITSTR
  1095. p-CHAR   <--> b-CHAR7
  1096. p-BOOL   <--> b-BOOL
  1097. p-EMPTY  <--> b=EMPTY
  1098. p-XTRA   <--> b-XTRA
  1099. p-EDT    <--> b-EDT (all semantic items)
  1100. -none-   <--> b-PADDING
  1101. -none-   <--> b-REPEAT (only within structure)
  1102.  
  1103. Note that all semantic items are represented as p-EDTs
  1104. which always exist as b-EDTs in byte-stream format.
  1105.  
  1106.                                 -19-
  1107. V1.7 -- Structure Coding Examples
  1108.  
  1109.  
  1110. The following stream transmits a b-STRUC containing 3
  1111. b-SINTEGERs, with values 1, 2, and 3, representing a p-STRUC
  1112. containing three p-INTs, i.e. (1 2 3).
  1113.  
  1114. 11000010 -- b-STRUC
  1115. 00000011 -- size=3
  1116. 10000001 -- b-SINTEGER=1
  1117. 10000010 -- b-SINTEGER=2
  1118. 10000011 -- b-SINTEGER=3
  1119.  
  1120. The next example represents a b-STRUC containing the
  1121. characters X and Y, followed by the b-LINTEGER 10,
  1122. representing a p-STRUC of 2 p-CHARs and a p-INT, i.e., ('X'
  1123. 'Y' 10).  Note that the p-INT prevents considering this a
  1124. p-STRING.
  1125.  
  1126. 11000010 -- b-STRUC
  1127. 00000100 -- size=4
  1128. 01011000 -- b-CHAR7 'X'
  1129. 01011001 -- b-CHAR7 'Y'
  1130. 11100001 -- b-LINTEGER
  1131. 00001010 -- 10
  1132.  
  1133. Note that a better way to send this p-STRUC would be to
  1134. represent the integer as a b-SINTEGER, as shown below.
  1135.  
  1136. 11000010 -- b-STRUC
  1137. 00000011 -- size=3
  1138. 01011000 -- b-CHAR7 'X'
  1139. 01011001 -- b-CHAR7 'Y'
  1140. 10001010 -- b-SINTEGER=10
  1141.  
  1142. The next example shows a b-STRUC of b-CHAR7s.  It is
  1143. the translation of the b-STRING "HELLO".
  1144.  
  1145. 11000010 -- b-STRUC
  1146. 00000101 -- size=5
  1147. 01001000 -- b-CHAR7 'H'
  1148. 01000101 -- b-CHAR7 'E'
  1149. 01001100 -- b-CHAR7 'L'
  1150. 01001100 -- b-CHAR7 'L'
  1151. 01001111 -- b-CHAR7 'O'
  1152.  
  1153. This datum could also be transmitted as a b-STRING.
  1154. Note that the character bytes are not necessarily b-CHAR7s,
  1155. since the high-order bit is ignored.
  1156.  
  1157. 11000110 -- b-STRING
  1158. 00000101 -- size=5
  1159. 01001000 -- 'H'
  1160. 01000101 -- 'E'
  1161. 01001100 -- 'L'
  1162. 01001100 -- 'L'
  1163. 01001111 -- 'O'
  1164.  
  1165.                                 -20-
  1166. To encode a p-STRING containing 20 carriage-return
  1167. line-feed pairs, the following b-STRUC containing a b-REPEAT
  1168. could be used.
  1169.  
  1170. 11000010 -- b-STRUC
  1171. 00000101 -- size=5
  1172. 11000100 -- b-REPEAT
  1173. 00000011 -- size=3
  1174. 10010100 -- count, b-SINTEGER=20
  1175. 00001101 -- b-CHAR7, "CR'
  1176. 00001010 -- b-CHAR7, 'IF'
  1177.  
  1178. To encode a p-STRUC of p-INTs, where the sequence
  1179. contains a sequence of thirty 0's preceded by a single 1,
  1180. the following b-STRUC could be used.
  1181.  
  1182. 11000010 -- b-STRUC
  1183. 00000110 -- size=6
  1184. 10000001 -- b-SINTEGER=1
  1185. 11000100 -- b-REPEAT
  1186. 00000010 -- size=2
  1187. 10011110 -- count, b-SINTEGER=30
  1188. 10000000 -- b-SINTEGER=0
  1189.  
  1190.  
  1191. VII. A GENERAL DATA TRANSFER SCHEME
  1192.  
  1193.  
  1194. This section considers a possible scheme for extending
  1195. the concept of a data translator into an multi-purpose data
  1196. transfer mechanism.
  1197.  
  1198. The proposed environment would provide a set of
  1199. primitive items, including those enumerated herein but
  1200. extended as necessary to accommodate a variety of
  1201. applications.  Communication between processes would be
  1202. defined solely in terms of these items, and would
  1203. specifically avoid any consideration of the actual formats
  1204. in which the data is transferred.
  1205.  
  1206. A repertoire of translators would be provided, one of
  1207. which is the MSDTP machinery, for use in converting items to
  1208. any of a number of transmission formats.  Borrowing a
  1209. concept from radio terminology, each translator would be
  1210. analogous to a different type of modulation scheme, to be
  1211. used to transfer data through some communications medium.
  1212. Such media could be an eight-bit byte-oriented connection,
  1213. 36-bit connection, etc.  and conceivably have other
  1214. distinguishing features, such as bandwidth, cost, and delay.
  1215. For each media which a site supports, it would provide its
  1216. programmers with a module for performing the translations
  1217. required.
  1218.  
  1219.  
  1220.  
  1221.  
  1222.                                 -21-
  1223.  
  1224. Certain media or translators might not handle various
  1225. items.  For example, the MSDTP does not handle items which
  1226. might be termed p-FLOATs, p-COMPLEXs, p-ARRAY, and so on.  In
  1227. addition, the efficiency of various media for transfer of
  1228. specific items may differ drastically.  MSDTP, for example,
  1229. transfers data frequently used in message handling very
  1230. efficiently, but is relatively poor at transfer of very
  1231. large or deep tree structures.
  1232.  
  1233. Available at each site as a process or subroutine
  1234. package wouLd be a module responsible for interfacing with
  1235. its counterpart at the other end of the media.  These
  1236. modules would use a protocol, not yet defined, to match
  1237. their capabilities, and choose a particular media and
  1238. translator, when more than one exists, for transfer of data
  1239. items.
  1240.  
  1241. Such a facility could totally insulate applications
  1242. from need to consider encoding formats, machine differences,
  1243. and so on, as well as eliminate duplication of effort in
  1244. producing such facilities for every new project which
  1245. requires them.  In addition, as new translators or media are
  1246. introduced, they would become immediately available to
  1247. existing users without reprogramming.
  1248.  
  1249. Implementation of such a protocol should not be very
  1250. difficult or time-consuming, since it need not be very
  1251. sophisticated in choosing the most appropriate transfer
  1252. mechanism in initial implementations.  The system is
  1253. inherently upward-compatible and easily expandable.
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.  
  1262.  
  1263.  
  1264.  
  1265.  
  1266.  
  1267.  
  1268.  
  1269.  
  1270.  
  1271.  
  1272.  
  1273.  
  1274.  
  1275.  
  1276.  
  1277.                                 -22-
  1278.