draft-ietf-cbor-cddl-control-04.txt   draft-ietf-cbor-cddl-control-05.txt 
Network Working Group C. Bormann Network Working Group C. Bormann
Internet-Draft Universit├Ąt Bremen TZI Internet-Draft Universit├Ąt Bremen TZI
Intended status: Informational 31 July 2021 Intended status: Informational 31 July 2021
Expires: 1 February 2022 Expires: 1 February 2022
Additional Control Operators for CDDL Additional Control Operators for CDDL
draft-ietf-cbor-cddl-control-04 draft-ietf-cbor-cddl-control-05
Abstract Abstract
The Concise Data Definition Language (CDDL), standardized in RFC The Concise Data Definition Language (CDDL), standardized in RFC
8610, provides "control operators" as its main language extension 8610, provides "control operators" as its main language extension
point. point.
The present document defines a number of control operators that did The present document defines a number of control operators that did
not make it into RFC 8610: ".plus", ".cat" and ".det" for the not make it into RFC 8610: ".plus", ".cat" and ".det" for the
construction of constants, ".abnf"/".abnfb" for including ABNF (RFC construction of constants, ".abnf"/".abnfb" for including ABNF (RFC
skipping to change at page 2, line 29 skipping to change at page 2, line 29
6. Implementation Status . . . . . . . . . . . . . . . . . . . . 11 6. Implementation Status . . . . . . . . . . . . . . . . . . . . 11
7. Security considerations . . . . . . . . . . . . . . . . . . . 11 7. Security considerations . . . . . . . . . . . . . . . . . . . 11
8. References . . . . . . . . . . . . . . . . . . . . . . . . . 11 8. References . . . . . . . . . . . . . . . . . . . . . . . . . 11
8.1. Normative References . . . . . . . . . . . . . . . . . . 11 8.1. Normative References . . . . . . . . . . . . . . . . . . 11
8.2. Informative References . . . . . . . . . . . . . . . . . 12 8.2. Informative References . . . . . . . . . . . . . . . . . 12
Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 12 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 12
Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 13 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 13
1. Introduction 1. Introduction
The Concise Data Definition Language (CDDL), standardized in RFC The Concise Data Definition Language (CDDL), standardized in
8610, provides "control operators" as its main language extension [RFC8610], provides "control operators" as its main language
point. extension point.
The present document defines a number of control operators that did The present document defines a number of control operators that did
not make it into RFC 8610: not make it into RFC 8610:
+==========+===========================================+ +==========+===========================================+
| Name | Purpose | | Name | Purpose |
+==========+===========================================+ +==========+===========================================+
| .plus | Numeric addition | | .plus | Numeric addition |
+----------+-------------------------------------------+ +----------+-------------------------------------------+
| .cat | String Concatenation | | .cat | String Concatenation |
skipping to change at page 3, line 41 skipping to change at page 3, line 41
This specification uses terminology from [RFC8610]. In particular, This specification uses terminology from [RFC8610]. In particular,
with respect to control operators, "target" refers to the left hand with respect to control operators, "target" refers to the left hand
side operand, and "controller" to the right hand side operand. side operand, and "controller" to the right hand side operand.
2. Computed Literals 2. Computed Literals
CDDL as defined in [RFC8610] does not have any mechanisms to compute CDDL as defined in [RFC8610] does not have any mechanisms to compute
literals. As an 80 % solution, this specification adds three control literals. As an 80 % solution, this specification adds three control
operators: ".plus" for numeric addition, ".cat" for string operators: ".plus" for numeric addition, ".cat" for string
concatenation, and ".det" for string concatenation with dedenting of concatenation, and ".det" for string concatenation with dedenting of
the right hand side (controller). both sides (target and controller).
For these operators, as with all control operators, targets and For these operators, as with all control operators, targets and
controllers are types. The resulting type is therefore formally a controllers are types. The resulting type is therefore formally a
function of the elements of the cross-product of the two types. Not function of the elements of the cross-product of the two types. Not
all tools may be able to work with non-unique targets or controllers. all tools may be able to work with non-unique targets or controllers.
2.1. Numeric Addition 2.1. Numeric Addition
In many cases in a specification, numbers are needed relative to a In many cases in a specification, numbers are needed relative to a
base number. The ".plus" control identifies a number that is base number. The ".plus" control identifies a number that is
skipping to change at page 5, line 46 skipping to change at page 5, line 46
nlsb = %x81-ff *%x80-ff nlsb = %x81-ff *%x80-ff
' '
Figure 3: Example: dedenting concatenation Figure 3: Example: dedenting concatenation
The control operator ".det" works like ".cat", except that both The control operator ".det" works like ".cat", except that both
arguments (target and controller) are independently _dedented_ before arguments (target and controller) are independently _dedented_ before
the concatenation takes place. For the purposes of this the concatenation takes place. For the purposes of this
specification, we define dedenting as: specification, we define dedenting as:
1. determining the smallest amount of left-most white space (number 1. determining the smallest amount of left-most blank space (number
of leading space characters) in all the non-blank lines, and of leading space characters) in all the non-blank lines, and
2. removing exactly that number of leading space characters from 2. removing exactly that number of leading space characters from
each line. For blank (white space only or empty) lines, there each line. For blank (blank space only or empty) lines, there
may be less (or no) leading space characters than this amount, in may be less (or no) leading space characters than this amount, in
which case all leading space is removed. which case all leading space is removed.
(The name ".det" is a shortcut for "dedenting cat". The maybe more (The name ".det" is a shortcut for "dedenting cat". The maybe more
obvious name ".dedcat" has not been chosen as it is longer and may obvious name ".dedcat" has not been chosen as it is longer and may
invoke unpleasant images.) invoke unpleasant images.)
Occasionally, dedenting of only a single item is needed. This can be Occasionally, dedenting of only a single item is needed. This can be
achieved by using this operator with an empty string, e.g., """ .det achieved by using this operator with an empty string, e.g., """ .det
rhs" or "lhs .det """, which can in turn be combined with a ".cat": rhs" or "lhs .det """, which can in turn be combined with a ".cat":
skipping to change at page 8, line 45 skipping to change at page 8, line 45
rfc5234-core = ' rfc5234-core = '
DIGIT = %x30-39 ; 0-9 DIGIT = %x30-39 ; 0-9
; abbreviated here ; abbreviated here
' '
Figure 4: Example: employing RFC 3339 ABNF for defining CBOR Tags Figure 4: Example: employing RFC 3339 ABNF for defining CBOR Tags
4. Features 4. Features
Traditionally, the kind of validation enabled by languages such as Commonly, the kind of validation enabled by languages such as CDDL
CDDL provided a Boolean result: valid, or invalid. provides a Boolean result: valid, or invalid.
In rapidly evolving environments, this is too simplistic. The data In rapidly evolving environments, this is too simplistic. The data
models described by a CDDL specification may continually be enhanced models described by a CDDL specification may continually be enhanced
by additional features, and it would be useful even for a by additional features, and it would be useful even for a
specification that does not yet describe a specific future feature to specification that does not yet describe a specific future feature to
identify the extension point the feature can use, accepting such identify the extension point the feature can use, accepting such
extensions while marking them as such. extensions while marking them as such.
The ".feature" control annotates the target as making use of the The ".feature" control annotates the target as making use of the
feature named by the controller. The latter will usually be a feature named by the controller. The latter will usually be a
 End of changes. 6 change blocks. 
9 lines changed or deleted 9 lines changed or added

This html diff was produced by rfcdiff 1.48. The latest version is available from http://tools.ietf.org/tools/rfcdiff/