[core] protocol-negotiation and web linking

Christian Amsüss <c.amsuess@energyharvesting.at> Sat, 24 February 2018 11:40 UTC

Return-Path: <c.amsuess@energyharvesting.at>
X-Original-To: core@ietfa.amsl.com
Delivered-To: core@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 5D38412D7F4; Sat, 24 Feb 2018 03:40:35 -0800 (PST)
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] autolearn=ham autolearn_force=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 66eyOxDlR00E; Sat, 24 Feb 2018 03:40:33 -0800 (PST)
Received: from prometheus.amsuess.com (alt.prometheus.amsuess.com [IPv6:2a01:4f8:190:3064::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 14BBF12D7ED; Sat, 24 Feb 2018 03:40:32 -0800 (PST)
Received: from poseidon-mailhub.amsuess.com (095129206250.cust.akis.net [95.129.206.250]) by prometheus.amsuess.com (Postfix) with ESMTPS id 4A3F2494BC; Sat, 24 Feb 2018 12:40:29 +0100 (CET)
Received: from poseidon-mailbox.amsuess.com (unknown [IPv6:2a02:b18:c13b:8010:a800:ff:fede:b1bf]) by poseidon-mailhub.amsuess.com (Postfix) with ESMTP id 5B91856; Sat, 24 Feb 2018 12:40:28 +0100 (CET)
Received: from hephaistos.amsuess.com (hephaistos.amsuess.com [IPv6:2a02:b18:c13b:8010::db8]) by poseidon-mailbox.amsuess.com (Postfix) with ESMTPSA id 13B4BC3; Sat, 24 Feb 2018 12:40:28 +0100 (CET)
Received: (nullmailer pid 21772 invoked by uid 1000); Sat, 24 Feb 2018 11:40:27 -0000
Date: Sat, 24 Feb 2018 12:40:27 +0100
From: Christian Amsüss <c.amsuess@energyharvesting.at>
To: draft-silverajan-core-coap-protocol-negotiation@ietf.org
Cc: Core WG mailing list <core@ietf.org>
Message-ID: <20180224114026.GA4265@hephaistos.amsuess.com>
References: <20180223150833.GA26617@hephaistos.amsuess.com>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="PNTmBPCT7hxwcZjr"
Content-Disposition: inline
In-Reply-To: <20180223150833.GA26617@hephaistos.amsuess.com>
User-Agent: Mutt/1.9.3 (2018-01-21)
Archived-At: <https://mailarchive.ietf.org/arch/msg/core/kUGtAfKTfwA5Q_n5ovdf_jlYrWc>
Subject: [core] protocol-negotiation and web linking
X-BeenThere: core@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: "Constrained RESTful Environments \(CoRE\) Working Group list" <core.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/core>, <mailto:core-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/core/>
List-Post: <mailto:core@ietf.org>
List-Help: <mailto:core-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/core>, <mailto:core-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sat, 24 Feb 2018 11:40:35 -0000

Hello Bill and Mert,

during the review of protocol-negotiation, I came up with an idea that
is too far off from the document to go directly into a review. It might
be an overdose of web-linking talking here, so feel free to dismiss it
if need be, but maybe there are ideas in it that can help bring on p-n.

Let me start with examples and then explain what they should mean:

| Req: GET coap://node1/.well-known/core
| Res: 2.05 Content, Payload:
| <>;alt-base="coap+tcp://node1",
| </sensor/temp>;if="core.s"

or when registering at the RD:

| Req: POST /rd?ep=node1&con=coap://node1
| <>;alt-base="coap+tcp://node1",
| </sensor/temp>;if="core.s"
| Res: 2.01 Created, Location: /reg/1234

The endpoint registering at the RD could update the alt-base value(s) of
the link like it would update any other link it manages. (Admittedly,
that part of RD got postponed; might look like PATCH /reg/1234, Payload
{"1": {"href": "", "alt-base": ["coap+tcp://node1:1234"]}} in some
upcoming JSON link patch format).

Resource lookups would stay the same. Asking a server directly for
alternative transports could be done with GET
/.well-known/core?alt-base=* or /.well-known/core?alt-base=coap+ws://*.
This would be a dedicated request rather than piggy-backing onto any
existing one with a new option, but we're doing the same with any of the
other resource metadata as well, and a .well-known/core discovery is
often the first step in interaction anyway.

One way to give the protocol negotiation meaning to this would be only
two normative sentences:

| An "alt-base" attribute on a link means that representations of the link
| target are equally valid if the attribute's value were assigned as Base
| URI of the encapsulating entity (RFC3986 Section 5.1.2) for the purpose
| of resolving relative references in the document. URIs obtained from the
| representation using any alt-base value are all related to the URI
| obtained from the same reference without considering the alt-base
| attribute by the "alternative" relation (and therefore to each other, as
| that relation is transitive).

(I've picked the "alternative" relation here; see my review comments on
the `ol` attribute. If no link relation is deemed suitable and you stay
with `ol`, the second sentence would need to say that they are
"equivalent for all REST operations supported by their protocols".)


The approach of transmitting the URI data in link attributes is
motivated by the RD's desire to not be anything more than a cache of
what can be discovered using .well-known/core discovery.


The explanation of being an "alternative Base URI" rather than a generic
alternative transport could be a middle ground between saying that only
a single URI is available somewhere else and saying that everything on
this address is available there: It only makes statements about the
links in the presented document. This would allow groups of resources to
state their equivalences.


The approach suggested here has some drawbacks: It is a bit more verbose
in terms of transmitted bytes, and requires constrained nodes to
synthesize variable data into payload that we usually take pride in
being able to assemble at build time. If there is interest in the
approach at all, I think we can overcome those.


Best regards
Christian

-- 
To use raw power is to make yourself infinitely vulnerable to greater powers.
  -- Bene Gesserit axiom