Re: [Cbor] Using packed CBOR in BIRD's custom protocol

Wolf McNally <wolf@wolfmcnally.com> Thu, 08 June 2023 19:21 UTC

Return-Path: <wolf@wolfmcnally.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 BEA08C14F74E for <cbor@ietfa.amsl.com>; Thu, 8 Jun 2023 12:21:27 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.893
X-Spam-Level:
X-Spam-Status: No, score=-6.893 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=wolfmcnally-com.20221208.gappssmtp.com
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id p31QE8Rt-nwF for <cbor@ietfa.amsl.com>; Thu, 8 Jun 2023 12:21:23 -0700 (PDT)
Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 3BEE0C14F74A for <cbor@ietf.org>; Thu, 8 Jun 2023 12:21:23 -0700 (PDT)
Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-654f8b56807so954267b3a.1 for <cbor@ietf.org>; Thu, 08 Jun 2023 12:21:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfmcnally-com.20221208.gappssmtp.com; s=20221208; t=1686252082; x=1688844082; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=agF179MsqGok+3HzzbUpRscRNCYV4g1m5yitBK2v/NI=; b=s50VTtCq++9xJIo+aHYv3PwyTF4d1U28JrGBEXzQKNKyQ/irBj+KeGjswzr53L8/qc pHcaDXepDkK17CFCOxc6DX9NKgggt+piJbDpcKeJTKAckdoYw5tRpkK/bO7uCy4ii5iK 6D3IYGJaHTqmtCzl5jKUymoMzbmrWtvzNfBE7cTGfOpHqgtLhqtVv+xaiYgmkYY7Morm SOe/5EI7kStSBXidFUjbKcDI8TeGDP75KQKKHiDjGv3eEvpzZsLQCmWKI/RoAJ7b9xEW co1PHPHSLrYG5L5DCbYCRtdzTa+NR0w3CPByu1tDXt34M1wRu8Rby0KwuSejezlxHMH4 ziDQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686252082; x=1688844082; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=agF179MsqGok+3HzzbUpRscRNCYV4g1m5yitBK2v/NI=; b=Ctqs1ipJRq2Ac9Sr3rkQKRk2PlvUIo1XHC3i12VYBiHmJySWtceWhimtCHlik/34kX y0sIYc2LZxm6TSCfX657FcwIkZabsNGcoKym4io76YKNriINaB9TZtR3/DSEFNQ9poG6 GcLQm5OFfLGf2DKUnN9xxXvUsdIGUe5nA3PStSD6P/FXGnxwQRtiehjIXltju4fdmnj6 INAn6MaHkcYOhZ54d0J1PQR3VJTkSaiQ4+OL6bzYQ7o9c2UZexeY4FNSifDWuVOXoalV 2UFK94QNxQdZsp7KCVZjQUy7me0WNJ4FrNFJyuKsDHkwLCXrXqGeVzPkBpiXFZCqkXFL IgfA==
X-Gm-Message-State: AC+VfDyrsdqdN1xxDiebjQqYsTWrTkTDrV1RqN0cpug7x8zKanfrouPb mlsS8dVeny46rDMfVlb0IfMYeVT1M8OcDJbwqnzV9A==
X-Google-Smtp-Source: ACHHUZ78Igl57iXTINe/GDqMjn4MRhbkFZ4tLO9cHsIo6BhUq7ccC+W/50UlHFCGLQxCJdZ+sBmI4w==
X-Received: by 2002:a17:902:e886:b0:1b0:6e16:b92c with SMTP id w6-20020a170902e88600b001b06e16b92cmr10738182plg.54.1686252082408; Thu, 08 Jun 2023 12:21:22 -0700 (PDT)
Received: from smtpclient.apple (ip70-180-193-108.lv.lv.cox.net. [70.180.193.108]) by smtp.gmail.com with ESMTPSA id d6-20020a170903230600b001ae57277a87sm1758503plh.255.2023.06.08.12.20.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Jun 2023 12:20:58 -0700 (PDT)
From: Wolf McNally <wolf@wolfmcnally.com>
Message-Id: <741BE718-FA67-4206-A2E0-A354CB95D215@wolfmcnally.com>
Content-Type: multipart/alternative; boundary="Apple-Mail=_F01FB148-F601-4210-9840-AE12EC9A2839"
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.600.7\))
Date: Thu, 08 Jun 2023 12:20:44 -0700
In-Reply-To: <25a4a6ed-5b00-c900-c9c6-b83dd45b4003@nic.cz>
Cc: cbor@ietf.org
To: Maria Matejka <maria.matejka=40nic.cz@dmarc.ietf.org>
References: <25a4a6ed-5b00-c900-c9c6-b83dd45b4003@nic.cz>
X-Mailer: Apple Mail (2.3731.600.7)
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/mYY-I-oHnCvYPvwvuTcCplIXFl4>
Subject: Re: [Cbor] Using packed CBOR in BIRD's custom protocol
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.39
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, 08 Jun 2023 19:21:27 -0000

Maria,

You might want to consider the emerging Gordian Envelope technology which is based on CBOR, and supports DEFLATE compression, which in our experiments yields better compression than packed CBOR, and doesn’t require knowing anything about the content in advance. If all you want is compressed CBOR, a Gordian Envelope adds only a few bytes of overhead, and it advertises the hash of the uncompressed contents.

https://www.blockchaincommons.com/introduction/Envelope-Intro/
An Introduction to Gordian Envelopes
blockchaincommons.com


> On Jun 7, 2023, at 3:35 AM, Maria Matejka <maria.matejka=40nic.cz@dmarc.ietf.org> wrote:
> 
> Hello!
> 
> We're planning to implement a machine-friendly protocol for common and generic communication between BIRD and the surroundings, like GUIs and CLIs or automation machinery. (Currently, everybody is parsing our CLI, which is an awful mess.) We decided to go with CBOR and I'd like to consult with you whether our way is reasonable, and also ask some questions, as we're newbies in this area, if you don't mind.
> 
> We're definitely going for the packed CBOR as our data can easily get annoyingly big if not packed. Yet we typically don't know the actual contents of the dictionary when starting to pack – and we don't like caching the data either before sending it to generate the dictionary to the beginning. Is there any possibility to send dictionary updates? I'm quite confused by the wording of section 3 of draft-ietf-cbor-packed-08 – at least my concerns are partially relieved by the Appendix A. I'm reading it this way – when we have anything to pack, we open a new 113-tag enclosing the rest of the message … and as soon as we find something more to add to the dictionary, we nest the 113-tags and we put the new values to the end of the dictionary by explicitly marking them by their tags. Is this a valid understanding of that section?
> 
> Or should we better go for value-sharing by Marc A. Lehmann with tags 28 and 29 in this kind of setup?
> 
> For the in-socket format, I'm also missing a possibility to explicitly say "the following object (data item) is exactly N bytes long" to allow for easier data management – shall we define this functionality and register it as a tag?
> 
> And also we're going to encode routing information (like BGP attributes) which may need a standardized representation, yet it's just a map (in case of one route) or a map of maps (full RIB). I think that in this case, it doesn't deserve a tag, yet it may be handy to write an informational RFC about that. Is this the right way to go?
> 
> Thank you for helping us.
> 
> -- 
> Maria Matejka | BIRD Team Leader | CZ.NIC, z.s.p.o.
> _______________________________________________
> CBOR mailing list
> CBOR@ietf.org
> https://www.ietf.org/mailman/listinfo/cbor