Re: [core] COAP basic implementation.

Zach Shelby <zach@sensinode.com> Wed, 24 March 2010 17:03 UTC

Return-Path: <zach@sensinode.com>
X-Original-To: core@core3.amsl.com
Delivered-To: core@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id 562933A6CAF for <core@core3.amsl.com>; Wed, 24 Mar 2010 10:03:17 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.859
X-Spam-Level:
X-Spam-Status: No, score=-0.859 tagged_above=-999 required=5 tests=[AWL=-0.990, BAYES_50=0.001, DNS_FROM_OPENWHOIS=1.13, RCVD_IN_DNSWL_LOW=-1]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qhKGsL8VagG5 for <core@core3.amsl.com>; Wed, 24 Mar 2010 10:03:15 -0700 (PDT)
Received: from auth-smtp.nebula.fi (auth-smtp.nebula.fi [217.30.180.105]) by core3.amsl.com (Postfix) with ESMTP id A2AB83A6872 for <core@ietf.org>; Wed, 24 Mar 2010 10:03:10 -0700 (PDT)
Received: from dhcp-wireless-open-abg-26-31.meeting.ietf.org (dhcp-wireless-open-abg-26-31.meeting.ietf.org [130.129.26.31]) (authenticated bits=0) by auth-smtp.nebula.fi (8.13.4/8.13.4) with ESMTP id o2OH3MP1005551 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Wed, 24 Mar 2010 19:03:25 +0200
Mime-Version: 1.0 (Apple Message framework v1077)
Content-Type: text/plain; charset="us-ascii"
From: Zach Shelby <zach@sensinode.com>
In-Reply-To: <7f996c491003240416w63f40f70x1b22d88edffb420@mail.gmail.com>
Date: Wed, 24 Mar 2010 10:03:24 -0700
Content-Transfer-Encoding: quoted-printable
Message-Id: <F38F1A47-27CD-4FF0-A8FF-2839BDE7DBD2@sensinode.com>
References: <7f996c491003240416w63f40f70x1b22d88edffb420@mail.gmail.com>
To: David Ryan <oobles@gmail.com>
X-Mailer: Apple Mail (2.1077)
Cc: core@ietf.org
Subject: Re: [core] COAP basic implementation.
X-BeenThere: core@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: "Constrained RESTful Environments \(CoRE\) Working Group list" <core.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/core>, <mailto:core-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/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: Wed, 24 Mar 2010 17:03:17 -0000

Awesome David, nice work! We are also working on a couple implementations in the SENSEI project. 

On Mar 24, 2010, at 4:16 , David Ryan wrote:

> 
> One of the questions that came up during implementation was what is a
> malformed request?  How does the server tell and under what situations
> should an error response be sent?  

These need to be defined, contribs welcome. 

> Also, should a request have to come
> from a client using the COAP port, or should the server send responses
> to the client port that sent it?

The latter. 

Zach

