CBOR data definition language (CDDL): a notational convention to express CBOR data structures
draft-greevenbosch-appsawg-cbor-cddl-10
Network Working Group H. Birkholz
Internet-Draft Fraunhofer SIT
Intended status: Informational C. Vigano
Expires: September 14, 2017 Universitaet Bremen
C. Bormann
Universitaet Bremen TZI
March 13, 2017
CBOR data definition language (CDDL): a notational convention to express
CBOR data structures
draft-greevenbosch-appsawg-cbor-cddl-10
Abstract
This document proposes a notational convention to express CBOR data
structures (RFC 7049). Its main goal is to provide an easy and
unambiguous way to express structures for protocol messages and data
formats that use CBOR.
Status of This Memo
This Internet-Draft is submitted in full conformance with the
provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/.
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."
This Internet-Draft will expire on September 14, 2017.
Copyright Notice
Copyright (c) 2017 IETF Trust and the persons identified as the
document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents
(http://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
Birkholz, et al. Expires September 14, 2017 [Page 1]
Internet-Draft CDDL March 2017
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.
Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1. Requirements notation . . . . . . . . . . . . . . . . . . 4
1.2. Terminology . . . . . . . . . . . . . . . . . . . . . . . 4
2. The Style of Data Structure Specification . . . . . . . . . . 4
2.1. Groups and Composition in CDDL . . . . . . . . . . . . . 5
2.1.1. Usage . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1.2. Syntax . . . . . . . . . . . . . . . . . . . . . . . 8
2.2. Types . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2.1. Values . . . . . . . . . . . . . . . . . . . . . . . 8
2.2.2. Choices . . . . . . . . . . . . . . . . . . . . . . . 8
2.2.3. Representation Types . . . . . . . . . . . . . . . . 10
2.2.4. Root type . . . . . . . . . . . . . . . . . . . . . . 10
3. Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.1. General conventions . . . . . . . . . . . . . . . . . . . 11
3.2. Occurrence . . . . . . . . . . . . . . . . . . . . . . . 12
3.3. Predefined names for types . . . . . . . . . . . . . . . 13
3.4. Arrays . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.5. Maps . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.5.1. Structs . . . . . . . . . . . . . . . . . . . . . . . 15
3.5.2. Tables . . . . . . . . . . . . . . . . . . . . . . . 17
3.6. Tags . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.7. Annotations . . . . . . . . . . . . . . . . . . . . . . . 18
3.7.1. Annotation .size . . . . . . . . . . . . . . . . . . 19
3.7.2. Annotation .bits . . . . . . . . . . . . . . . . . . 19
3.7.3. Annotation .regexp . . . . . . . . . . . . . . . . . 20
3.7.4. Annotations .cbor and .cborseq . . . . . . . . . . . 21
3.7.5. Annotations .within and .and . . . . . . . . . . . . 21
3.7.6. Annotations .lt, .le, .gt, .ge, .eq, .ne, and
.default . . . . . . . . . . . . . . . . . . . . . . 22
3.8. Socket/Plug . . . . . . . . . . . . . . . . . . . . . . . 22
3.9. Operator Precedence . . . . . . . . . . . . . . . . . . . 24
4. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.1. Fruit . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.2. RFC 7071 . . . . . . . . . . . . . . . . . . . . . . . . 27
4.3. Examples from JSON Content Rules . . . . . . . . . . . . 31
Show full document text