Re: [core] CoAP over Serial URLs

Tobias Kaupat <tobias.kaupat@lobaro.de> Fri, 16 December 2016 17:38 UTC

Return-Path: <tobias.kaupat@lobaro.de>
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 9E95B129962 for <core@ietfa.amsl.com>; Fri, 16 Dec 2016 09:38:54 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.809
X-Spam-Level:
X-Spam-Status: No, score=-1.809 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, T_DKIM_INVALID=0.01] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=fail (1024-bit key) reason="fail (message has been altered)" header.d=lobaro.de
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 lMG1spshsFTK for <core@ietfa.amsl.com>; Fri, 16 Dec 2016 09:38:52 -0800 (PST)
Received: from se9.mailspamprotection.com (delivery.mailspamprotection.com [108.163.228.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 377AD1279EB for <core@ietf.org>; Fri, 16 Dec 2016 09:38:51 -0800 (PST)
Received: from ns1.am20.siteground.biz ([107.6.152.202] helo=am20.siteground.biz) by se9.mailspamprotection.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86) (envelope-from <tobias.kaupat@lobaro.de>) id 1cHwT1-0002QN-IY for core@ietf.org; Fri, 16 Dec 2016 11:38:51 -0600
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lobaro.de; s=dkim; h=Content-Type:To:Subject:Message-ID:Date:From:References: In-Reply-To:MIME-Version; bh=7xSCZresYsNoBGmRAuqVBzGIpNP0TmFFhwkMeX2cQKk=; b= WVRNRCMVvy28n6t11Z5zNz7MjSZBLn7ZeIYIrIuGMV4Bpsq6CqmJyW/N2GlIkzbuVyuvI7pXpaW70 7VEVHlGppswEJKvKa5JmfYxYvl/zMpX3taj3KU+7+pzmSPUlvvQrbqtOHAbV7wD15jNeEp+fVlUuU NP0OkOjadI36SAJnM=;
Received: from [209.85.213.181] (port=33365 helo=mail-yb0-f181.google.com) by am20.siteground.biz with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.86_2) (envelope-from <tobias.kaupat@lobaro.de>) id 1cHwSz-0001yy-NU for core@ietf.org; Fri, 16 Dec 2016 18:38:45 +0100
Received: by mail-yb0-f181.google.com with SMTP id v132so41041653yba.0 for <core@ietf.org>; Fri, 16 Dec 2016 09:38:45 -0800 (PST)
X-Gm-Message-State: AIkVDXJ4s5Cn/5DQlHkK3vH1r3WmIhk6MYOmPvPEJHHhyUafErF02ccP58b5zp/hAK1F6BvEbDsvNtXQR2WUPg==
X-Received: by 10.37.192.82 with SMTP id c79mr3163165ybf.123.1481909924600; Fri, 16 Dec 2016 09:38:44 -0800 (PST)
MIME-Version: 1.0
Received: by 10.37.215.87 with HTTP; Fri, 16 Dec 2016 09:38:44 -0800 (PST)
In-Reply-To: <C90477BA-D5C1-4A51-AA56-5B1505156A83@tzi.org>
References: <CAOzLvV5rJB8F1LowHaveLYnRvX8-e6k3EQknyxbAz3BjS3yo3A@mail.gmail.com> <C90477BA-D5C1-4A51-AA56-5B1505156A83@tzi.org>
From: Tobias Kaupat <tobias.kaupat@lobaro.de>
Date: Fri, 16 Dec 2016 18:38:44 +0100
X-Gmail-Original-Message-ID: <CAOzLvV6VLCBBFv59TTQxdmMNm2WVmfZ7RYVPEHxn3kHAa=A2ew@mail.gmail.com>
Message-ID: <CAOzLvV6VLCBBFv59TTQxdmMNm2WVmfZ7RYVPEHxn3kHAa=A2ew@mail.gmail.com>
To: core@ietf.org
Content-Type: multipart/related; boundary="001a11465b06a56ba70543ca0af6"
X-AntiAbuse: This header was added to track abuse, please include it with any abuse report
X-AntiAbuse: Primary Hostname - am20.siteground.biz
X-AntiAbuse: Original Domain - ietf.org
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - lobaro.de
X-Get-Message-Sender-Via: am20.siteground.biz: none
X-Filter-ID: s0sct1PQhAABKnZB5plbIdH40z9tliyPtpXyyHKT/m4RjSEj2nYPqqWQeUf53awNXewBu5TuhjJr gH3eyFBy7sNj8BQqkega5p9fBkeb4oZC/lGsrXcsS0xY0J18f6o7xB66CWvXcfKDfXjTU++u69YB Xb6jfjohFJ7g32xIXrUO57I/5BFVuhfqQQ7qOU0oZuM7jUXIESohoO51xWmU8f/7RUALN8w5ja3N xpxWDaoY2T47vGK5fezrUhroBI5OFEb1sdJJzGW+9EO+zwnsjXo8fmRB/Nw97k+xvb1cUqA55Spz eRGOV3aY7/PHVUgL647lNwN4qOsSZg+fYhVZGxSHPIfeHGgPjT6rcUajk76mpXXp0Gt2TbF6JjUg D4Z6SWM++pStxxa3FW225wglPaXHp6NpGwzrU5VG2NFRDQwN6A7sYlbJv8IjXJJB4hSigM/q/H2F qjD1scJGaqQs9GWLX2ZbQb3UJKihEmoDuwgTwRKLwC98NjMBcVQD/vDG16ixf05zXFqEd+e8EX60 wCY91scG0mEZL1BA7T8dPySDqE+X/czcI5QK7VzPhB1Sg6GtgRRwcPDQPLQ2Uignxg4TCyit5yhm YM6wMN3alVdoh9VoIekQHpwUfpYnEThmZu6ZIenY1SsGgzhhrFGQ2CLu9GpLUBpx3AZCWLaUmHoo xJjsUHcLs2RiH4lguH1mIMVutWjqmYwF9L8ga6E8vQ==
X-Report-Abuse-To: spam@quarantine1.mailspamprotection.com
X-Originating-IP: 107.6.152.202
X-SpamExperts-Domain: am20.siteground.biz
X-SpamExperts-Username: 107.6.152.202
Authentication-Results: mailspamprotection.com; auth=pass smtp.auth=107.6.152.202@am20.siteground.biz
X-SpamExperts-Outgoing-Class: ham
X-SpamExperts-Outgoing-Evidence: Combined (0.13)
X-Classification: not-spam/combined
X-Recommended-Action: accept
Archived-At: <https://mailarchive.ietf.org/arch/msg/core/fhGuGd-cfyuHVh4vksC9K9C5BKw>
Subject: Re: [core] CoAP over Serial URLs
X-BeenThere: core@ietf.org
X-Mailman-Version: 2.1.17
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: Fri, 16 Dec 2016 17:38:54 -0000

