INTERNET-DRAFT A. Soloviev draft-avsolov-dtpdia-00.txt Petrozavodsk State University Expires: November 31, 2002 May 31, 2002 Data Transfer Protocol for Distributed Information Acquisition (DTP/DIA) Status of This Memo This document is an Internet-Draft and is in full conformance with all provisions of Section 10 of RFC 2026. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and its working groups. Note that other groups may also distribute working documents as Internet- Drafts. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." The list of current Internet-Drafts can be accessed at http://www.ietf.org/ietf/1id-abstracts.txt. The list of Internet-Draft Shadow Directories can be accessed at http://www.ietf.org/shadow.html. This Internet-Draft will expire on November 31, 2002. Copyright Notice Copyright (C) The Internet Society (2002). All Rights Reserved. Abstract The described in this memo protocol was developed for the application in distributed information measurement systems (IMS) at any stage of communication. It was designed for transmission of measured data from measuring devices to processing and storing equipment. Also it does support common device identification in distributed IMS. Due to its simplicity it can be easily implemented in firmware of any digital measuring device. Soloviev Expires November 31, 2002 [Page 1] Internet-Draft DTP/DIA May 2002 1. Introduction The Data Transfer Protocol for Distributed Information Acquisition (DTP/DIA) was developed for application in distributed information measurement systems (IMS). DTP/DIA provides the functionality of the presentation and application layers of the OSI Reference Model for the specified purposes. 1.1. Concept of Distributed IMS IMS stands for a bundle of software and hardware which performs acquisition, processing, storing, and presentation of measured data. The systems with control function are out of scope. The simplest IMS consists of measuring device, connected to computer by means of some instrument interface (such as IEEE 488 (GPIB) or EIA/RS 232). Typical measuring device contains a sensor and a microcontroller which performs initial data acquisition and processing. In such a system the majority of IMS functions are given to computer. More complicated systems can be developed on the basis of CAMAC or VXI. But projects with large amount of investigated objects at far distances from each other require to install distributed IMS. Some nodes of distributed IMS should perform data transmission to nodes which process and store data. Sometimes this communication can be done by measuring device itself if it is rather sophisticated, or this function may be performed by a computer. That is we deal with two kinds of data channels: local (1) and network (2). +---------+ +-----------------------+ |measuring|==============(2)============| | computer ............| | device | ||==|(collector): database | +---------+ (1)-local (instrument) bus || +-----------------------+ (2)-network channel || +-----------------------+ +---------+ ||==| computer ............| |measuring| +--------------+ || |(collector): web-server| | device |--(1)--| | || +-----------------------+ +---------+ | computer | || +-----------------------+ +---------+ |(retranslator)| ||==| computer :calculating| |measuring|--(1)--| |==(2)=| |(collector): software | | device | +--------------+ +-----------------------+ +---------+ In most cases the nodes of distributed IMS are considered to be the components of the open systems. So OSI Reference Model can be applied to their communication channels. The upper layers of such systems are poorly standardized due to the wide range of IMS's applications. The most of existing standards are vendor-specific. That's why it's necessary to introduce a simple protocol, suitable Soloviev Expires November 31, 2002 [Page 2] Internet-Draft DTP/DIA May 2002 for both kinds of data channel. DTP/DIA matches these requirements. 1.2. Remark about Terms We avoid using terms "client" and "server" in description of IMS. Instead we use the term "data source" for the object which transmits measured data and "data collector" - for the node which receives measured data. If the node performs both reception and retransmission this type of nodes will be named "retranslator". Obviously, in this terminology measuring devices are "data sources", but a single computer could be either "end-point data collector" or "retranslator". The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119. 2. General Features The protocol describes data transmission in small stand-alone packets. This feature allows using DTP/DIA over both streamed (connection-oriented) and message-oriented channels. DTP/DIA provides few data presentation forms. Each form corresponds to a specific packet type. Some of the forms help to avoid the implementation of floating point arithmetics in device firmware. DTP/DIA allows transmission of measured data accompanied with information about measurement error and its unit measure. In distributed IMS it is very important to distinguish measuring devices from each other at the application layer. So the protocol includes identification mechanism. This feature helps to transmit data from several data sources over a single communication channel. For example, one can use a device with several sensors (such device is represented as multiple data sources). We suppose to apply DTP/DIA for both network and local channels. Few types of local channels don't provide reliable data delivery. To avoid unreliability of local interfaces DTP/DIA has the following primitive features: detection of packet start (packet leading sequence), check sum and time stamp. Soloviev Expires November 31, 2002 [Page 3] Internet-Draft DTP/DIA May 2002 3. DTP/DIA Packet Format DTP/DIA packet consists of three logical blocks: Header, Measured Data and Special Data. Header and Measured Data are REQUIRED. They have a fixed size (8 bytes and 4 bytes correspondingly). Special Data block is RECOMMENDED and its size is variable. Here and further the octets numbering starts from 0. Header block contains packet leading sequence, version field (VERS), flags field (L and T bits), Data Source Identifier (ID.1 and ID.2 fields), size field (SIZE), device vendor specific data (DEVINFO), packet type field (TYPE), and physical quantity code (PHYQNTY). The content of Measured Data block is determined by the packet type. Special Data may contain UNIT MEASURE MARK, accuracy fields (PROB and ERROR), List of Inquiring Identifiers, TIMESTAMP, and CHECKSUM. A simple measuring device MUST produce packets, contained at least Header and one of the forms of Measured Data block. More sophisticated device SHOULD include Special Data block as well. 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |1 0 0 1 0 0 1 0|0 0 1 0 1 0 1 0| VERS |L|T|R|R| ID.1 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ID.2 | SIZE |DEVINFO|TYPE | PHYQNTY | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Measured Data | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | +-+-+-+- . . . Special Data . . . -+-+-+-+ | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | TIMESTAMP | CHECKSUM | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 3.1. Packet Leading Sequence The first two octets of DTP/DIA packet contain 0x49 0x54. These values MUST be used by software to detect the origin of DTP/DIA packet. Collector software MUST ignore any data not started with the specified packet leading sequence. 3.2. Version Field Current version code is 0. Soloviev Expires November 31, 2002 [Page 4] Internet-Draft DTP/DIA May 2002 3.3. Flags Field The 20th bit (L) determines the kind of byte order was used in the packet. 1 corresponds to little-endian format, 0 corresponds to big- endian format. It's up to IMS developer to choose byte order format. Obviously, it depends on what kind of microcontroller was used in measuring device. For example, Intel's MCS 96/296 uses little-endian byte order, but Motorola's MC68xxx uses big-endian byte order. The 21st bit (T) determines whether TIMESTAMP field has to be ignored or not (see Section 3.11). If this bit is set (T=1) TIMESTAMP MUST be ignored, otherwise it REQUIRES a valid value inside. The 22nd and 23rd bits are reserved for future use and MUST be 0. 3.4. Data Source Identifier To distinguish data from various data sources DTP/DIA packet contains Data Source Identifier. To introduce a bit of structurization in distributed IMS the Identifier was divided into two parts: ID.1 and ID.2. They correspond to high and low levels of 2-level hierarchy. Developer of IMS MAY use ID.1 to specify the group of units in distributed IMS and ID.2 to appoint a number of device in this group. The notation "AAA/BBBBB" will be used to specify Data Source Identifier (where AAA - ID.1 and BBBBB - ID.2). The byte order of ID.2 field depends on the value of flag L. It's NOT RECOMMENDED to assign a fixed identifier for data source by device vendor. Developer of IMS should have an opportunity to change Data Source Identifier, for example, by means of special software or DIP-switches. Device vendor MAY apply Data Source Identification Procedure for assigning identifiers as described in Section 4. Identifiers "0/0" and "0/65535" are reserved for Data Source Identification Procedure (see Section 4). Every retranslator SHOULD keep Data Source Identifier untouched. 3.5. Size of the Packet The size of the packet specifies amount of 32-bit words occupied by the packet. The minimal size of DTP/DIA packet is 12 bytes (SIZE=3). The maximal size of DTP/DIA packet is 60 bytes (SIZE=15). 3.6. Device Vendor Specific Data The DEVINFO field contains device vendor specific information. This value MUST NOT influence on interpretation of MEASURED DATA. Soloviev Expires November 31, 2002 [Page 5] Internet-Draft DTP/DIA May 2002 3.7. Packet Types The following packet types are declared: TYPE_FLOAT (TYPE=1), TYPE_DIV (TYPE=3), TYPE_INT (TYPE=5), TYPE_INFO (TYPE=6), TYPE_SPEC (TYPE=7). Types 0, 2, 4 are reserved for future use. TYPE_FLOAT, TYPE_DIV, and TYPE_INT specify different data presentation forms (as described in Section 3.9). TYPE_INFO packets are designed to provide additional text information about data source. Octets from the 8th to the end of the packet (except for the last 32-bit word) are filled with some text (firmware version, copyrights, vendor information etc). Symbols differ from ASCII 32-126 SHOULD be avoided. Such text MUST be terminated by at least one octet zero and padding bytes MUST contain zeros as well. Maximal length of this text without trailing zeros is 47 bytes. Collector software MAY silently ignore such packets. TYPE_SPEC packets have a special purpose in the Data Source Identification Procedure (see Section 4). Measured Data block MUST be filled with zeros. Collector software MUST ignore the value in Measured Data block. 3.8. Physical Quantity Code PHYQNTY code specifies the physical quantity to be measured. The following codes are assigned: 8 - temperature 9 - pressure 30 - dosage rate 31 - other physical quantity Other codes are reserved for future use. If PHYQNTY code is equal to 31 the physical quantity will be determined by UNIT MEASURE MARK (see Section 3.10). 3.9. Measured Data block The content of Measured Data block is determined by the packet type. TYPE_FLOAT packet (TYPE=1) Measured Data contains a certain value of physical quantity, represented as 32-bit floating point number ("single" in terms of IEEE 754). These bits contain a sign bit (S), 8 bits of exponent (E), and 23 bits of mantissa's fraction (M1...M23). Initial reference value is calculated in such a way (see details in [10]): (-1)^S * 2^(E-127) * 1.M1M2M3...M23 Soloviev Expires November 31, 2002 [Page 6] Internet-Draft DTP/DIA May 2002 Here we use "^" as exponentiating operator. TYPE_DIV packet (TYPE=3) Measured Data contains two 16-bit integer numbers. Reference value is the result of division of these numbers. There is a divisor (16-bit signed integer) in the 8th and the 9th octets of the packet. A dividend (16-bit unsigned integer) occupies the 10th and 11th octets of the packet. TYPE_INT packet (TYPE=5) Measured Data contains multiplied by 10 value of physical quantity, represented as 32-bit signed integer number. Byte order of Measured Data block depends on the value of flag L. Retranslator MAY convert measured data presentation from one form to another. 3.10. UNIT MEASURE MARK and Accuracy Fields If information about measurement error and unit measure are to be transmitted DTP/DIA packet should include UNIT MEASURE MARK and accuracy fields (PROB and ERROR). +-----------------+-------+-------+ |UNIT MEASURE MARK| PROB | ERROR | +-----------------+-------+-------+ UNIT MEASURE MARK starts from the 12th octet of the packet. This field is considered to be a text notation of unit measure. Symbols differ from ASCII 32-126 SHOULD be avoided. Such text MUST be terminated by at least one octet zero. The size of this field is variable but MUST be divisible by 4 and padding octets MUST contain zeros. Maximal length of this text without trailing zeros is 43 bytes. UNIT MEASURE MARK MUST NOT be used in TYPE_INFO and TYPE_SPEC packets. UNIT MEASURE MARK is RECOMMENDED if PHYQNTY is equal to 31. UNIT MEASURE MARK is REQUIRED if accuracy fields are present (but MAY be filled with zeros). Accuracy fields (PROB and ERROR) start just after the trailing zeros of UNIT MEASURE MARK. PROB offset MUST be aligned by 4. ERROR field contains the measurement relative error and follows PROB. PROB field contains the probability of physical quantity being outside of the interval determined by measurement relative error (the complement of the reliability to 1). In TYPE_FLOAT packets accuracy fields are represented as 32-bit floating point values and occupy 8 bytes. In TYPE_DIV and TYPE_INT packets they are represented as 16-bit unsigned integer numbers multiplied by 10000 and occupy 4 bytes. Byte order Soloviev Expires November 31, 2002 [Page 7] Internet-Draft DTP/DIA May 2002 of these values depends on the value of flag L. Accuracy fields are OPTIONAL. 3.11. TIMESTAMP To distinguish various packets and so to avoid packet duplication TIMESTAMP MAY be included into the packet. TIMESTAMP stands for measurement time, represented as 24 least significant bits in seconds, elapsed since 00:00:00 UTC, January 1, 1970. Byte order of TIMESTAMP is determined by bit L in the flags field. If collector receives two packets from one data source with the same TIMESTAMP it SHOULD discard one of these packets. This situation may happen not only because of packets duplication but when developer of IMS has implemented the opportunity to correct measured data or to make it more accurate on-the-fly. So collector software MAY be set up to discard the first packet with the same TIMESTAMP. This field is OPTIONAL. In the case TIMESTAMP and the whole Special Data block are absent (SIZE=3), the bit T in the flags field MUST be set (T=1). If Special Data block is included into packet the space for TIMESTAMP is reserved. In the case time stamp information isn't required the bit T must be set (T=1), TIMESTAMP MUST be filled with zero and will be ignored by collector. If bit T is cleared (T=0) TIMESTAMP contains a valid value and MAY be treated. 3.12. CHECKSUM If Special Data block is present CHECKSUM occupies the last octet of the packet. CHECKSUM is the residue of division of the sum of previous bytes by 256 (modulus of 256). This field is REQUIRED if the packet is larger than 12 bytes (SIZE>3). The packet with incorrect CHECKSUM MUST be discarded. 4. Data Source Identification Procedure Data Source Identification Procedure is an OPTIONAL mechanism which helps sharing a single transport layer connection for data transmission from several data sources. This feature MUST NOT be applied to connectionless (message-oriented) channels. So data source can distinguish every collector by a certain transport layer connection. This mechanism consists of two events: "Offer To Identify" and "Device Request". "Offer To Identify" corresponds to TYPE_SPEC packet with ID="0/65535", sent by data source equipment. This packet MAY be sent not only just right after connection establishment but at any moment Soloviev Expires November 31, 2002 [Page 8] Internet-Draft DTP/DIA May 2002 (for example, when hardware configuration of data sources has changed). Expected reaction of collector is "Device Request" packet. If collector ignores "Offer To Identify" (doesn't reply for specified time) the action of data source MUST be one of the following: - 0..3 retries of "Offer To Identify" then it MUST break the transport layer connection; - 0..3 retries of "Offer To Identify" then it MUST start transmission of data packets of data source with the least existing identifier. If collector requests both non-existing and existing data sources the equipment action MUST be one of the following: - 0..3 retries of "Offer To Identify" then it MUST break the transport layer connection; - 0..3 retries of "Offer To Identify" then it MUST ignore the non- existing data sources request; If collector requests non-existing data source only the equipment MUST break the transport layer connection. "Device Request" corresponds to TYPE_SPEC packet with ID="0/0", sent by collector. This packet MUST contain List of Inquiring Identifiers in Special Data block. The size of this list is variable but divisible by 4 (the size of sequence). The list starts from the 12th octet and lasts to the end of the packet. Each Data Source Identifier in this list occupies 3 last octets in each sequence. Leading byte in each sequence is zero. Byte order of ID.2 depends on the value of flags L. +0 +1 +2 +3 +----+----+----+----+ | 0 |ID.1| ID.2 | +----+----+----+----+ List of Inquiring Identifiers may contain up to 11 identifiers of the data sources, expected to send their data through this communication channel. If collector needs to request more than 11 data sources it MUST distribute their identifiers to several "Device Request" packets. If data source accepts "Device Request" it starts sending data packets. Collector MAY send "Device Request" packet at any time of communication (not only when it answers to "Offer To Identify"). The difference between stand-alone "Device Request" and the sequence "Offer To Identify" - "Device Request" is that every time data source Soloviev Expires November 31, 2002 [Page 9] Internet-Draft DTP/DIA May 2002 equipment sends "Offer To Identify" packet it clears the stack of requested identifiers for the corresponding collector, but when data source receives the next "Device Request" it adds identifiers from this packet to current stack of requested identifiers. Also Data Source Identification Procedure MAY be applied for assigning identifiers. In this case the first identifier requested by collector SHOULD be used by data source as its own Data Source Identifier. Retranslator MAY act as collector or as data source in this Data Source Identification Procedure. 5. Protocol Number IANA has assigned TCP and UDP port number 3489 for DTP/DIA. 6. Security Considerations DTP/DIA is definitely insecure. To produce security based applications developer of IMS should provide authentication and data protection on the transport layer (by means of SSL or TLS (see [4], [6])). Soloviev Expires November 31, 2002 [Page 10] Internet-Draft DTP/DIA May 2002 References [1] ANSI, "Coded Character Set - 7-Bit American Standard Code for Information Interchange", ANSI X3.4-1986. [2] Bradner S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, 1997. [3] Bradner S., "The Internet Standards Process - Revision 3", BCP 9, RFC 2026, 1996. [4] Dierks T., Allen C., "The TLS Protocol Version 1.0", RFC 2246, 1999. [5] EIA, "Interface Between Data Terminal Equipment and Data Circuit- Terminating Equipment Employing Serial Binary Data Interchange", TIA/EIA-232, 1997. [6] Frier A., Karlton P., Kocher P., "The SSL 3.0 Protocol", Netscape Communications Corp., 1996. [7] IEC, "A modular instrumentation system for data handling: CAMAC system", IEC 60516 (1975-01). [8] IEC, "Definitions of CAMAC terms used in IEC publications", IEC 60678 (1980-01). [9] IEEE, "IEEE Standard Digital Interface for Programmable Instrumentation", IEEE 488.1-1987. [10] IEEE, "IEEE Standard for Binary Floating-Point Arithmetics", IEEE 754-1985. [11] ISO, "Information technology - Open Systems Interconnection - Application Layer structure", ISO/IEC 9545:1994. [12] ISO, "Information technology - Open Systems Interconnection - Basic Reference Model", ISO/IEC 7498:1994. [13] Postel J., "Transmission Control Protocol", STD 7, RFC 793, 1981. [14] Postel J., "User Datagram Protocol", STD 6, RFC 768, 1980. Soloviev Expires November 31, 2002 [Page 11] Internet-Draft DTP/DIA May 2002 Acknowledgements The author gratefully acknowledges the supervision of A. Moschevikin, associate professor, PhD, and valuable advice of A. Korolkov. Author's Address Alexei V. Soloviev Chair of IMS & Physical Electronics Petrozavodsk State University Lenin St. 33 185640 Petrozavodsk, Karelia RUSSIA Phone: +7-8142-711021 E-mail: avsolov@lab127.karelia.ru Full Copyright Statement Copyright (C) The Internet Society (2002). All Rights Reserved. This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to the Internet Society or other Internet organizations, except as needed for the purpose of developing Internet standards in which case the procedures for copyrights defined in the Internet Standards process must be followed, or as required to translate it into languages other than English. The limited permissions granted above are perpetual and will not be revoked by the Internet Society or its successors or assigns. This document and the information contained herein is provided on an "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Soloviev Expires November 31, 2002 [Page 12] Internet-Draft DTP/DIA May 2002 Appendix: Glossary of Acronyms CAMAC - Computer Automated Measurement And Control EIA/RS - Electronic Industries Association Recommended Standard GPIB - General Purpose Interface Bus IANA - Internet Assigned Numbers Authority IEC/CEI - International Electrotechnical Commission IEEE - Institute of Electrical and Electronics Engineers IETF - Internet Engineering Task Force IMS - Information Measurement System ISO - International Organization for Standardization OSI/RM - Open Systems Interconnection Reference Model SSL - Secure Sockets Layer TCP - Transmission Control Protocol TLS - Transport Layer Security UDP - User Datagram Protocol UTC - Universal Coordinated Time VXI - VME bus eXtension for Instruments Soloviev Expires November 31, 2002 [Page 13]