Re: [Cbor] CDDL style questions

Brian E Carpenter <brian.e.carpenter@gmail.com> Thu, 22 November 2018 19:37 UTC

Return-Path: <brian.e.carpenter@gmail.com>
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 0B7D412426A for <cbor@ietfa.amsl.com>; Thu, 22 Nov 2018 11:37:54 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.999
X-Spam-Level:
X-Spam-Status: No, score=-1.999 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
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 930rEO0QXVWy for <cbor@ietfa.amsl.com>; Thu, 22 Nov 2018 11:37:52 -0800 (PST)
Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 294B212875B for <cbor@ietf.org>; Thu, 22 Nov 2018 11:37:52 -0800 (PST)
Received: by mail-pf1-x42d.google.com with SMTP id w73so2309938pfk.10 for <cbor@ietf.org>; Thu, 22 Nov 2018 11:37:52 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=/friAKPIEqg484+90qNDLwXQgxnpmKeApdz9b3swQgA=; b=NkQdjkFbFfl8aOshNnDkS/jAibrizC7Fjru8NRLO+GYWR41QKaTJDEeNXlwhfvULJX sCG1mRfmrpkT8I306vbHYhfdUIioI54Uo+Zk9PrnbPfuqDVEk7l25rAnfASs6NESlLkb hOWqkoOE5eUR22p8qOS6Jn1kdwPq8n+u/Svz8nCo8VFsbamPVk7sVZmQRfOaHPEIW+wj PPyKPQ1AtNQMlxi4jbTw0ee0LSDMQTULsvHCXCdpwB3fgH2hYcpflXLj394SFbOmdCvQ rrOYghaMZ9l9dDsWvjxY9KaPxieI354ORHhBz6tvPzfKegHxTTLcl4yE7iOYTJR9KIdI d8fA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=/friAKPIEqg484+90qNDLwXQgxnpmKeApdz9b3swQgA=; b=hARMzdJTjS9GwFgokcC/pG8SNk6erAntSoAb6fOWmoOfjMHyhXgjxrHmBGJnQb3OoI SyE/mNzcPV4I4SywOZKNTl5Xy4EYZKAYPL9O6mG2q46XLoLGz0ANxs4U2ogosET6yfiY 3eIMx3BqWtt6BLEpDekDCA0TPU4bGZoACYWq8RktoijzP2DDFRZEg7DBCpqmQ8mkIZQz Vh9OQ9OTk9St4WF1RheQPXXQDtZwb1Im7JHq7NFE8poWkoP6l2YgZT+4Tz6SvTxq46FY ci545/L6Fg26i5aGgAPIN0zfYGncYuga6YIvNGQ5asExfikzrK4Ng+5xax1ZJ5mhyA7s lQgQ==
X-Gm-Message-State: AGRZ1gLi6svVtKfqGM4ZFsOzphwceYwN33HBoPjFZoKqfJuq0j3PMh8q WXsK0F5E/jNPLSRgKC0cBCYfLGia
X-Google-Smtp-Source: AJdET5fm0oI7HkQhnIE/K46pXvMzxDICoMAVJtnC7e3JcMsqG7rUuw9KAoB0/A3XvLMQYHebfFdVGQ==
X-Received: by 2002:aa7:8354:: with SMTP id z20mr12530070pfm.81.1542915471314; Thu, 22 Nov 2018 11:37:51 -0800 (PST)
Received: from [192.168.178.30] ([118.148.76.40]) by smtp.gmail.com with ESMTPSA id l72-v6sm59409032pfi.149.2018.11.22.11.37.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Nov 2018 11:37:50 -0800 (PST)
To: Carsten Bormann <cabo@tzi.org>, Jim Hague <jim@sinodun.com>
Cc: "cbor@ietf.org" <cbor@ietf.org>
References: <5073d637-0608-7503-b323-2e37a644b445@sinodun.com> <551B3855-C0BF-45E9-A481-97908A5609A1@tzi.org>
From: Brian E Carpenter <brian.e.carpenter@gmail.com>
Message-ID: <9ee9e096-e13d-be17-af71-22f205ca208c@gmail.com>
Date: Fri, 23 Nov 2018 08:37:46 +1300
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1
MIME-Version: 1.0
In-Reply-To: <551B3855-C0BF-45E9-A481-97908A5609A1@tzi.org>
Content-Type: text/plain; charset="utf-8"
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/Rb6kXAvTDolmd8swi2GSt7VHEoU>
Subject: Re: [Cbor] CDDL style questions
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: Thu, 22 Nov 2018 19:37:54 -0000

Mainly I agree with Carsten, perhaps because I developed the CDDL for GRASP under his tuition. So I have snipped everything except one point.
On 2018-11-23 04:03, Carsten Bormann wrote:
...
> Without knowing all the details of C-DNS, I would expect that 
> 
>>    Port = uint .size 2
> 
> is a good type to have at hand and use where the semantics ask for a TCP/UDP port.
> 
> (It also immediately exposes the question whether it shouldn’t really be
> 
>     Port = 1..0xFFFF
> 
> i.e., whether 0 should be excluded here. Of course, I don’t know what the answer to that question would be for C-DNS.)

For GRASP we ended up with:

port-number = 0..65535

one reason being that you can indicate an undefined port number by using 0. So it rather depends whether you are defining the type to use in a signaling message (as for GRASP) or to use in an actual transport header.

If anyone cares, the full GRASP CDDL is at https://tools.ietf.org/html/draft-ietf-anima-grasp-15#section-5 .

I did have one regret - using hyphens in names. When writing Python code using the same names, I had to change them all to underscore. Not serious, but a bit annoying.

I felt bad about including:

IPPROTO_TCP = 6
IPPROTO_UDP = 17

I wished I could have imported those from somewhere. As an extension to the style question, is there a role for a library of include files?

    Brian