Hi Carsten,
it was an interesting chat today.

You can find our current Go CoAP client implementation that supports only
CoAP over URAT here: https://github.com/Lobaro/coap-go (the repo also
contains the Go warpper for our C CoAP server/client lib)
There is a basic transport implementation for the coap+uart scheme:
https://github.com/Lobaro/coap-go/blob/master/coap/transport_uart.go

Currently we use standard parameters for the uart, but let the user
override them if needed:
Baud:        115200,
Parity:      ParityNone,
Size:        0,
ReadTimeout: time.Millisecond * 500,
StopBits:    Stop1,

MessageID's are simply counted up and tokens are random 4-bytes. I'm
thinking about using a 1 Byte counter + random 3 bytes to avoid even the
chance for collisions.

I also support a special host "any" where the implementation just takes the
first free COM port oder ttyS* - in many cases you have only one serial
connection (or only one that supports CoAP) and just don't want to bother
looking it up before creating a URI. Further implementations to select the
"any" connection could be more clever, but it's a start.

The Package oriented transport is currently based on SLIP. Since I did not
found any Go implementation we made our own, it's also OpenSource:
https://github.com/Lobaro/slip
I'm looking forward to extend the (usage of the) slip library with the
ideas discussed today. Briefly: 1-Bytes packet headers and checksums.

The whole coap client is build after the go http package to make it easy to
use for developers who know the Go standard lib.
The CoAP client will be able to select the correct Transport based on the
URI scheme.

Cheers, Tobias K.


On Thu, Dec 15, 2016 at 6:47 AM, Carsten Bormann <cabo@tzi.org> wrote:

> Hi Tobias,
>
>
> > On 14 Dec 2016, at 19:30, Tobias Kaupat <tobias.kaupat@lobaro.de> wrote:
> >
> > Hi all,
> > I'm implementing CoAP over a serial RS232 connection
>
> Interesting — we had a brief discussion about this at the T2TRG meeting in
> Ludwigsburg, and I’d sure like to know more about this.
>
> > and wondering about the URL format.
>
> When we started to think about the bluetooth URI format
> (draft-bormann-t2trg-ble-uri) we ran into a similar discussion.  A URI for
> a “local interconnect” isn’t really a “U”RI, as its meaning is dependent on
> that local context.  There is precedence in the file:// URI, but there is
> still some uneasiness around.  (There are also authority-based URIs with
> link-local addresses; similar problem.)
>
> > For CoAP over SMS they use a separate scheme "coap+sms" (see:
> https://www.ietf.org/archive/id/draft-becker-core-coap-sms-gprs-05.txt)
> so I just took "coap+rs232" for my case.
>
> Are the voltage levels on the serial line (which is what “RS232" is about)
> really important?
> Do you need a different URI for TTL-level UARTs?  Maybe more like
> coap+serial or coap+uart.
>
> How do you decide the bit rate?  The CoAP over Serial specification could
> align on a strong default (say, 115200 bit/s as in 6lobac), but there may
> occasionally be a need to deviate even from such a strong default.
>
> > So far the only question I have is: Is there already some other URL
> scheme defined that I'm not aware of?
>
> Not for serial.
>
> > The actual question is regarding the Host. A serial connection is
> usually a file handle. For Windows something like "COM3" is just fine. On
> Linux based systems I have to connect to "/dev/ttyS3" which gets more
> problematic when encoding in URLs. What is the best way to deal with the
> slash characters?
> >
> >
> > https://tools.ietf.org/html/rfc3986#page-21 restricts percent encoding
> of ASCII characters in the host part but allows system specific host
> lookups. Thats why I came up with an Implementation that implicitly adds
> the prefix "/dev/" to the host part of the URL before opening the
> connection on Linux systems.
>
> That is probably the right approach.  Again, compare the link-local
> addresses which would need a % character (which need to percent-encoded) —
> endless discussion.
>
> I’m definitely interested in also nailing down the data format over
> serial.  Let’s discuss this tomorrow...
>
> Grüße, Carsten
>
>


-- 

Lobaro UG (haftungsbeschränkt)
Tempowerkring 21d
21079 Hamburg

040 / 22816531-0
www.lobaro.de
info@lobaro.de

USt.-Identifikationsnr.: DE297198645
WEEE-Reg.-Nr. DE18824018

Geschäftsführer: Dipl.-Ing. Tobias Rohde
Sitz der Gesellschaft: Hamburg
Handelsregister: HRB 134264
Amtsgericht Hamburg