Re: [dtn] BPv7 CDDL and CBOR tagging

Brian Sipos <BSipos@rkf-eng.com> Sat, 13 April 2019 16:13 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 505981200B8 for <dtn@ietfa.amsl.com>; Sat, 13 Apr 2019 09:13:53 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.901
X-Spam-Level:
X-Spam-Status: No, score=-1.901 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, SPF_PASS=-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 8Bkik6903iRw for <dtn@ietfa.amsl.com>; Sat, 13 Apr 2019 09:13:49 -0700 (PDT)
Received: from NAM04-CO1-obe.outbound.protection.outlook.com (mail-co1nam04on0614.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe4d::614]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 0A069120788 for <dtn@ietf.org>; Sat, 13 Apr 2019 09:13:48 -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=Mbr7AjiWWdzgrFj3pdCXA6XUHWuNUnHSZhSAhfvqUHM=; b=ekoxzetPyZLh9vr1kS2Pk4vlrr5nEOg9Gu11C50wK9GrqrBwBz/52o91MbZGKGmd8aGZaWJBYLSUmaLJgLsZtJMrHLnBb6u3mq9aDODp2s/4jaLi6lTk9ZGIOlrRooUPjiAwc3PwVrB09RoIonzyUHhvN/yhbIlR/0YV1fm8DnU=
Received: from CY4PR1301MB2039.namprd13.prod.outlook.com (10.171.240.14) by CY4PR1301MB2184.namprd13.prod.outlook.com (10.171.220.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1792.11; Sat, 13 Apr 2019 16:13:45 +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; Sat, 13 Apr 2019 16:13:45 +0000
From: Brian Sipos <BSipos@rkf-eng.com>
To: "Burleigh, Scott C (312B)" <scott.c.burleigh=40jpl.nasa.gov@dmarc.ietf.org>, Carsten Bormann <cabo@tzi.org>
CC: "dtn@ietf.org" <dtn@ietf.org>
Thread-Topic: [dtn] BPv7 CDDL and CBOR tagging
Thread-Index: AQHU6cwkKjg/bVi0S06SSCrlH9F6SKYvG12AgAPhHQCAABXEAIABoVmAgADXHoCABMlagA==
Date: Sat, 13 Apr 2019 16:13:45 +0000
Message-ID: <6f04408aeaa6a70593f771c99d6d3412c5a68b8e.camel@rkf-eng.com>
References: <CY4PR1301MB20399B0DD6B59D2D566257379F570@CY4PR1301MB2039.namprd13.prod.outlook.com> <B8DF4499-2EEC-4680-B1AD-9FEF00A907D7@tzi.org> <6773e0f0e03e6e4ddb935f0f02de7ade2bc606b8.camel@rkf-eng.com> <670af7e65e8c4746947b0833690f4625@jpl.nasa.gov> <1069e920de24c960ca46b3172d99db44802a3b2b.camel@rkf-eng.com> <77a455395d2c4495986cceeef84edd8e@jpl.nasa.gov>
In-Reply-To: <77a455395d2c4495986cceeef84edd8e@jpl.nasa.gov>
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: BL0PR02CA0143.namprd02.prod.outlook.com (20.177.207.112) To CY4PR1301MB2039.namprd13.prod.outlook.com (10.171.240.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: 1fcf6291-f560-43f6-15ba-08d6c02b004f
x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(7021145)(8989299)(4534185)(7022145)(4603075)(4627221)(201702281549075)(8990200)(7048125)(7024125)(7027125)(7023125)(5600139)(711020)(4605104)(2017052603328)(7193020); SRVR:CY4PR1301MB2184;
x-ms-traffictypediagnostic: CY4PR1301MB2184:
x-ms-exchange-purlcount: 2
x-microsoft-antispam-prvs: <CY4PR1301MB2184CEFC73714B201D4E8F789F290@CY4PR1301MB2184.namprd13.prod.outlook.com>
x-forefront-prvs: 00064751B6
x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(396003)(346002)(39830400003)(136003)(376002)(199004)(13464003)(189003)(6246003)(71190400001)(386003)(66066001)(508600001)(966005)(106356001)(76176011)(305945005)(53546011)(256004)(14444005)(229853002)(186003)(25786009)(8936002)(93886005)(6506007)(50226002)(99286004)(118296001)(476003)(72206003)(7736002)(14454004)(2616005)(105586002)(446003)(36756003)(68736007)(11346002)(102836004)(6512007)(6116002)(316002)(53936002)(97736004)(6306002)(6436002)(4326008)(71200400001)(86362001)(2906002)(8676002)(26005)(80792005)(110136005)(486006)(6486002)(81166006)(52116002)(5660300002)(3846002)(81156014)(99106002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR1301MB2184; 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: MDeOVAvsn4EXCPE35SeVuHB25UCAuXOdmApPM2w/lIiL6d6GQOLvMcOPGh/qTGPt8X40Kt8VGsllCOC3UZpWG5k9OZjZzj75tpO78mgl+/oFzGMMg3luGDMU4fCVVM/i/Xh6jHNgK7gK8URyjqCPBYLEQddo7uhgPoWxBeNMpSXk5DNJ+RoV0tc3ZspTrL28Mk0W1r50aYSqvDI673iYePD+GSWokvTMevyulbBzdqALJnrzHlWy9LsjEKu1qplktdyhAaFJbo8F6eB4m892YRpAPLyin9qcUkubePTbn2yH9zAzcNEl/g9Kil2BB6OlYe5iTVd88YoB0VMTiQEpUnV6s038LIm1748HSmnHesm9GaoCMq43EgWrkmVyYQKb45d6FD+NXvtelcVL2wNquSxnW5Qh/RIQ+nzpaVGhKlw=
Content-Type: text/plain; charset="utf-8"
Content-ID: <BC81A8F30C1B28419B058BC8FED6B70E@namprd13.prod.outlook.com>
Content-Transfer-Encoding: base64
MIME-Version: 1.0
X-OriginatorOrg: rkf-eng.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 1fcf6291-f560-43f6-15ba-08d6c02b004f
X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Apr 2019 16:13:45.6004 (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: CY4PR1301MB2184
Archived-At: <https://mailarchive.ietf.org/arch/msg/dtn/JAK_tS-P8mrK10-2OL-WLFfOJkw>
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: Sat, 13 Apr 2019 16:13:54 -0000

Rather than embedding more in email, I've uploaded a revised CDDL (minor typos with commas, and
named the crc-type values) to [1]. This should avoid any line/spacing/etc. issues with email text
transport.

[1]: https://github.com/BSipos-RKF/dtn-bpbis-tcpcl/blob/develop/bpv7.cddl

On Wed, 2019-04-10 at 15:07 +0000, Burleigh, Scott C (312B) wrote:
> Brian, thanks, this is great!  I'll insert the revised CDDL and re-post.
> 
> I think "total application data unit length" was erroneously deleted from section 4.2.2 a couple
> of revs back, but it was restored as of version 13 (January).
> 
> Scott
> 
> -----Original Message-----
> From: Brian Sipos <BSipos@rkf-eng.com> 
> Sent: Tuesday, April 9, 2019 7:18 PM
> To: Burleigh, Scott C (312B) <scott.c.burleigh@jpl.nasa.gov>; Carsten Bormann <cabo@tzi.org>
> Cc: dtn@ietf.org
> Subject: [EXTERNAL] Re: [dtn] BPv7 CDDL and CBOR tagging
> 
> Scott,
> At the bottom of this email is a full CDDL that captures both the encodings of extension /
> administrative data as well as the binding between extension data types and extension block
> numbers.
> I also added restrictions on CRC type code and CRC value data, and used the socket convention and
> the "-structure" convention from the pre-RFC CDDL draft.
> 
> I'll leave up to you to decide if this is an over-specialized use of CDDL. Using the reference
> "cddl" program to generate randomized data actually produces near-to-reasonable bundles to my eye,
> which is nice validation of the CDDL itself.
> 
> The reference program can be tested as in:
> $ gem install cddl
> $ cddl bpv7.cddl.txt generate
> [[7, 17174, 0, [2, [3026, 451]], [1, 0], [2, [535, 2091]], [4044, 2891], 1070, h'FCDD'], [8, 2593,
> 229, 2, h'190836', h'C4F3'], [7, 2533, 177, 2, h'820100', h'0504'], [8, 3239, 179, 2, h'1850'],
> [8, 398, 237, 2, h'183E', h'31261138'], [1, 0, 175, 0,
> h'8201848481F581F481F481F51901C6820166766F6C75707482190704190CDA',
> h'AFA5']]
> 
> One issue that I ran into when testing this: I used this CDDL to validate some test bundles which
> I had been generating separately to test the TCPCL agent. The original CDDL in the draft contains
> the field name "total-application-data-length" which also appears several times in the draft as
> "total application data unit length" in the statments.
> But I don't see that field listed in Section 4.2.2. Is there a missing field in that section, or
> is that field no longer present and the other text is inaccurate?
> 
> Thanks,
> Brian S.
> 
> On Tue, 2019-04-09 at 01:24 +0000, Burleigh, Scott C (312B) wrote:
> > Guys, please feel free to send me an updated CDDL expression of Bundle 
> > Protocol version 7; I will gladly include it in the document.
> > 
> > My one comment is that the type dtn-time is correctly defined as uint; 
> > it should NOT be changed to int, as negative values are not allowed.  
> > If you can spot an instance in the spec where dtn-time is 
> > characterized as a signed integer, please let me know and I will 
> > correct it.
> > 
> > Scott
> 
> start = bundle / #6.55799(bundle)
> 
> ; Times before 2000 are invalid
> dtn-time = uint
> 
> ; CRC enumerated type
> crc-type = 0 / 1 / 2
> ; Either 16-bit or 32-bit
> crc-value = (bstr .size 2) / (bstr .size 4)
> 
> creation-timestamp = [dtn-time, sequence: uint]
> 
> eid = $eid-choice .within eid-structure
> eid-structure = [
>   uri-code: uint,
>   SSP: any
> ]
> $eid-choice /= [
>   uri-code: 1,
>   SSP: (tstr / 0)
> ]
> $eid-choice /= [
>   uri-code: 2,
>   SSP: [
>     nodenum: uint,
>     servicenum: uint
>   ]
> ]
> 
> bundle-control-flags = uint .bits bundleflagbits bundleflagbits = &(
>   reserved: 15
>   reserved: 14
>   reserved: 13
>   bundle-deletion-status-reports-are-requested: 12
>   bundle-delivery-status-reports-are-requested: 11
>   bundle-forwarding-status-reports-are-requested: 10
>   reserved: 9
>   bundle-reception-status-reports-are-requested: 8
>   bundle-contains-a-Manifest-block: 7
>   status-time-is-requested-in-all-status-reports: 6
>   user-application-acknowledgement-is-requested: 5
>   reserved: 4
>   reserved: 3
>   bundle-must-not-be-fragmented: 2
>   payload-is-an-administrative-record: 1
>   bundle-is-a-fragment: 0
> )
> 
> block-control-flags = uint .bits blockflagbits blockflagbits = &(
>   reserved: 7
>   reserved: 6
>   reserved: 5
>   reserved: 4
>   bundle-must-be-deleted-if-block-cannot-be-processed: 3
>   status-report-must-be-transmitted-if-block-cannot-be-processed: 2
>   block-must-be-removed-from-bundle-if-it-cannot-be-processed: 1
>   block-must-be-replicated-in-every-fragment: 0
> )
> 
> bundle = [primary-block, *extension-block, payload-block]
> 
> primary-block = [
>   version: 7,
>   bundle-control-flags,
>   crc-type,
>   destination: eid,
>   source-node: eid,
>   report-to: eid,
>   creation-timestamp,
>   lifetime: uint,
>   ? (
>     fragment-offset: uint,
> ;    total-application-data-length: uint,
>   )
>   ? crc-value,
> ]
> 
> ; Abstract shared structure of all non-primary blocks canonical-block-structure = [
>   block-type-code: uint,
>   block-number: uint,
>   block-control-flags,
>   crc-type,
>   ; Each block type defines the content within the bytestring
>   block-type-specific-data,
>   ? crc-value
> ]
> block-type-specific-data = bstr / #6.24(bstr) ; Extension block type, which does not specialize
> any more than the code/number extension-block = $extension-block-structure .within canonical-
> block- structure $extension-block-structure = [
>   block-type-code: (uint .gt 1),
>   extension-block-number,
>   block-control-flags,
>   crc-type,
>   ($extension-block-data .within block-type-specific-data)
>   ? crc-value
> ]
> extension-block-number = (uint .ne 0)
> ; Payload block type
> payload-block = payload-block-structure .within canonical-block- structure payload-block-structure 
> = [
>   block-type-code: 1,
>   block-number: 0,
>   block-control-flags,
>   crc-type,
>   ($payload-block-data .within block-type-specific-data)
>   ? crc-value
> ]
> 
> ; Arbitrary payload data
> $payload-block-data /= bstr
> 
> 
> ; Administrative record as a payload data specialization $payload-block-data /= block-type-
> specific-data .cbor admin-record admin-record = $admin-record .within admin-record-structure
> admin-record-structure = [
>   record-type-code: uint,
>   record-content: any
> ]
> ; Only one defined record type
> $admin-record /= [1, status-record-content] status-record-content = [
>   bundle-status-information,
>   status-report-reason-code: uint,
>   source-node-eid: eid,
>   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
> ]
> 
> ; Previous Node extension block
> $extension-block-structure /= [
>   block-type-code: 7,
>   extension-block-number,
>   block-control-flags,
>   crc-type,
>   (block-type-specific-data .cbor ext-data-previous-node)
>   ? crc-value
> ]
> ext-data-previous-node = eid
> 
> ; Bundle Age extension block
> $extension-block-structure /= [
>   block-type-code: 8,
>   extension-block-number,
>   block-control-flags,
>   crc-type,
>   (block-type-specific-data .cbor ext-data-bundle-age)
>   ? crc-value
> ]
> ext-data-bundle-age = uint
> 
> ; Hop Count extension block
> $extension-block-structure /= [
>   block-type-code: 9,
>   extension-block-number,
>   block-control-flags,
>   crc-type,
>   (block-type-specific-data .cbor ext-data-hop-count)
>   ? crc-value
> ]
> ext-data-hop-count = [
>   hop-limit: uint,
>   hop-count: uint
> ]
> 
> _______________________________________________
> dtn mailing list
> dtn@ietf.org
> https://www.ietf.org/mailman/listinfo/dtn