> 
> You can find the download under Colony COAP near the bottom of
> http://www.einet.com.au/Downloads
> 
> Comments and feedback appreciated.
> 
> Regards,
> David.
> 
> 
> On Fri, Mar 19, 2010 at 10:01 AM, David Ryan <oobles@gmail.com> wrote:
>> Hi All,
>> 
>> I sent the following questions and feedback to Brian and Zach who
>> suggested I forward this to the list for further discussion.  I won't
>> be at the meeting in Anaheim next week, so here's my input.
>> 
>> First off, a question regarding the compression of the protocol.
>> You've managed to compress the header into 4 bytes.  Obviously the
>> size of the header is going to be important.  In the priority list of
>> features, is this the most important?  Would another byte or two hurt?
>> 
>> I notice between Chopan and COAP you've dropped the magic number
>> headers.  This must have been a conscious decision. I would have liked
>> to see a one byte magic value to identify the packet or TCP stream.
>> This would at least give a server a chance to throw away the request
>> if it receives a bad message.
>> 
>> In regard to version.  Two bits only leaves four possible versions.
>> Extending this to 4 bits would at least extend this to 16 versions.
>> This goes back to the original point regarding size of header.
>> 
>> Back in 2008 I did a thought experiment on a binary REST based
>> protocol.  Details available at:
>> 
>> http://blog.livemedia.com.au/search?updated-min=2008-01-01T00%3A00%3A00%2B11%3A00&updated-max=2009-01-01T00%3A00%3A00%2B11%3A00&max-results=7
>> 
>> Many of the elements are not applicable to COAP, but there might be
>> one or two features I developed which could be worth discussing.
>> 
>> One element of this through experiment was to include a "slotsAvailable"
>> in the response.  As the "transactionid" field allows multiple
>> requests to be sent to a single recipient, the "slotsAvailable" in the
>> response allows a client to limit the number of requests sent.  I'd
>> suggest 4 bits in the response.  If the server can handle more than 16
>> requests it can return 16 in all responses.  A small device might
>> return 1 at all times.
>> 
>> Another concept I thought about was to have a bit field for protocol
>> features.  This may not be applicable in this case, however, something
>> to put on the back burner.  The idea is that a small device might only
>> respond to a limited set of features (or options).  A bit field can be
>> used to identify in the request which features are being used and in
>> the response what features the server can handle.
>> 
>> I was also surprised that the protocol doesn't include the URI path in
>> the main part of the header.  I must admit I'm still trying to
>> understand how the index based approach to URI paths will work in your
>> proposal.
>> 
>> I tried taking your proposal and combined it with a few of the above
>> changes and came up with the following:
>> 
>> Packet
>>  preamble/magic  (1 byte)
>> 
>>  version (4 bits)
>>  features (4 bits)
>> 
>>  response (1 bit)
>>  options (1 bit)
>>  asynchronous (1 bit)
>>  locationType (1 bit)     (0 URI location field enabled, 1 location
>> specified in options)
>>  method/slots (4 bits)  (method type in request/slots available in response)
>> 
>>  transactionId (16 bits)
>> 
>>  location (URI location if locationType 0)
>> 
>>  options length (8 bits - length)
>>  ... options ...
>> 
>>  payload length (variable length int)
>>  ...payload data...
>> 
>> 
>> The base header in this case is 5 bytes instead of the 4 bytes.
>> 
>> I also suggested that the number of options is at the start of the
>> options list.  This allows the server to quickly decide if the packet
>> can be handled and all the option list can be processed.  In a
>> constrained device only a selected number of options could be
>> processed.  This removes the need for the 0 byte end of options byte.
>> 
>> I have also used a variable length integer for the payload.  This is
>> to allow the protocol to move to TCP with larger packets.
>> 
>> Regards,
>> David.
>> 
>> 
>> On Tue, Mar 2, 2010 at 8:30 AM, Zach Shelby <zach@sensinode.com> wrote:
>>> http://www.ietf.org/id/draft-shelby-core-coap-00.txt
>>> 
>>> Here is a very early draft of a CoAP protocol specification based on the requirements and initial ideas formulated in draft-shelby-core-coap-req-00 and the previous work by Brian in draft-frank-6lowapp-chopan. Looking forward to lots of good discussion around CoAP, and as you can see from all the TODOs and TBDs - lots of WG stuff to do here!
>>> 
>>> At the same time I'd like to request a time-slot to present this in Anaheim.
>>> 
>>> Zach
>>> 
>>> Begin forwarded message:
>>> 
>>>> From: IETF I-D Submission Tool <idsubmission@ietf.org>
>>>> Date: March 1, 2010 23:24:35 GMT+02:00
>>>> To: zach@sensinode.com
>>>> Cc: brian.tridium@gmail.com
>>>> Subject: New Version Notification for draft-shelby-core-coap-00
>>>> 
>>>> 
>>>> A new version of I-D, draft-shelby-core-coap-00.txt has been successfuly submitted by Zach Shelby and posted to the IETF repository.
>>>> 
>>>> Filename:      draft-shelby-core-coap
>>>> Revision:      00
>>>> Title:                 Constrained Application Protocol (CoAP)
>>>> Creation_date:         2010-03-01
>>>> WG ID:                 Independent Submission
>>>> Number_of_pages: 17
>>>> 
>>>> Abstract:
>>>> This document specifies the Constrained Application Protocol (CoAP),
>>>> a RESTful protocol for use with constrained networks and nodes.  CoAP
>>>> easily translates to HTTP for integration with the web while meeting
>>>> specialized requirements such as multicast support, very low overhead
>>>> and simplicity for constrained environments.
>>>> 
>>>> 
>>>> 
>>>> The IETF Secretariat.
>>>> 
>>>> 
>>> 
>>> --
>>> http://www.sensinode.com
>>> http://zachshelby.org - My blog "On the Internet of Things"
>>> http://6lowpan.net - New book - "6LoWPAN: The Wireless Embedded Internet"
>>> Mobile: +358 40 7796297
>>> 
>>> Zach Shelby
>>> Head of Research
>>> Sensinode Ltd.
>>> Kidekuja 2
>>> 88610 Vuokatti, FINLAND
>>> 
>>> This e-mail and all attached material are confidential and may contain legally privileged information. If you are not the intended recipient, please contact the sender and delete the e-mail from your system without producing, distributing or retaining copies thereof.
>>> 
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> core mailing list
>>> core@ietf.org
>>> https://www.ietf.org/mailman/listinfo/core
>>> 
>> 

-- 
http://www.sensinode.com
http://zachshelby.org - My blog "On the Internet of Things"
http://6lowpan.net - New book - "6LoWPAN: The Wireless Embedded Internet"
Mobile: +358 40 7796297

Zach Shelby
Head of Research
Sensinode Ltd.
Kidekuja 2
88610 Vuokatti, FINLAND

This e-mail and all attached material are confidential and may contain legally privileged information. If you are not the intended recipient, please contact the sender and delete the e-mail from your system without producing, distributing or retaining copies thereof.