Re: [dtn] BPv7 CDDL and CBOR tagging

Brian Sipos <BSipos@rkf-eng.com> Tue, 09 April 2019 00:06 UTC

Return-Path: <BSipos@rkf-eng.com>
X-Original-To: dtn@ietfa.amsl.com
Delivered-To: dtn@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 51ED01200E5 for <dtn@ietfa.amsl.com>; Mon, 8 Apr 2019 17:06:24 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level:
X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, 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 (1024-bit key) header.d=rkfeng.onmicrosoft.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 kzbe2OGpPEls for <dtn@ietfa.amsl.com>; Mon, 8 Apr 2019 17:06:22 -0700 (PDT)
Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-eopbgr770074.outbound.protection.outlook.com [40.107.77.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id E2F531200C7 for <dtn@ietf.org>; Mon, 8 Apr 2019 17:06:21 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rkfeng.onmicrosoft.com; s=selector1-rkfeng-com0i; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=m1cuafeR05zGkH25fOgP8uEr6cK2QvZTgnBZvxYVyRY=; b=ZaU1z0x9q0+zGU5Xlaj91Lx7Jm/meKD8SBHmHbumaPqZKkO1SObmaYsebcHYlkRloBGxeyUL7Y47c31Q5Yv7Y0nKdasIw1tAcWrHYTONiEaED8VcrtA0rj0s7tU8sgF5WrpmDvql6NsLg38VprfjSnmfJfTp+uCtnns0Iazur8o=
Received: from CY4PR1301MB2039.namprd13.prod.outlook.com (10.171.240.14) by CY4PR1301MB2087.namprd13.prod.outlook.com (10.171.240.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1792.8; Tue, 9 Apr 2019 00:06:20 +0000
Received: from CY4PR1301MB2039.namprd13.prod.outlook.com ([fe80::c72:6b85:66ca:845c]) by CY4PR1301MB2039.namprd13.prod.outlook.com ([fe80::c72:6b85:66ca:845c%3]) with mapi id 15.20.1792.009; Tue, 9 Apr 2019 00:06:20 +0000
From: Brian Sipos <BSipos@rkf-eng.com>
To: Carsten Bormann <cabo@tzi.org>
CC: "dtn@ietf.org" <dtn@ietf.org>, Scott Burleigh <scott.c.burleigh@jpl.nasa.gov>
Thread-Topic: [dtn] BPv7 CDDL and CBOR tagging
Thread-Index: AQHU6cwkKjg/bVi0S06SSCrlH9F6SKYvG12AgAPhHQA=
Date: Tue, 09 Apr 2019 00:06:19 +0000
Message-ID: <6773e0f0e03e6e4ddb935f0f02de7ade2bc606b8.camel@rkf-eng.com>
References: <CY4PR1301MB20399B0DD6B59D2D566257379F570@CY4PR1301MB2039.namprd13.prod.outlook.com> <B8DF4499-2EEC-4680-B1AD-9FEF00A907D7@tzi.org>
In-Reply-To: <B8DF4499-2EEC-4680-B1AD-9FEF00A907D7@tzi.org>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-originating-ip: [73.250.91.32]
x-mailer: Evolution 3.28.5 (3.28.5-3.fc28)
x-clientproxiedby: BYAPR05CA0001.namprd05.prod.outlook.com (2603:10b6:a03:c0::14) To CY4PR1301MB2039.namprd13.prod.outlook.com (2603:10b6:910:48::14)
authentication-results: spf=none (sender IP is ) smtp.mailfrom=BSipos@rkf-eng.com;
x-ms-exchange-messagesentrepresentingtype: 1
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 4a652e54-7d5e-4075-0715-08d6bc7f3149
x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(7021145)(8989299)(5600139)(711020)(4605104)(4534185)(7022145)(4603075)(4627221)(201702281549075)(8990200)(7048125)(7024125)(7027125)(7023125)(2017052603328)(7193020); SRVR:CY4PR1301MB2087;
x-ms-traffictypediagnostic: CY4PR1301MB2087:
x-ms-exchange-purlcount: 1
x-microsoft-antispam-prvs: <CY4PR1301MB2087960CE0D421F3D69372C89F2D0@CY4PR1301MB2087.namprd13.prod.outlook.com>
x-forefront-prvs: 000227DA0C
x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(366004)(39830400003)(346002)(376002)(136003)(199004)(189003)(86362001)(386003)(118296001)(6436002)(105586002)(256004)(53546011)(6916009)(97736004)(6506007)(66066001)(52116002)(80792005)(4326008)(99286004)(76176011)(102836004)(6246003)(6486002)(11346002)(446003)(2906002)(26005)(2616005)(508600001)(81166006)(8936002)(68736007)(53936002)(71190400001)(486006)(8676002)(14454004)(81156014)(186003)(71200400001)(25786009)(229853002)(3846002)(6306002)(476003)(5660300002)(50226002)(6512007)(316002)(36756003)(106356001)(966005)(305945005)(6116002)(72206003)(7736002)(54906003)(99106002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR1301MB2087; H:CY4PR1301MB2039.namprd13.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1;
received-spf: None (protection.outlook.com: rkf-eng.com does not designate permitted sender hosts)
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam-message-info: TfwWiqaxbdP68tGWJ9qRTx3XAX2I07S00tOLbl2FSwsSnazBw5Zfh8tu/qMEhcS4Hb6717I1DvVxVoczDBELVVLIv7H/bMN8zEpv2UMqYmvDLBDAlmVRSMBXumOUp2nL3SQPBErgd4jwoqWpXVdeKYLzkbr8I9Q4OQKkfg2DbcSRTEK1MmeJVxtRrTT3fsJp+oTIR0/pNcb3IBAZ2+yB3sktErYe5wXQBF7w0bOTaNcUoa+Xcv3d8oonmd+Q8TCbdsxQKP6yBD3gWN2Ox1CyPE57esrbspVMcWu/1Udb/4nH26N+3DQPUBx7wyMws49SE5Su4FwzaMrpfKMY3pzRZZC9QprIaF+RRL1lk/O2AQoX0rGn0bSXB2VoJxjp1D1bt1yD8WtdW1RWp23BsO8/9dH5G/bijMTJlfBU5K7oK+Q=
Content-Type: text/plain; charset="utf-8"
Content-ID: <9130046595CCE446AF2E101C069D0D1B@namprd13.prod.outlook.com>
Content-Transfer-Encoding: base64
MIME-Version: 1.0
X-OriginatorOrg: rkf-eng.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 4a652e54-7d5e-4075-0715-08d6bc7f3149
X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2019 00:06:19.9936 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 4ed8b15b-911f-42bc-8524-d89148858535
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1301MB2087
Archived-At: <https://mailarchive.ietf.org/arch/msg/dtn/9hK5MsGYZfoLTbQm1F2fpQtQkzQ>
Subject: Re: [dtn] BPv7 CDDL and CBOR tagging
X-BeenThere: dtn@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Delay Tolerant Networking \(DTN\) discussion list at the IETF." <dtn.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/dtn>, <mailto:dtn-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/dtn/>
List-Post: <mailto:dtn@ietf.org>
List-Help: <mailto:dtn-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/dtn>, <mailto:dtn-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 09 Apr 2019 00:06:24 -0000

On Sat, 2019-04-06 at 14:51 +0200, Carsten Bormann wrote:
> On Apr 3, 2019, at 21:14, Brian Sipos <BSipos@rkf-eng.com> wrote:
> > 
> > 		• A disconnect between the “canonical-block" definition
> > and the "extension-block" and "payload-block" uses (which are just
> > canonical-block type with value restrictions, probably using
> > ".within").
> 
> Right, it would help to define payload-block and extension-block, and
> .within could be used to reference canonical-block (which is
> currently unused).
> 
> The text of 4.2.1 in -12 starts with a paragraph that ends in:
> 
>    The last item of
>    the array SHALL be a CBOR “break" stop code.
> 
> A break stop code is not a data item, but is the part of an
> indefinite-length array encoding that ends it (the same change needs
> to be made in the second paragraph of the start of section 4).  So
> the text seems to be trying to say
> 
>    bundle = [primary-block, *canonical-block]
> 
> The CDDL in Appendix B is more specific:
> 
>    bundle = [primary-block, *extension-block, payload-block]
> 
> So there must be a payload-block as the last data item, and zero or
> more extension-blocks preceding it, which according to the text in
> 4.2.1 all need to be of canonical-block structure.
> 
> Is there something from the text about extension-block and payload-
> block that could be encoded in a CDDL definition of these two?
> 
> So far, I have found text that makes be believe
> 
> payload-block = ([block-type-code: 1, canonical-block-common, ?crc])
> .within canonical-block
> 
> and
> 
> extension-block = ([block-type-code: (uint .ne 1), canonical-block-
> common, ?crc]) .within canonical-block
> 
I believe that this is correct, and there is one more constraint that
the payload block itself always has block number zero [1]. Though I
don't know how much value there is in adding that to the CDDL since it
really doesn't seem to have any negative effects if the payload block
happens to have some other block number...

> BTW, the CDDL for primary block ends in three optional components,
> two of which are of the same type, so it is not clear whether you
> have a primary-block with a fragment-offset but without a total-
> application-data-length or a primary block with a total-application-
> data-length but no fragment-offset.
> 
Those last three items are not determined via type introspection but by
checking the bundle flags. So it's not something that seems like CDDL
can encode or check (so violations may result in interesting or
confusing errors from a generic validator).

Since the two optional uint values must come together, the existing
CDDL of:
                 lifetime: uint,
                 ? fragment-offset: uint,
                 ? total-application-data-length: uint,
                 ? crc,
could more accurately be represented by the CDDL:
                 lifetime: uint,
                 ? (
                   fragment-offset: uint,
                   total-application-data-length: uint
                 ),
                 ? crc,


This also brings up the administrative record, which does not yet have
a CDDL representation. The following seems like it should be a decent
start to that. This uses the CDDL notion of an abstract "socket"
prefixed with a dollar sign.

  admin-record = $admin-record .within admin-record-structure
  admin-record-structure = [
    record-type-code: uint,
    record-content: any
  ]

  $admin-record /= [1, status-record-content]
  status-record-content = [
    bundle-status-information,
    status-report-reason-code: uint,
    source-node-eid: eid-generic,
    subject-creation-timestamp: creation-timestamp,
    ? (
      subject-payload-offset: uint,
      subject-payload-length: uint
    )
  ]
  bundle-status-information = [
    reporting-node-received-bundle: status-info-content,
    reporting-node-forwarded-bundle: status-info-content,
    reporting-node-delivered-bundle: status-info-content,
    reporting-node-deleted-bundle: status-info-content
  ]
  status-info-content = [
    status-indicator: bool,
    ? timestamp: dtn_time
  ]

[1]: https://tools.ietf.org/html/draft-ietf-dtn-bpbis-12#section-4.2.3