Re: [Cbor] Considerations for converting from other serializations formats like Protocol Buffers and FlatBuffers

Carsten Bormann <cabo@tzi.org> Fri, 10 April 2020 15:59 UTC

Return-Path: <cabo@tzi.org>
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 2D7EE3A044D for <cbor@ietfa.amsl.com>; Fri, 10 Apr 2020 08:59:33 -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 Ytfi1G26Vquy for <cbor@ietfa.amsl.com>; Fri, 10 Apr 2020 08:59:30 -0700 (PDT)
Received: from gabriel-vm-2.zfn.uni-bremen.de (gabriel-vm-2.zfn.uni-bremen.de [134.102.50.17]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 2A2793A044A for <cbor@ietf.org>; Fri, 10 Apr 2020 08:59:29 -0700 (PDT)
Received: from [172.16.42.112] (p548DCD70.dip0.t-ipconnect.de [84.141.205.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gabriel-vm-2.zfn.uni-bremen.de (Postfix) with ESMTPSA id 48zN4J0yPWzyxG; Fri, 10 Apr 2020 17:59:28 +0200 (CEST)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\))
From: Carsten Bormann <cabo@tzi.org>
In-Reply-To: <CANcmUPHvT+o4uckLOTH54h=ZS3pubhyeQ4guxbmdRcVkC91mWA@mail.gmail.com>
Date: Fri, 10 Apr 2020 17:59:23 +0200
Cc: cbor@ietf.org
X-Mao-Original-Outgoing-Id: 608227163.830824-e92c017b9760f8dac035dcd74af8c67d
Content-Transfer-Encoding: quoted-printable
Message-Id: <F545572B-900C-4FCB-8D7D-1961242AEA8F@tzi.org>
References: <CANcmUPHvT+o4uckLOTH54h=ZS3pubhyeQ4guxbmdRcVkC91mWA@mail.gmail.com>
To: Jonathan Beri <jmberi@gmail.com>
X-Mailer: Apple Mail (2.3608.80.23.2.2)
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/UwzKYIGYuMe2cex3DLcfIOnX3-Y>
Subject: Re: [Cbor] Considerations for converting from other serializations formats like Protocol Buffers and FlatBuffers
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, 10 Apr 2020 15:59:33 -0000

Hi Jonathan,

Such a conversion is always “interesting" because of the different generic data models of the different data formats.

CDDL essentially is used to define a subset of the generic data model of CBOR.  It also can “parse” or “construct", so it could be used as a front-end/back-end to such a conversion format, but we would need a Format-X back-end/front-end as well.  And some of this will be idiomatic (e.g., very idiomatic in JSON), so you don’t want to need to say the idiomatic things all the time.  Some conversions will even need computations (say, a JSON enum into a CBOR bit string).

We have done something related to a conversion process (uncompressed vs. compressed) in RFC 4997.  This notation was also saddled with needing to do its own binary decoding/encoding (which still would be useful as another front-end/back-end of the above!), but the idea of having statements that connect on two sides to two different worlds is immediately applicable.
SCHC <https://tools.ietf.org/html/draft-ietf-lpwan-ipv6-static-context-hc-24> is a contemporary attempt to do a bidirectional conversion, but it is somewhat specialized to “packet”-type data.

Note also that T2TRG has done a little work on “YOUPI” <https://tools.ietf.org/html/draft-petrov-t2trg-youpi-01>, which is another way to look at binary data.

As you can see, I think some of this is research, and it borders on the WISHI/One-data-model work that we are doing in T2TRG.  I would really like it if you could bring in your ideas there.

Grüße, Carsten




> On 2020-04-10, at 17:34, Jonathan Beri <jmberi@gmail.com> wrote:
> 
> Hello,
> 
> I'm looking into a use case that would require converting data from existing systems that output in well-defined serialization formats (specifically Protocol Buffers and FlatBuffers) to CBOR. The goal is in part to use other specifications like CoAP with this data as as well an existing implementation of CoAP.
> 
> Has there been any investigation into converting to these formats? Any lessons or points to consider? I've been reading up on CDDL - might that help in implementing a conversion process?
> 
> Many thanks.
> 
> -- 
> Jonathan Beri
> linkedin.com/in/jonathanberi
> _______________________________________________
> CBOR mailing list
> CBOR@ietf.org
> https://www.ietf.org/mailman/listinfo/cbor