[要約] RFC 8746は、CBORでのタイプ付き配列のためのタグを定義しています。このRFCの目的は、CBORデータの効率的な表現と相互運用性を向上させることです。

Internet Engineering Task Force (IETF)                   C. Bormann, Ed.
Request for Comments: 8746                        Universität Bremen TZI
Category: Standards Track                                  February 2020
ISSN: 2070-1721
        

Concise Binary Object Representation (CBOR) Tags for Typed Arrays

型付き配列の簡潔なバイナリオブジェクト表現(CBOR)タグ

Abstract

概要

The Concise Binary Object Representation (CBOR), as defined in RFC 7049, is a data format whose design goals include the possibility of extremely small code size, fairly small message size, and extensibility without the need for version negotiation.

RFC 7049で定義されているコンサイスバイナリオブジェクト表現(CBOR)は、非常に小さいコードサイズ、かなり小さいメッセージサイズ、およびバージョンネゴシエーションを必要としない拡張性の可能性を設計目標に含むデータ形式です。

This document makes use of this extensibility to define a number of CBOR tags for typed arrays of numeric data, as well as additional tags for multi-dimensional and homogeneous arrays. It is intended as the reference document for the IANA registration of the CBOR tags defined.

このドキュメントでは、この拡張性を利用して、数値データの型付き配列の多数のCBORタグ、および多次元の同種配列の追加タグを定義しています。これは、定義されたCBORタグのIANA登録のリファレンスドキュメントとして意図されています。

Status of This Memo

本文書の状態

This is an Internet Standards Track document.

これはInternet Standards Trackドキュメントです。

This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 7841.

このドキュメントは、IETF(Internet Engineering Task Force)の製品です。これは、IETFコミュニティのコンセンサスを表しています。公開レビューを受け、インターネットエンジニアリングステアリンググループ(IESG)による公開が承認されました。インターネット標準の詳細については、RFC 7841のセクション2をご覧ください。

Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at https://www.rfc-editor.org/info/rfc8746.

このドキュメントの現在のステータス、エラータ、およびフィードバックの提供方法に関する情報は、https://www.rfc-editor.org/info/rfc8746で入手できます。

Copyright Notice

著作権表示

Copyright (c) 2020 IETF Trust and the persons identified as the document authors. All rights reserved.

著作権(c)2020 IETFトラストおよびドキュメントの作成者として識別された人物。全著作権所有。

This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.

