Skip to main content

5. Creating CBOR-Based Protocols

This section provides guidelines for creating protocols that use CBOR as their encoding format.

5.1. CBOR in Streaming Applications

CBOR can be used in streaming applications where data items are sent and received one at a time.

5.2. Generic Encoders and Decoders

Generic CBOR encoders and decoders can handle any well-formed CBOR data item without knowing the specific application semantics.

5.3. Validity of Items

CBOR distinguishes between well-formed and valid data items.

5.3.1. Basic Validity

Basic validity rules ensure that CBOR data items follow semantic restrictions.

5.3.2. Tag Validity

Tags must follow specific validity rules defined for each tag number.

5.4. Validity and Evolution

Protocols must consider how validity rules may evolve over time.

5.5. Numbers

Special considerations apply to encoding and handling numeric values in CBOR.

5.6. Specifying Keys for Maps

Applications should specify which data items are valid as keys in maps.

5.6.1. Equivalence of Keys

Applications must define when two keys are considered equivalent.

5.7. Undefined Values

The "undefined" simple value (23) has special semantics in CBOR.