Re: [Cbor] [netmod] CBOR YANG encoding of union & bits [draft-ietf-core-yang-cbor-12]

Kio Smallwood <kio@mothers-arms.co.uk> Fri, 08 May 2020 09:37 UTC

Return-Path: <kio@mothers-arms.co.uk>
X-Original-To: cbor@ietfa.amsl.com
Delivered-To: cbor@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 4559E3A0969 for <cbor@ietfa.amsl.com>; Fri, 8 May 2020 02:37:56 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.621
X-Spam-Level:
X-Spam-Status: No, score=-1.621 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, KHOP_HELO_FCRDNS=0.275, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001] autolearn=no autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id t8MK7ZrAt9VL for <cbor@ietfa.amsl.com>; Fri, 8 May 2020 02:37:54 -0700 (PDT)
Received: from authenticated.a-painless.mh.aa.net.uk (a-painless.mh.aa.net.uk [IPv6:2001:8b0:0:30::51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 6FA3B3A0968 for <cbor@ietf.org>; Fri, 8 May 2020 02:37:54 -0700 (PDT)
Received: from a-webmail.thn.aa.net.uk ([2001:8b0:62::22] helo=webmail.aa.net.uk) by a-painless.mh.aa.net.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from <kio@mothers-arms.co.uk>) id 1jWzS4-0003O8-Uo; Fri, 08 May 2020 10:37:53 +0100
Received: from cpc104502-sgyl40-2-0-cust104.18-2.cable.virginm.net ([82.34.80.105]) by webmail.aa.net.uk with HTTP (HTTP/1.1 POST); Fri, 08 May 2020 10:37:43 +0100
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="=_a304aec462039ee76c575a323ed1e383"
Date: Fri, 08 May 2020 10:37:43 +0100
From: Kio Smallwood <kio@mothers-arms.co.uk>
To: Carsten Bormann <cabo@tzi.org>
Cc: cbor@ietf.org
In-Reply-To: <853DC97D-91C7-4188-ADE1-AFC2431EFD3B@tzi.org>
References: <BY5PR11MB4355C26250C9CF46713C9956B5A40@BY5PR11MB4355.namprd11.prod.outlook.com> <6ACF0CA3-59C4-4CE1-9344-81B43C75BAF4@tzi.org> <269a22c2b07ee953a09b48c535b28791@mothers-arms.co.uk> <853DC97D-91C7-4188-ADE1-AFC2431EFD3B@tzi.org>
Message-ID: <5dac70881c52c6fde0fc80c87363386e@mothers-arms.co.uk>
X-Sender: kio@mothers-arms.co.uk
User-Agent: Roundcube Webmail/1.3.11
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/UyK8auB_QJezcu2tzS42r1KB5DU>
Subject: Re: [Cbor] [netmod] CBOR YANG encoding of union & bits [draft-ietf-core-yang-cbor-12]
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Concise Binary Object Representation \(CBOR\)" <cbor.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/cbor>, <mailto:cbor-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cbor/>
List-Post: <mailto:cbor@ietf.org>
List-Help: <mailto:cbor-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/cbor>, <mailto:cbor-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 08 May 2020 09:37:56 -0000

Hi Carsten, 

Yes I agree, requiring an array makes more sense. I would prefer a byte
offset instead of a bit offset then you don't need to worry about the
divisible by eight constraint. 

Therefore the specification would be: 

- A tagged array containing: 

- An unsigned integer byte offset 

- followed by one or more contiguous bytes containing set bits 

- the next offset (must be strictly larger than the offset + length of
previous data item) 

- the next byte(s) 

- etc. 

e.g. 

2020([0, h'0107', 500000000, h'15']) 

The following example should result in an error: 

2020([0, h'0107', 1, h'01']) 

A case should be made that each offset+byte pair should have at least
one set bit. So this would be a valid bitfield that's all zeros: 

2020([]) 

Cheers, 

Kio 

On 2020-05-08 7:48, Carsten Bormann wrote:

> If we go for this, as I'm proposing in <https://mailarchive.ietf.org/arch/msg/netmod/hRMjLIIpOyTNtmkv4yd3gyjd_gA>:
> 
> I think we should require that
> 
> -- the offsets are (unsigned and) divisible by 8;
> -- the byte strings do not overlap.
> 
> I'm also not sure we wouldn't want to require the offset/bitstring pairs to be in order, which would need an array instead of a map (as maps are not ordered).
> 
> Grüße, Carsten