この文書は、BCP 78およびIETF文書に関するIETFトラストの法的規定(https://trustee.ietf.org/license-info)の対象であり、この文書の発行日に有効です。これらのドキュメントは、このドキュメントに関するあなたの権利と制限を説明しているため、注意深く確認してください。このドキュメントから抽出されたコードコンポーネントには、Trust Legal Provisionsのセクション4.eに記載されているSimplified BSD Licenseのテキストが含まれている必要があり、Simplified BSD Licenseに記載されているように保証なしで提供されます。

Table of Contents

目次

   1.  Introduction
     1.1.  Terminology
   2.  Typed Arrays
     2.1.  Types of Numbers
   3.  Additional Array Tags
     3.1.  Multi-dimensional Array
       3.1.1.  Row-Major Order
       3.1.2.  Column-Major Order
     3.2.  Homogeneous Array
   4.  Discussion
   5.  CDDL Typenames
   6.  IANA Considerations
   7.  Security Considerations
   8.  References
     8.1.  Normative References
     8.2.  Informative References
   Acknowledgements
   Contributors
   Author's Address
        
1. Introduction
1. はじめに

The Concise Binary Object Representation (CBOR) [RFC7049] provides for the interchange of structured data without a requirement for a pre-agreed schema. [RFC7049] defines a basic set of data types as well as a tagging mechanism that enables extending the set of data types supported via an IANA registry.

簡潔なバイナリオブジェクト表現(CBOR)[RFC7049]は、事前に合意されたスキーマを必要とせずに、構造化データの交換を提供します。 [RFC7049]は、IANAレジストリを介してサポートされるデータ型のセットの拡張を可能にするタグ付けメカニズムだけでなく、データ型の基本セットを定義します。

Recently, a simple form of typed arrays of numeric data has received interest both in the Web graphics community [TypedArray] and in the JavaScript specification (see Section 22.2 (https://www.ecma-international.org/ecma-262/10.0/index.html#sec-typedarray-objects) of [ECMA-ES10]) as well as in corresponding implementations [ArrayBuffer].

最近、数値データの型付き配列の単純な形式が、Webグラフィックコミュニティ[TypedArray]とJavaScript仕様の両方で関心を集めています(セクション22.2(https://www.ecma-international.org/ecma-262/10.0を参照)。 /index.html#sec-typedarray-objects)[ECMA-ES10])と対応する実装[ArrayBuffer]。

Since these typed arrays may carry significant amounts of data, there is interest in interchanging them in CBOR without the need of lengthy conversion of each number in the array. This can also save space overhead with encoding a type for each element of an array.

これらの型付き配列は大量のデータを運ぶ可能性があるため、配列内の各数値を長時間変換する必要なく、CBORでそれらを交換することに関心があります。これにより、配列の各要素の型をエンコードすることで、スペースのオーバーヘッドを節約することもできます。

This document defines a number of interrelated CBOR tags that cover these typed arrays, as well as additional tags for multi-dimensional and homogeneous arrays. It is intended as the reference document for the IANA registration of the tags defined.

このドキュメントでは、これらの型付き配列をカバーする相互に関連する多数のCBORタグと、多次元および同種配列用の追加タグを定義します。これは、定義されたタグのIANA登録の参照ドキュメントとして意図されています。

Note that an application that generates CBOR with these tags has considerable freedom in choosing variants (e.g., with respect to endianness, embedded type (signed vs. unsigned), and number of bits per element) or whether a tag defined in this specification is used at all instead of more basic CBOR. In contrast to representation variants of single CBOR numbers, there is no representation that could be identified as "preferred". If deterministic encoding is desired in a CBOR-based protocol making use of these tags, the protocol has to define which of the encoding variants are used for each individual case.

これらのタグでCBORを生成するアプリケーションは、バリアント(たとえば、エンディアン、埋め込み型(符号付きまたは符号なし)、および要素あたりのビット数)を選択する際にかなりの自由度があるか、またはこの仕様で定義されているタグを使用するかどうかに注意してください。より基本的なCBORの代わりに。単一のCBOR番号の表記バリアントとは対照的に、「推奨」として識別できる表記はありません。これらのタグを使用するCBORベースのプロトコルで確定的なエンコーディングが必要な場合、プロトコルは、個々のケースごとに使用されるエンコーディングバリアントを定義する必要があります。

1.1. Terminology
1.1. 用語

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.

キーワード「MUST」、「MUST NOT」、「REQUIRED」、「SHALL」、「SHALL NOT」、「SHOULD」、「SHOULD NOT」、「RECOMMENDED」、「NOT RECOMMENDED」、「MAY」、「OPTIONALこのドキュメントの「」は、BCP 14 [RFC2119] [RFC8174]で説明されているように解釈されます。

The term "byte" is used in its now-customary sense as a synonym for "octet". Where bit arithmetic is explained, this document uses familiar notation from the programming language C [C] (including C++14's 0bnnn binary literals [CPlusPlus]) with the exception of the operator "**", which stands for exponentiation.

「バイト」という用語は、今では慣習的な意味で「オクテット」の同義語として使用されています。ビット演算について説明する場合、このドキュメントでは、累乗を表す演算子「**」を除いて、プログラミング言語C [C](C ++ 14の0bnnnバイナリリテラル[CPlusPlus]を含む)の一般的な表記法を使用します。

The term "array" is used in a general sense in this document unless further specified. The term "classical CBOR array" describes an array represented with CBOR major type 4. A "homogeneous array" is an array of elements that are all the same type (the term is neutral as to whether that is a representation type or an application data model type).

「アレイ」という用語は、特に明記されていない限り、このドキュメントでは一般的な意味で使用されます。 「クラシックCBOR配列」という用語は、CBORメジャータイプ4で表される配列を表します。「同種配列」は、すべて同じタイプの要素の配列です(この用語は、それが表現タイプであるかアプリケーションデータであるかに関して中立です)モデルタイプ)。

The terms "big endian" and "little endian" are used to indicate a most significant byte first (MSB first) representation of integers and a least significant byte first (LSB first) representation, respectively.

「ビッグエンディアン」および「リトルエンディアン」という用語は、それぞれ整数の最上位バイトファースト(MSBファースト)表現と最下位バイトファースト(LSBファースト)表現を示すために使用されます。

2. Typed Arrays
2. 型付き配列

Typed arrays are homogeneous arrays of numbers, all of which are encoded in a single form of binary representation. The concatenation of these representations is encoded as a single CBOR byte string (major type 2), enclosed by a single tag indicating the type and encoding of all the numbers represented in the byte string.

型付き配列は、数値の同種の配列であり、すべてが単一形式のバイナリ表現でエンコードされます。これらの表現の連結は、バイト文字列で表されるすべての数値のタイプとエンコーディングを示す単一のタグで囲まれた単一のCBORバイト文字列(メジャータイプ2)としてエンコードされます。

2.1. Types of Numbers
2.1. 数字の種類

Three classes of numbers are of interest: unsigned integers (uint), signed integers (two's complement, sint), and IEEE 754 binary floating point numbers (which are always signed). For each of these classes, there are multiple representation lengths in active use:

符号付き整数(uint)、符号付き整数(2の補数、sint)、およびIEEE 754 2進浮動小数点数(常に符号付き)の3つの数値クラスが対象です。これらの各クラスには、アクティブに使用されている複数の表現長があります。

                +-----------+--------+--------+-----------+
                | Length ll | uint   | sint   | float     |
                +===========+========+========+===========+
                | 0         | uint8  | sint8  | binary16  |
                +-----------+--------+--------+-----------+
                | 1         | uint16 | sint16 | binary32  |
                +-----------+--------+--------+-----------+
                | 2         | uint32 | sint32 | binary64  |
                +-----------+--------+--------+-----------+
                | 3         | uint64 | sint64 | binary128 |
                +-----------+--------+--------+-----------+
        

Table 1: Length Values

表1:長さの値

Here, sintN stands for a signed integer of exactly N bits (for instance, sint16), and uintN stands for an unsigned integer of exactly N bits (for instance, uint32). The name binaryN stands for the number form of the same name defined in IEEE 754 [IEEE754].

ここで、sintNは正確にNビットの符号付き整数(たとえば、sint16)を表し、uintNは正確にNビットの符号なし整数(たとえば、uint32)を表します。名前binaryNは、IEEE 754 [IEEE754]で定義されている同じ名前の数値形式を表します。

Since one objective of these tags is to be able to directly ship the ArrayBuffers underlying the Typed Arrays without re-encoding them, and these may be either in big-endian (network byte order) or in little-endian form, we need to define tags for both variants.

これらのタグの目的の1つは、再エンコードせずに型付き配列の基になるArrayBufferを直接出荷できることであり、これらはビッグエンディアン(ネットワークバイトオーダー)またはリトルエンディアン形式のいずれかであるため、次のように定義する必要があります。両方のバリアントのタグ。

In total, this leads to 24 variants. In the tag, we need to express the choice between integer and floating point, the signedness (for integers), the endianness, and one of the four length values.

合計すると、これは24のバリアントにつながります。タグでは、整数と浮動小数点の間の選択、符号付き(整数の場合)、エンディアン、および4つの長さの値の1つを表す必要があります。

In order to simplify implementation, a range of tags is being allocated that allows retrieving all this information from the bits of the tag: tag values from 64 to 87.

実装を簡略化するために、タグのビットからすべてのこの情報を取得できるタグの範囲が割り当てられています:64から87までのタグ値。

The value is split up into 5 bit fields: 0b010, f, s, e, and ll as detailed in Table 2.

値は、表2に示すように、5ビットのフィールド(0b010、f、s、e、およびll)に分割されます。

     +-------+-------------------------------------------------------+
     | Field | Use                                                   |
     +=======+=======================================================+
     | 0b010 | the constant bits 0, 1, 0                             |
     +-------+-------------------------------------------------------+
     | f     | 0 for integer, 1 for float                            |
     +-------+-------------------------------------------------------+
     | s     | 0 for float or unsigned integer, 1 for signed integer |
     +-------+-------------------------------------------------------+
     | e     | 0 for big endian, 1 for little endian                 |
     +-------+-------------------------------------------------------+
     | ll    | A number for the length (Table 1).                    |
     +-------+-------------------------------------------------------+
        

Table 2: Bit Fields in the Low 8 Bits of the Tag

表2:タグの下位8ビットのビットフィールド

The number of bytes in each array element can then be calculated by "2**(f + ll)" (or "1 << (f + ll)" in a typical programming language). (Notice that 0f and ll are the two least significant bits, respectively, of each 4-bit nibble in the byte.)

各配列要素のバイト数は、 "2 **(f + ll)"(または一般的なプログラミング言語では "1 <<(f + ll)")で計算できます。 (0fとllはそれぞれ、バイト内の各4ビットニブルの最下位2ビットであることに注意してください。)

In the CBOR representation, the total number of elements in the array is not expressed explicitly but is implied from the length of the byte string and the length of each representation. It can be computed from the length, in bytes, of the byte string comprising the representation of the array by inverting the previous formula: "bytelength >> (f + ll)".

CBOR表現では、配列内の要素の総数は明示的に表現されていませんが、バイト文字列の長さと各表現の長さから暗示されます。これは、前の式「bytelength >>(f + ll)」を逆にすることで、配列の表現を構成するバイト文字列の長さ(バイト単位)から計算できます。

For the uint8/sint8 values, the endianness is redundant. Only the tag for the big-endian variant is used and assigned as such. The tag that would signify the little-endian variant of sint8 MUST NOT be used; its tag number is marked as reserved. As a special case, the tag that would signify the little-endian variant of uint8 is instead assigned to signify that the numbers in the array are using clamped conversion from integers, as described in more detail in Section 7.1.11 (http://www.ecma-international.org/ecma-262/6.0/#sec-touint8clamp) of the ES10 JavaScript specification ("ToUint8Clamp") [ECMA-ES10]; the assumption here is that a program-internal representation of this array after decoding would be marked this way for further processing providing "roundtripping" of JavaScript-typed arrays through CBOR.

uint8 / sint8値の場合、エンディアンは冗長です。ビッグエンディアンバリアントのタグのみが使用され、そのように割り当てられます。 sint8のリトルエンディアンバリアントを示すタグは使用してはなりません(MUST NOT)。そのタグ番号は予約済みとしてマークされています。特別なケースとして、uint8のリトルエンディアンバリアントを示すタグが代わりに割り当てられ、7.1.11項(http://)で詳細に説明されているように、配列内の数値が整数からのクランプ変換を使用していることを示します。 www.ecma-international.org/ecma-262/6.0/#sec-touint8clamp)ES10 JavaScript仕様( "ToUint8Clamp")[ECMA-ES10];ここでの前提は、デコード後のこの配列のプログラム内部表現が、CBORを介してJavaScriptタイプの配列の「ラウンドトリッピング」を提供するさらなる処理のためにこのようにマークされることです。

IEEE 754 binary floating numbers are always signed. Therefore, for the float variants ("f" == 1), there is no need to distinguish between signed and unsigned variants; the "s" bit is always zero. The tag numbers where "s" would be one (which would have tag values 88 to 95) remain free to use by other specifications.

IEEE 754 2進数浮動小数点数は常に符号付きです。したがって、floatバリアント( "f" == 1)の場合、符号付きと符号なしのバリアントを区別する必要はありません。 「s」ビットは常にゼロです。 「s」が1になるタグ番号(88〜95のタグ値)は、他の仕様で自由に使用できます。

3. Additional Array Tags
3. 追加の配列タグ

This specification defines three additional array tags. The Multi-dimensional Array tags can be combined with classical CBOR arrays as well as with Typed Arrays in order to build multi-dimensional arrays with constant numbers of elements in the sub-arrays. The Homogeneous Array tag can be used as a signal by an application to identify a classical CBOR array as a homogeneous array, even when a Typed Array does not apply.

この仕様では、3つの追加配列タグが定義されています。多次元配列タグを従来のCBOR配列だけでなく、型付き配列と組み合わせて、サブ配列内の要素数が一定の多次元配列を構築できます。型付き配列が適用されない場合でも、アプリケーションは同種配列タグを信号として使用して、従来のCBOR配列を同種配列として識別できます。

3.1. Multi-dimensional Array
3.1. 多次元配列

A multi-dimensional array is represented as a tagged array that contains two (one-dimensional) arrays. The first array defines the dimensions of the multi-dimensional array (in the sequence of outer dimensions towards inner dimensions) while the second array represents the contents of the multi-dimensional array. If the second array is itself tagged as a Typed Array, then the element type of the multi-dimensional array is known to be the same type as that of the Typed Array.

多次元配列は、2つの(1次元)配列を含むタグ付き配列として表されます。最初の配列は多次元配列の次元を(外部次元から内部次元に向かって)定義し、2番目の配列は多次元配列の内容を表します。 2番目の配列自体が型付き配列としてタグ付けされている場合、多次元配列の要素の型は、型付き配列と同じ型であることがわかります。

Two tags are defined by this document: one for elements arranged in row-major order and another for column-major order [RowColMajor].

このドキュメントでは、2つのタグが定義されています。1つは行優先順で配置された要素用で、もう1つは列優先順[RowColMajor]です。

3.1.1. Row-Major Order
3.1.1. 行優先順

Tag: 40

タグ:40

Data Item: Array (major type 4) of two arrays: one array (major type 4) of dimensions, which are unsigned integers distinct from zero; and one array (any one of a CBOR array of major type 4, a Typed Array, or a Homogeneous Array) of elements.

データ項目:2つの配列の配列(メジャータイプ4):次元の1つの配列(メジャータイプ4)。これはゼロとは異なる符号なし整数です。要素の1つの配列(メジャータイプ4のCBOR配列、型付き配列、またはホモジニアス配列のいずれか)。

Data in the second array consists of consecutive values where the last dimension is considered contiguous (row-major order).

2番目の配列のデータは、最後の次元が連続していると見なされる連続した値で構成されます(行優先順)。

Figure 1 shows a declaration of a two-dimensional array in the C language, a representation of that in CBOR using both a multi-dimensional array tag and a typed array tag.

図1は、C言語での2次元配列の宣言を示しています。CBORでは、多次元配列タグと型付き配列タグの両方を使用してそれを表現しています。

   uint16_t a[2][3] = {
     {2, 4, 8},   /* row 0 */
     {4, 16, 256},
   };
        
   <Tag 40> # multi-dimensional array tag
      82       # array(2)
        82      # array(2)
          02     # unsigned(2) 1st Dimension
          03     # unsigned(3) 2nd Dimension
        <Tag 65> # uint16 array
          4c     # byte string(12)
            0002 # unsigned(2)
            0004 # unsigned(4)
            0008 # unsigned(8)
            0004 # unsigned(4)
            0010 # unsigned(16)
            0100 # unsigned(256)
        

Figure 1: Multi-dimensional Array in C and CBOR

図1:CおよびCBORの多次元配列

Figure 2 shows the same two-dimensional array using the multi-dimensional array tag in conjunction with a basic CBOR array (which, with the small numbers chosen for the example, happens to be shorter).

図2は、基本的なCBOR配列と組み合わせて多次元配列タグを使用した同じ2次元配列を示しています(この例では小さな数値を選択したため、たまたま短くなっています)。

   <Tag 40> # multi-dimensional array tag
      82       # array(2)
        82      # array(2)
          02     # unsigned(2) 1st Dimension
          03     # unsigned(3) 2nd Dimension
        86     # array(6)
          02      # unsigned(2)
          04      # unsigned(4)
          08      # unsigned(8)
          04      # unsigned(4)
          10      # unsigned(16)
          19 0100 # unsigned(256)
        

Figure 2: Multi-dimensional Array Using Basic CBOR Array

図2:基本的なCBOR配列を使用した多次元配列

3.1.2. Column-Major Order
3.1.2. 列優先順

The multi-dimensional arrays specified in the previous sub-subsection are in "row major" order, which is the preferred order for the purposes of this specification. An analogous representation that uses "column major" order arrays is provided in this subsection under the tag 1040, as illustrated in Figure 3.

前のサブサブセクションで指定された多次元配列は、「行優先」の順序になっています。これは、この仕様の目的で優先される順序です。図3に示すように、「列優先」の順序配列を使用する類似の表現が、タグ1040の下のこのサブセクションに提供されています。

Tag: 1040

タグ:1040

Data Item: The same as tag 40, except the data in the second array consists of consecutive values where the first dimension is considered contiguous (column-major order).

データ項目:タグ40と同じですが、2番目の配列のデータは、最初の次元が連続していると見なされる連続した値で構成されます(列優先順)。

   <Tag 1040> # multi-dimensional array tag, column-major order
      82       # array(2)
        82      # array(2)
          02     # unsigned(2) 1st Dimension
          03     # unsigned(3) 2nd Dimension
        86     # array(6)
          02      # unsigned(2)
          04      # unsigned(4)
          04      # unsigned(4)
          10      # unsigned(16)
          08      # unsigned(8)
          19 0100 # unsigned(256)
        

Figure 3: Multi-dimensional Array Using Basic CBOR Array, Column-Major Order

図3:基本的なCBOR配列を使用した多次元配列、列優先

3.2. Homogeneous Array
3.2. 同種アレイ

Tag: 41

タグ:41

Data Item: Array (major type 4)

データ項目:配列(メジャータイプ4)

This tag identifies the classical CBOR array (a one-dimensional array) tagged by it as a homogeneous array, that is, it has elements that are all of the same application model data type. The element type of the array is therefore determined by the application model data type of the first array element.

このタグは、タグが付けられた従来のCBOR配列(1次元配列)を同種配列として識別します。つまり、すべて同じアプリケーションモデルデータ型の要素を持っています。したがって、配列の要素タイプは、最初の配列要素のアプリケーションモデルデータタイプによって決まります。

This can be used in application data models that apply specific semantics to homogeneous arrays. Also, in certain cases, implementations in strongly typed languages may be able to create native homogeneous arrays of specific types instead of ordered lists while decoding. Which CBOR data items constitute elements of the same application type is specific to the application.

これは、特定のセマンティクスを同種配列に適用するアプリケーションデータモデルで使用できます。また、特定のケースでは、強く型付けされた言語の実装は、デコード時に順序付きリストの代わりに特定の型のネイティブ同種配列を作成できる場合があります。同じアプリケーションタイプの要素を構成するCBORデータ項目は、アプリケーションに固有です。

Figure 4 shows an example for a homogeneous array of booleans in C++ [CPlusPlus] and CBOR.

図4は、C ++ [CPlusPlus]およびCBORでのブール値の同種配列の例を示しています。

   bool boolArray[2] = { true, false };
        
   <Tag 41>  # Homogeneous Array Tag
      82           #array(2)
         F5        # true
         F4        # false
        
                Figure 4: Homogeneous Array in C++ and CBOR
        

Figure 5 extends the example with a more complex structure.

図5は、より複雑な構造で例を拡張しています。

   typedef struct {
     bool active;
     int value;
   } foo;
   foo myArray[2] = { {true, 3}, {true, -4} };
        
   <Tag 41>
       82  # array(2)
          82  #  array(2)
                F5  # true
                03  # 3
          82 # array(2)
                F5  # true
                23  # -4
        
                Figure 5: Homogeneous Array in C++ and CBOR
        
4. Discussion
4. 討論

Support for both little- and big-endian representation may seem out of character with CBOR, which is otherwise fully big endian. This support is in line with the intended use of the typed arrays and the objective not to require conversion of each array element.

リトルエンディアン表現とビッグエンディアン表現の両方のサポートは、CBORとは無関係であるように見える場合があります。このサポートは、型付き配列の使用目的と、各配列要素の変換を必要としないという目的に沿っています。

This specification allocates a sizable chunk out of the single-byte tag space. This use of code point space is justified by the wide use of typed arrays in data interchange.

この仕様は、1バイトのタグ空間からかなりの量を割り当てます。このコードポイントスペースの使用は、データ交換で型付き配列を幅広く使用することで正当化されます。

Providing a column-major order variant of the multi-dimensional array may seem superfluous to some and useful to others. It is cheap to define the additional tag so that it is available when actually needed. Allocating it out of a different number space makes the preference for row-major evident.

多次元配列の列優先順序のバリアントを提供することは、一部にとっては不必要であり、他にとっては便利に思えるかもしれません。追加のタグを定義して、実際に必要なときに利用できるようにするのは簡単です。別の数値スペースから割り当てると、行優先が優先されます。

Applying a Homogeneous Array tag to a Typed Array would usually be redundant and is therefore not provided by the present specification.

同種配列タグを型付き配列に適用することは通常冗長であり、したがって、本仕様では提供されません。

5. CDDL Typenames
5. CDDLタイプ名

For use with CDDL [RFC8610], the typenames defined in Figure 6 are recommended:

CDDL [RFC8610]で使用するには、図6で定義されているタイプ名が推奨されます。

   ta-uint8 = #6.64(bstr)
   ta-uint16be = #6.65(bstr)
   ta-uint32be = #6.66(bstr)
   ta-uint64be = #6.67(bstr)
   ta-uint8-clamped = #6.68(bstr)
   ta-uint16le = #6.69(bstr)
   ta-uint32le = #6.70(bstr)
   ta-uint64le = #6.71(bstr)
   ta-sint8 = #6.72(bstr)
   ta-sint16be = #6.73(bstr)
   ta-sint32be = #6.74(bstr)
   ta-sint64be = #6.75(bstr)
   ; reserved: #6.76(bstr)
   ta-sint16le = #6.77(bstr)
   ta-sint32le = #6.78(bstr)
   ta-sint64le = #6.79(bstr)
   ta-float16be = #6.80(bstr)
   ta-float32be = #6.81(bstr)
   ta-float64be = #6.82(bstr)
   ta-float128be = #6.83(bstr)
   ta-float16le = #6.84(bstr)
   ta-float32le = #6.85(bstr)
   ta-float64le = #6.86(bstr)
   ta-float128le = #6.87(bstr)
   homogeneous<array> = #6.41(array)
   multi-dim<dim, array> = #6.40([dim, array])
   multi-dim-column-major<dim, array> = #6.1040([dim, array])
        

Figure 6: Recommended Typenames for CDDL

図6:CDDLの推奨されるタイプ名

6. IANA Considerations
6. IANAに関する考慮事項

IANA has allocated the tags in Table 3 using this document as the specification reference. (The reserved value is for a future revision of typed array tags.)

IANAは、このドキュメントを仕様参照として使用して、表3のタグを割り当てました。 (予約済みの値は、型付き配列タグの将来のリビジョン用です。)

The allocations were assigned from the "specification required" space (24..255) with the exception of 1040, which was assigned from the "first come first served" space (256..).

「先着順」スペース(256 ..)から割り当てられた1040を除いて、割り当ては「仕様が必要」スペース(24..255)から割り当てられました。

       +------+----------------------+----------------------------+
       |  Tag | Data Item            | Semantics                  |
       +======+======================+============================+
       |   40 | array of two arrays* | Multi-dimensional Array,   |
       |      |                      | row-major order            |
       +------+----------------------+----------------------------+
       |   41 | array                | Homogeneous Array          |
       +------+----------------------+----------------------------+
       |   64 | byte string          | uint8 Typed Array          |
       +------+----------------------+----------------------------+
       |   65 | byte string          | uint16, big endian, Typed  |
       |      |                      | Array                      |
       +------+----------------------+----------------------------+
       |   66 | byte string          | uint32, big endian, Typed  |
       |      |                      | Array                      |
       +------+----------------------+----------------------------+
       |   67 | byte string          | uint64, big endian, Typed  |
       |      |                      | Array                      |
       +------+----------------------+----------------------------+
       |   68 | byte string          | uint8 Typed Array, clamped |
       |      |                      | arithmetic                 |
       +------+----------------------+----------------------------+
       |   69 | byte string          | uint16, little endian,     |
       |      |                      | Typed Array                |
       +------+----------------------+----------------------------+
       |   70 | byte string          | uint32, little endian,     |
       |      |                      | Typed Array                |
       +------+----------------------+----------------------------+
       |   71 | byte string          | uint64, little endian,     |
       |      |                      | Typed Array                |
       +------+----------------------+----------------------------+
       |   72 | byte string          | sint8 Typed Array          |
       +------+----------------------+----------------------------+
       |   73 | byte string          | sint16, big endian, Typed  |
       |      |                      | Array                      |
       +------+----------------------+----------------------------+
       |   74 | byte string          | sint32, big endian, Typed  |
       |      |                      | Array                      |
       +------+----------------------+----------------------------+
       |   75 | byte string          | sint64, big endian, Typed  |
       |      |                      | Array                      |
       +------+----------------------+----------------------------+
       |   76 | byte string          | (reserved)                 |
       +------+----------------------+----------------------------+
       |   77 | byte string          | sint16, little endian,     |
       |      |                      | Typed Array                |
       +------+----------------------+----------------------------+
       |   78 | byte string          | sint32, little endian,     |
       |      |                      | Typed Array                |
       +------+----------------------+----------------------------+
       |   79 | byte string          | sint64, little endian,     |
       |      |                      | Typed Array                |
       +------+----------------------+----------------------------+
       |   80 | byte string          | IEEE 754 binary16, big     |
       |      |                      | endian, Typed Array        |
       +------+----------------------+----------------------------+
       |   81 | byte string          | IEEE 754 binary32, big     |
       |      |                      | endian, Typed Array        |
       +------+----------------------+----------------------------+
       |   82 | byte string          | IEEE 754 binary64, big     |
       |      |                      | endian, Typed Array        |
       +------+----------------------+----------------------------+
       |   83 | byte string          | IEEE 754 binary128, big    |
       |      |                      | endian, Typed Array        |
       +------+----------------------+----------------------------+
       |   84 | byte string          | IEEE 754 binary16, little  |
       |      |                      | endian, Typed Array        |
       +------+----------------------+----------------------------+
       |   85 | byte string          | IEEE 754 binary32, little  |
       |      |                      | endian, Typed Array        |
       +------+----------------------+----------------------------+
       |   86 | byte string          | IEEE 754 binary64, little  |
       |      |                      | endian, Typed Array        |
       +------+----------------------+----------------------------+
       |   87 | byte string          | IEEE 754 binary128, little |
       |      |                      | endian, Typed Array        |
       +------+----------------------+----------------------------+
       | 1040 | array of two arrays* | Multi-dimensional Array,   |
       |      |                      | column-major order         |
       +------+----------------------+----------------------------+
        

Table 3: Values for Tags

表3:タグの値

*40 or 1040 data item: The second element of the outer array in the data item is a native CBOR array (major type 4) or Typed Array (one of tag 64..87)

* 40または1040データ項目:データ項目の外部配列の2番目の要素は、ネイティブCBOR配列(メジャータイプ4)または型付き配列(タグ64..87の1つ)です。

7. Security Considerations
7. セキュリティに関する考慮事項

The security considerations of [RFC7049] apply; special attention is drawn to the second paragraph of Section 8 of [RFC7049].

[RFC7049]のセキュリティに関する考慮事項が適用されます。 [RFC7049]のセクション8の2番目の段落に特別な注意が向けられています。

The tag for homogeneous arrays makes a promise about its tagged data item, which a maliciously constructed CBOR input can then choose to ignore. As always, the decoder therefore has to ensure that it is not driven into an undefined state by array elements that do not fulfill the promise, and that it does continue to fulfill its API contract in this case as well.

同種配列のタグは、そのタグ付きデータ項目について約束をします。悪意を持って作成されたCBOR入力は、無視することを選択できます。したがって、いつものように、デコーダーは、promiseを満たさない配列要素によって未定義の状態に駆動されないようにし、この場合もAPIコントラクトを引き続き満たしていることを確認する必要があります。

As with all formats that are used for data interchange, an attacker may have control over the shape of the data delivered as input to the application, which therefore needs to validate that shape before it makes it the basis of its further processing. One unique aspect that typed arrays add to this is that an attacker might substitute a Uint8ClampedArray for where the application expects a Uint8Array, or vice versa, potentially leading to very different (and unexpected) processing semantics of the in-memory data structures constructed. Applications that could be affected by this will therefore need to be careful about making this distinction in their input validation.

データ交換に使用されるすべての形式と同様に、攻撃者は、アプリケーションへの入力として配信されるデータの形状を制御できるため、その後の処理の基礎となる前にその形状を検証する必要があります。型付き配列がこれに追加する1つのユニークな側面は、攻撃者がUint8ClampedArrayをアプリケーションがUint8Arrayを期待する場所に置き換えたり、構築されたメモリ内データ構造の非常に異なる(そして予期しない)処理セマンティクスにつながる可能性があることです。したがって、これによって影響を受ける可能性のあるアプリケーションは、入力検証でこの区別を行う場合に注意する必要があります。

8. References
8. 参考文献
8.1. Normative References
8.1. 引用文献

[C] International Organization for Standardization, "Information technology - Programming languages - C", ISO/ IEC 9899:2018, Fourth Edition, June 2018.

[C]国際標準化機構、「情報技術-プログラミング言語-C」、ISO / IEC 9899:2018、第4版、2018年6月。

[CPlusPlus] International Organization for Standardization, "Programming languages - C++", ISO/IEC 14882:2017, Fifth Edition, December 2017.

[CPlusPlus]国際標準化機構、「プログラミング言語-C ++」、ISO / IEC 14882:2017、第5版、2017年12月。

[ECMA-ES10] ECMA International, "ECMAScript 2019 Language Specification", Standard ECMA-262 10th Edition, June 2019, <https://www.ecma-international.org/ecma-262/10.0/ index.html>.

[ECMA-ES10] ECMA International、「ECMAScript 2019 Language Specification」、Standard ECMA-262 10th Edition、2019年6月、<https://www.ecma-international.org/ecma-262/10.0/ index.html>。

[IEEE754] IEEE, "IEEE Standard for Floating-Point Arithmetic", IEEE 754-2019, DOI 10.1109/IEEESTD.2019.8766229, <https://ieeexplore.ieee.org/document/8766229>.

[IEEE754] IEEE、「IEEE Standard for Floating-Point Arithmetic」、IEEE 754-2019、DOI 10.1109 / IEEESTD.2019.8766229、<https://ieeexplore.ieee.org/document/8766229>。

[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997, <https://www.rfc-editor.org/info/rfc2119>.

[RFC2119] Bradner、S。、「要件レベルを示すためにRFCで使用するキーワード」、BCP 14、RFC 2119、DOI 10.17487 / RFC2119、1997年3月、<https://www.rfc-editor.org/info/ rfc2119>。

[RFC7049] Bormann, C. and P. Hoffman, "Concise Binary Object Representation (CBOR)", RFC 7049, DOI 10.17487/RFC7049, October 2013, <https://www.rfc-editor.org/info/rfc7049>.

[RFC7049] Bormann、C。およびP. Hoffman、「簡潔なバイナリオブジェクト表現(CBOR)」、RFC 7049、DOI 10.17487 / RFC7049、2013年10月、<https://www.rfc-editor.org/info/rfc7049> 。

[RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, May 2017, <https://www.rfc-editor.org/info/rfc8174>.

[RFC8174] Leiba、B。、「RFC 2119キーワードの大文字と小文字のあいまいさ」、BCP 14、RFC 8174、DOI 10.17487 / RFC8174、2017年5月、<https://www.rfc-editor.org/info/ rfc8174>。

[RFC8610] Birkholz, H., Vigano, C., and C. Bormann, "Concise Data Definition Language (CDDL): A Notational Convention to Express Concise Binary Object Representation (CBOR) and JSON Data Structures", RFC 8610, DOI 10.17487/RFC8610, June 2019, <https://www.rfc-editor.org/info/rfc8610>.

[RFC8610] Birkholz、H.、Vigano、C。、およびC. Bormann、「簡潔なデータ定義言語(CDDL):簡潔なバイナリオブジェクト表現(CBOR)およびJSONデータ構造を表現するための表記法」、RFC 8610、DOI 10.17487 / RFC8610、2019年6月、<https://www.rfc-editor.org/info/rfc8610>。

8.2. Informative References
8.2. 参考引用

[ArrayBuffer] Mozilla Developer Network, "JavaScript typed arrays", June 2010, <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays>.

[ArrayBuffer] Mozilla Developer Network、「JavaScript typed array」、2010年6月、<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays>。

[RowColMajor] Wikipedia, "Row- and column-major order", September 2019, <https://en.wikipedia.org/w/index.php?title=Row-_and_column-major_order&oldid=917905325>.

[RowColMajor] Wikipedia、「Row-and column-major order」、2019年9月、<https://en.wikipedia.org/w/index.php?title=Row-_and_column-major_order&oldid=917905325>。

[TypedArray] Vukicevic, V. and K. Russell, "Typed Array Specification", February 2011, <https://web.archive.org/web/20110207024413/ http://www.khronos.org/registry/typedarray/specs/latest/>.

[TypedArray] Vukicevic、V。およびK. Russell、「Typed Array Specification」、2011年2月、<https://web.archive.org/web/20110207024413/ http://www.khronos.org/registry/typedarray/ specs / latest />。

Acknowledgements

謝辞

Jim Schaad provided helpful comments and reminded us that column-major order still is in use. Jeffrey Yaskin helped improve the definition of homogeneous arrays. IANA helped correct an error in a previous draft version. Francesca Palombini acted as Shepherd, and Alexey Melnikov as responsible Area Director. Elwyn Davies as Gen-ART reviewer and IESG members Martin Vigoureux, Adam Roach, Roman Danyliw, and Benjamin Kaduk helped in finding further improvements to the text; thanks also to the other reviewers.

Jim Schaadは役立つコメントを提供し、列優先の順序がまだ使用されていることを思い出させました。 Jeffrey Yaskinは、同種配列の定義の改善に貢献しました。 IANAは、以前のドラフトバージョンのエラーを修正するのに役立ちました。フランチェスカパロンビーニが羊飼い、アレクセイメルニコフが担当エリアディレクターを務めました。 ElWyn DaviesがGen-ARTレビューアとして、またIESGメンバーとして、Martin Vigoureux、Adam Roach、Roman Danyliw、Benjamin Kadukが、テキストのさらなる改善を見つけるのを助けました。他のレビュアーにも感謝します。

Contributors

貢献者

The initial draft version of this specification was written by Johnathan Roatch <roatch@gmail.com>. Many thanks for getting this ball rolling.

この仕様の最初のドラフトバージョンは、Jonathan Roatch <roatch@gmail.com>によって作成されました。このボールを転がしてくれてありがとう。

Glenn Engel suggested the tags for multi-dimensional arrays and homogeneous arrays.

Glenn Engelは、多次元配列と同種配列のタグを提案しました。

Author's Address

著者のアドレス

Carsten Bormann (editor) Universität Bremen TZI Postfach 330440 D-28359 Bremen Germany

Carsten Bormann(編集者)ブレーメン大学TZI Postfach 330440 D-28359ブレーメンドイツ

   Phone: +49-421-218-63921
   Email: cabo@tzi.org