Re: [apps-discuss] ??: New round of comments on draft-greevenbosch-appsawg-cbor-cddl-04

Bert Greevenbosch <ietf@bertgreevenbosch.nl> Mon, 26 January 2015 10:30 UTC

Return-Path: <ietf@bertgreevenbosch.nl>
X-Original-To: apps-discuss@ietfa.amsl.com
Delivered-To: apps-discuss@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id C5FC91A8897 for <apps-discuss@ietfa.amsl.com>; Mon, 26 Jan 2015 02:30:45 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 4.261
X-Spam-Level: ****
X-Spam-Status: No, score=4.261 tagged_above=-999 required=5 tests=[BAYES_20=-0.001, FF_IHOPE_YOU_SINK=2.166, HELO_EQ_NL=0.55, HOST_EQ_NL=1.545, HTML_MESSAGE=0.001] autolearn=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 bdLeP5y4FOi4 for <apps-discuss@ietfa.amsl.com>; Mon, 26 Jan 2015 02:30:42 -0800 (PST)
Received: from filter3.mijndomein.nl (filter3.mijndomein.nl [IPv6:2a00:4e40:1:1::9:3]) (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 5979A1A88A3 for <apps-discuss@ietf.org>; Mon, 26 Jan 2015 02:30:40 -0800 (PST)
Received: from smtp3.mijndomein.nl ([188.93.148.187]) by filter3.mijndomein.nl with esmtps (TLSv1.2:DHE-RSA-AES128-SHA:128) (Exim 4.84) (envelope-from <ietf@bertgreevenbosch.nl>) id 1YFgw0-0002A5-S5; Mon, 26 Jan 2015 10:30:38 +0000
Received: from a83-163-56-175.adsl.xs4all.nl ([83.163.56.175] helo=[192.168.178.34]) by smtp3.mijndomein.nl with esmtpsa (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from <ietf@bertgreevenbosch.nl>) id 1YFgvw-000GvG-91; Mon, 26 Jan 2015 11:30:16 +0100
X-BL: passed SBL and XBL
Message-ID: <54C61737.50203@bertgreevenbosch.nl>
Date: Mon, 26 Jan 2015 11:30:15 +0100
From: Bert Greevenbosch <ietf@bertgreevenbosch.nl>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0
MIME-Version: 1.0
To: Jim Schaad <ietf@augustcellars.com>
References: <042b01d031fe$0c7edfc0$257c9f40$@augustcellars.com> <D0C6C869A85CC246A93F3F5823FB45385428B60B@SZXEMA509-MBX.china.huawei.com> <54BDFBF3.9010101@bertgreevenbosch.nl> <031201d035ab$5077e9a0$f167bce0$@augustcellars.com>
In-Reply-To: <031201d035ab$5077e9a0$f167bce0$@augustcellars.com>
Content-Type: multipart/alternative; boundary="------------070600020209030307090506"
X-Filter-ID: s0sct1PQhAABKnZB5plbIbeyMPxSrGSJ4SQMxQlCFaEuE/LxIE34C/qwVUIcAs0scX1DsKxrfqSx 4PYxEQ1EGuxuDFJFNtN290+JywvAVMeP5iLc32Iw5qlEMDg85ZT+sqNYUlS/Pz/NUzwJMQ2WsP/Q 5JdvnZgHe6QklmSGfOrX3/7h7YP0zNYn4pUCVtIessGtn5x4MNFdXOCKXiWGTb/RQYB537hdIOmp XP+hH3exnz9PxZsWpghWTVPsq9/lCGWZKAKmtzBlNDXU39YLhGHr3G4hRYbecfvVuPjOGWJxdN/Y iezjBJI0QzE5uL/HXIDYmIO5MaByvz1GY8RZnArdi95bIaYBWldOmLuXQrVGJWOteWaoXFvbbwb3 Cge7mLIENHbaOnKR9I36sQzEGO0xO/0DPDy8+H6Y7XlgtCXDqcigOvSxdRnthmhn8Zn6FvuBiGoU 4Agjav+dcUaPtyTVr0ifmZFLoMCp3QjQ26nPaxFm6QYN0g9/559IwGJXQqHFAxHHyzEglvCW8rgZ 27sEGLV/Wn8v8RE7aRPUKGW5w+pZ2xHl9URp7H2O1P9LEcomSxZ0NLtVmCgIkNSeulrha91ByuhW XHYk4eYA7XAbk26wNS0s1ox7tcHLX7jvg8CBO1Snvm6qXHQp7O9kde6UF/g9IJ5OLPBBDBaN9U4G zksPRhc8k44v9RkKreKb6J1fhOzjF0b4LXcjJZ5lotmXu8UK157zeeBKyRPnLOZGwgCkvTeKqvnp sboaU8uY927hvFGbkmfOtciXT8ciWcAf9nRxmHUjga4/b+cmkFw=
X-Report-Abuse-To: spam@filter1.mijndomein.nl
X-Filter-Fingerprint: IFrWXGses7OKB5S5G8/dJR8Z5VD7FZiiT9tK6RAzQuhA3cTUQ1R++keuE7RDJ8Kg3RbMLUalw1oC mj99/u+PoqoVy8a3lsStJtAvpObFX0W9pwnCLfzqMQ4SqlQant4mUpndEJ0YoaLytXXo8BMTaX2p Mk7LBarWD9Fj4R3eIu5cOy/3Wm9qfF/CZNvP/2Kowv61T+KDYyYtREgszdyFwv8IxCB3p/oCKvxr eyISh3JGb7OS5oVgiO+kDxZrVPLz3MmEGC2PrUKqLq5WmHK+Nw==
X-Originating-IP: 188.93.148.187
X-Mijndomein.nl-Domain: mijndomein.nl
X-Mijndomein.nl-Username: 188.93.148.187
Authentication-Results: mijndomein.nl; auth=pass smtp.auth=188.93.148.187
X-Mijndomein.nl-Outgoing-Class: ham
X-Mijndomein.nl-Outgoing-Evidence: Combined (0.02)
X-Recommended-Action: accept
Archived-At: <http://mailarchive.ietf.org/arch/msg/apps-discuss/NX86ZQImhoRu9X-M0WSwdyg_OVs>
Cc: apps-discuss@ietf.org, draft-greevenbosch-appsawg-cbor-cddl@tools.ietf.org
Subject: Re: [apps-discuss] ??: New round of comments on draft-greevenbosch-appsawg-cbor-cddl-04
X-BeenThere: apps-discuss@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: General discussion of application-layer protocols <apps-discuss.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/apps-discuss>, <mailto:apps-discuss-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/apps-discuss/>
List-Post: <mailto:apps-discuss@ietf.org>
List-Help: <mailto:apps-discuss-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/apps-discuss>, <mailto:apps-discuss-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 26 Jan 2015 10:30:46 -0000

Hi Jim,

Thank you for your feedback. Please find my response inline, preceded 
with "[BG]".

Best regards,
Bert


On 21-01-15 19:51, Jim Schaad wrote:
>
> *From:*Bert Greevenbosch [mailto:ietf@bertgreevenbosch.nl]
> *Sent:* Monday, January 19, 2015 10:56 PM
> *To:* Jim Schaad
> *Cc:* draft-greevenbosch-appsawg-cbor-cddl@tools.ietf.org
> *Subject:* Re: ??: New round of comments on 
> draft-greevenbosch-appsawg-cbor-cddl-04
>
> Hi Jim,
>
> Thank you for your comments. They are very helpful. Please find my 
> answers below.
>
> B.T.W.,would you mind including the apps-discuss mailing list in this 
> discussion? It may be good for the chairs and others to see activity 
> on this draft.
>
> /1. You have a length restriction on float, do you see a need for 
> begin able to do length restrictions on int, tstr and bstr? I don't 
> know if a restriction based on number of bytes or based on a value 
> range would be better. It make sense to use the () syntax to specify a 
> length restriction since you are already using it for float. /
>
> I started out with such notation, e.g. "int(16)" for a 16-bit integer. 
> However, there is a difference between ints and floats: for any 
> integer number, it is easy to find out how much bits are needed. Hence 
> we could allow some freedom in choosing the number of bits on a 
> per-number basis on the encoder side. This was a comment from Carsten, 
> and we subsequently removed the "int(16)" notation.
>
> For floats, this is harder, as the number of bits does not depend on 
> the value of the variable, but on the precision with which we want to 
> represent that variable. For example, the value 1/3 can be represented 
> using both a float(16) and a float(32), but the latter representation 
> would be closer to the real value than the former.
>
> [JLS] What I was looking for was a size limitation which might be 
> helpful.  That is the integer that goes here is limited to 16 bits.
>
[BG] Ah yes, that may be helpful. It would mean a slightly different 
meaning of "(16)" in "float(16)" and "uint(16)", but I could easily get 
used to that.
>
>
> /3. I will reiterate the request for some type of alternate syntax for 
> types - i.e. TypeA or TypeB
> /
> I like your earlier proposed notation:
>
> price: uint | float(16)
>
> and think we can implement this in the next version of the draft.
>
> /2. You have removed the union/choice structure from the document. I 
> highly recommend that this be added back in some form. /
>
> I think we can use the same solution for (3) as well, as follows:
>
> *smallStructure1 {
>    dish: tstr;
>    recipe: tstr;
> }
>
> *smallStructure2 {
>    drink: tstr;
>    price: int;
> }
>
> *BigStructure : {
>    subStructure: smallStructure1 | smallStructure2;
> }
>
> Interesting would be how to distinguish between smallStructure1 and 
> smallStructure2. Especially in the following case:
>
> *smallStructure1 {
>    dish: tstr;
>    recipe: tstr;
> }
>
> *smallStructure2 {
>    drink: tstr;
>    ingredients: tstr;
> }
>
> *BigStructure : {
>    subStructure: smallStructure1 | smallStructure2;
> }
>
> The last may need some more consideration.
>
> [JLS] while one could use tags – is there a reason not to go back to 
> the world of using an int field to discriminate?
>
[BG] Any way of signalling to the application which of the two 
structures is meant is indeed required. This could be through an integer 
that contains a field-id, or in other ways e.g. through the semantics of 
the rest of the data structure. What I mean is, that it may be obvious 
to the application which structure is meant by inspecting earlier fields.

For automatic parsing of such structure, this would be much harder 
though. A complex parser could perform "best effort parsing", whereas a 
simpler parser could consider ignoring verification of variables with 
alternative structures as datatype. (Simple datatypes should be easy to 
handle for simple parsers too.)

>
> /4. A structure can be folded at the top level into a structure by not 
> using the '*' operator on a type. Do you want to be able to do the 
> same type of thing for a map?
> /
> Not sure about this. Do you have an example?
>
> CDDL maps need a CBOR map encoding. A structure, however, does not 
> necessarily require what I call an "encompassing array". Thus the 
> encompassing array is signalled by the asterisk, because there is a 
> choice.
>
> [JLS] If one looks at the COSE document that I am working on.  One can 
> define three maps, one each for an EC key, for an RSA key and for a 
> secret key.  One can then define a base key with common fields that 
> are not algorithm specific.  One could then define  single map that 
> included each of the other items into it by reference rather than as 
> sub items.
>
> COSE_KEY : map { base_key; rsa_key; ec_key; secret_key }
>
[BG] OK, I see, so you want to define a single base_key, and then only 
one of rsa_key, ec_key, secret_key. Something like:

map {
   "base_key": bstr;
   choice {
     "rsa_key": bstr;
     "ec_key" : bstr;
     "secret_key": bstr;
   }
}

(The choice construct doesn't exist in CDDL, I am just thinking here.)

With the issue of identifiers above in mind, one could think of 
something like a simple switch statement, which only takes primitive 
types as input. For example:

map {
   "base_key": bstr;
   "key_type": uint;
   switch("key_type") {
     0: "rsa_key": bstr;
     1: "ec_key": bstr;
     2: "secret_key": bstr;
   }
}

Maybe something to about further.

Best regards,
Bert

>
>
> /5. I don't understand the last example in section 4.5.1 - You are 
> combining a structure and a map together into a single item. Would the 
> syntax "ToString: map(., tstr)" be a better example? This is a map in 
> this case and that is what you are talking about
> /
> Yes, indeed this would be better:
>
> toString: map( ., tstr );
>
> (Notice the lower case "t" at the beginning, this is a convention I 
> use for variable names, although it is not mandatory.)
>
> Best regards,
> Bert
>
> On 19-01-15 01:59, Sunruinan wrote:
>
>     Hi Bert, I received such email from Jim. Since I can't find it in
>     appsawg email list, I think this is a system automatic email, is
>     it right? Can I find some web pages about these comments? As the
>     title of this email, it means New round of comments. Are these
>     comments has some relationship with the previous round comments?
>     Thank you in advance for your reply! Best Regards! Ruinan -----邮
>     件原件----- 发 件人: Jim Schaad [mailto:ietf@augustcellars.com] 发
>     送时间: 2015年1月17日 10:34 收 件人:
>     draft-greevenbosch-appsawg-cbor-cddl@tools.ietf.org
>     <mailto:draft-greevenbosch-appsawg-cbor-cddl@tools.ietf.org> 主题:
>     New round of comments on draft-greevenbosch-appsawg-cbor-cddl-04
>     Here comes a new round of comments on the draft. I have tried not
>     hit the same points again. 1. You have a length restriction on
>     float, do you see a need for begin able to do length restrictions
>     on int, tstr and bstr? I don't know if a restriction based on
>     number of bytes or based on a value range would be better. It make
>     sense to use the () syntax to specify a length restriction since
>     you are already using it for float. 2. You have removed the
>     union/choice structure from the document. I highly recommend that
>     this be added back in some form. 3. I will reiterate the request
>     for some type of alternate syntax for types - i.e. TypeA or TypeB
>     4. A structure can be folded at the top level into a structure by
>     not using the '*' operator on a type. Do you want to be able to do
>     the same type of thing for a map? 5. I don't understand the last
>     example in section 4.5.1 - You are combining a structure and a map
>     together into a single item. Would the syntax "ToString: map(.,
>     tstr)" be a better example? This is a map in this case and that is
>     what you are talking about Jim .
>
>
> -- Bert Greevenbosch ietf@bertgreevenbosch.nl 
> <mailto:ietf@bertgreevenbosch.nl>
>
>
>
> Best regards,
> Bert
>
> On 20-01-15 07:09, Sunruinan wrote:
>
>     Hi Jim,
>
>     Thank you for your comments!
>
>     Since Bert is original editor of this draft and more familiar with previous discussion, I forward your comments to his new email address.
>
>     He can give some answers.
>
>       
>
>     Best Regards!
>
>     Ruinan Sun
>
>     Huawei
>
>       
>
>     -----邮件原件-----
>
>     发件人: Jim Schaad [mailto:ietf@augustcellars.com]
>
>     发送时间: 2015年1月17日  10:34
>
>     收件人:draft-greevenbosch-appsawg-cbor-cddl@tools.ietf.org  <mailto:draft-greevenbosch-appsawg-cbor-cddl@tools.ietf.org>
>
>     主题: New round of comments on draft-greevenbosch-appsawg-cbor-cddl-04
>
>       
>
>     Here comes a new round of comments on the draft.  I have tried not hit the same points again.
>
>       
>
>     1. You have a length restriction on float, do you see a need for begin able to do length restrictions on int, tstr and bstr?  I don't know if a restriction based on number of bytes or based on a value range would be better.  It make sense to use the () syntax to specify a length restriction since you are already using it for float.
>
>       
>
>     2. You have removed the union/choice structure from the document.  I highly recommend that this be added back in some form.
>
>       
>
>     3. I will reiterate the request for some type of alternate syntax for types
>
>     - i.e. TypeA or TypeB
>
>       
>
>     4. A structure can be folded at the top level into a structure by not using
>
>     the '*' operator on a type.   Do you want to be able to do the same type of
>
>     thing for a map?
>
>       
>
>     5. I don't understand the last example in section 4.5.1 - You are combining a structure and a map together into a single item.  Would the syntax
>
>     "ToString: map(., tstr)" be a better example?  This is a map in this case and that is what you are talking about
>
>       
>
>       
>
>     Jim
>
>     .
>
>       
>