跳到主要内容

5. 创建基于 CBOR 的协议 (Creating CBOR-Based Protocols)

本节提供创建以 CBOR 作为 encoding format 的 protocols 时的准则.

5.1. Streaming Applications 中的 CBOR (CBOR in Streaming Applications)​

CBOR 可用于逐个发送和接收 data items 的 streaming applications.

5.2. 通用 Encoders 和 Decoders (Generic Encoders and Decoders)​

Generic CBOR encoders 和 decoders 可以在不了解具体 application semantics 的情况下处理任何 well-formed CBOR data item.

5.3. Items 的有效性 (Validity of Items)​

CBOR 区分 well-formed 和 valid data items.

5.3.1. 基本有效性 (Basic Validity)​

Basic validity rules 确保 CBOR data items 遵循 semantic restrictions.

5.3.2. Tag 有效性 (Tag Validity)​

Tags 必须遵循为每个 tag number 定义的 specific validity rules.

5.4. 有效性和演进 (Validity and Evolution)​

Protocols 必须考虑 validity rules 可能如何随时间演进.

5.5. Numbers​

在 CBOR 中编码和处理 numeric values 时适用特殊考虑.

5.6. 为 Maps 指定 Keys (Specifying Keys for Maps)​

Applications 应指定哪些 data items 可作为 maps 中的有效 keys.

5.6.1. Keys 的等价性 (Equivalence of Keys)​

Applications 必须定义何时认为两个 keys 等价.

5.7. Undefined Values​

"undefined" simple value (23) 在 CBOR 中具有特殊语义.