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

Henk Birkholz <henk.birkholz@sit.fraunhofer.de> Fri, 08 May 2020 10:19 UTC

Return-Path: <henk.birkholz@sit.fraunhofer.de>
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 8CC413A09AA for <cbor@ietfa.amsl.com>; Fri, 8 May 2020 03:19:46 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.899
X-Spam-Level:
X-Spam-Status: No, score=-1.899 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham 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 v_lofGCV5wuU for <cbor@ietfa.amsl.com>; Fri, 8 May 2020 03:19:41 -0700 (PDT)
Received: from mail-edgeDD24.fraunhofer.de (mail-edgeDD24.fraunhofer.de [192.102.167.24]) (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 9946A3A09A0 for <cbor@ietf.org>; Fri, 8 May 2020 03:19:39 -0700 (PDT)
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A2EVBABkpYde/xmnZsBmGwEBAQEBAQEFAQEBEQEBAwMBAQGBe4F9LGwDVS8qCoQRjnmBZC2bPQoKAQEBAQEBAQEBBgEBGAsKAgQBAQKEQgKCRyQ4EwIQAQEGAQEBAQEFBAICaYVWDINTfgEBAQEBAQEBAQEBAQEBAQEBAQEWAkNVEgEBHgEBAQMBASEPAQU2CxAJAg4KAgImAgInIBAGAQwBBQIBAYMiAYJ8BAuTP5t5gTKFS4NngTgGgQ4qjDEPgUw/gREnD4IsLj6CZwEBhHeCXgSQf6ATB4FJd3wElh8jgkyIOIQxBYxGjzKcHQIEAgkCFYFpI4FXTSRPgmlQGA2OJgMXFW8BCIdXhUNygSmNGQGBDwEB
X-IPAS-Result: A2EVBABkpYde/xmnZsBmGwEBAQEBAQEFAQEBEQEBAwMBAQGBe4F9LGwDVS8qCoQRjnmBZC2bPQoKAQEBAQEBAQEBBgEBGAsKAgQBAQKEQgKCRyQ4EwIQAQEGAQEBAQEFBAICaYVWDINTfgEBAQEBAQEBAQEBAQEBAQEBAQEWAkNVEgEBHgEBAQMBASEPAQU2CxAJAg4KAgImAgInIBAGAQwBBQIBAYMiAYJ8BAuTP5t5gTKFS4NngTgGgQ4qjDEPgUw/gREnD4IsLj6CZwEBhHeCXgSQf6ATB4FJd3wElh8jgkyIOIQxBYxGjzKcHQIEAgkCFYFpI4FXTSRPgmlQGA2OJgMXFW8BCIdXhUNygSmNGQGBDwEB
X-IronPort-AV: E=Sophos;i="5.72,341,1580770800"; d="scan'208";a="31669664"
Received: from mail-mtadd25.fraunhofer.de ([192.102.167.25]) by mail-edgeDD24.fraunhofer.de with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 May 2020 12:19:37 +0200
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A0BlEAC9MbVe/1lIDI1mHAEBAQEBAQcBARIBAQQEAQFAgUeBfS1vA1QwLAqEGo58gWQtm2ELAQMBAQEBAQYBARgLCgIEAQGERAKCDSQ4EwIQAQEFAQEBAgEFBG2FVgyFcgEBAQMBASEPAQU2CxAJAg4KAgImAgInIBAGAQwBBQIBAYMiAYMAC5QHm3mBMoVRg1aBOgaBDiqMRA+BTD+BEScPgiwuPoJnAQGEeYJgBJFOoR0HgU2BAH8Elx8jglyIZ4RUBo0dkB2dKgIEAgkCFYFpIoFWTSRPgmlQGA2QSQMXFW4BCIdXhURBMTcCBgEHAQEDCXyQDQGBDwEB
X-IronPort-AV: E=Sophos;i="5.73,367,1583190000"; d="scan'208";a="81862281"
Received: from mailext.sit.fraunhofer.de ([141.12.72.89]) by mail-mtaDD25.fraunhofer.de with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 May 2020 12:19:33 +0200
Received: from mail.sit.fraunhofer.de (mail.sit.fraunhofer.de [141.12.84.171]) by mailext.sit.fraunhofer.de (8.15.2/8.15.2/Debian-10) with ESMTPS id 048AJUhx009082 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA256 bits=128 verify=NOT); Fri, 8 May 2020 12:19:30 +0200
Received: from [192.168.16.50] (79.234.119.240) by mail.sit.fraunhofer.de (141.12.84.171) with Microsoft SMTP Server (TLS) id 14.3.487.0; Fri, 8 May 2020 12:19:25 +0200
To: Carsten Bormann <cabo@tzi.org>, Kio Smallwood <kio@mothers-arms.co.uk>
CC: cbor@ietf.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> <5dac70881c52c6fde0fc80c87363386e@mothers-arms.co.uk> <CB09ED21-23E2-44A7-879F-D94DBCE9BDDE@tzi.org>
From: Henk Birkholz <henk.birkholz@sit.fraunhofer.de>
Message-ID: <991b9e36-dd49-d2d9-302a-78a829374fd1@sit.fraunhofer.de>
Date: Fri, 08 May 2020 12:19:24 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0
MIME-Version: 1.0
In-Reply-To: <CB09ED21-23E2-44A7-879F-D94DBCE9BDDE@tzi.org>
Content-Type: text/plain; charset="utf-8"; format="flowed"
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-Originating-IP: [79.234.119.240]
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/4SU0bXVz4XikEHy89lFWNEB5uyQ>
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 10:19:47 -0000

Hi all,

quick note. I think it is sufficient to highlight "utilized bytes", it 
should also be expected that "a byte might not be used entirely", e.g. 
the last byte that might not be completely used by a bit string. That 
maps nicely to CBOR, simplifies the post-processing and would eliminate 
the additional use of a trailing negative number (please mind, not 
singed int).

That said, the "trailing negative number" is not a bad idea. I am just 
wondering, if we might want to "imply" a trailing negative number for 
bytes not entirely used for a bit string all the time, eliminating the 
need for that trailing negative number to be expressed, in general.

Viele Grüße,

Henk

On 08.05.20 12:05, Carsten Bormann wrote:
> On 2020-05-08, at 11:37, Kio Smallwood <kio@mothers-arms.co.uk> wrote:
>>
>> - 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([])
> 
> Looks good.  Even better: make sure that an overlap cannot even be encoded.
> The numbers in the array could be the number of bytes not sent that are presumed all zero.
> 
> So your first example would become:
> 
> 2020([0, h'0107', 499999998, h'15’])
> 
> Or, actually, since the first zero becomes redundant now,
> 
> 2020([h'0107', 499999998, h'15’])
> 
> So the contents of the array would be byte strings or numbers that indicate gaps by giving the number of zero bytes.
> 
> Numbers should probably be positive (non-zero), and we could forbid adjacent numbers or trailing numbers.  Or we could just make that the preferred encoding and still allow them (including zeros); I don’t have a strong opinion.  (I’m not motivated enough to think about c14n now…)
> 
> [ASN.1 has the ability to indicate that the last byte in a bit string isn’t completely part of the bit string.  A trailing negative number could indicate that.  But I still haven’t seen a true use case for ASN.1 bit strings since I thought about that in 2013…]
> 
> Grüße, Carsten
> 
> _______________________________________________
> CBOR mailing list
> CBOR@ietf.org
> https://www.ietf.org/mailman/listinfo/cbor
>