[hybi] Dave's Framing Proposal

Dave Cridland <dave@cridland.net> Thu, 05 August 2010 20:52 UTC

Return-Path: <dave@cridland.net>
X-Original-To: hybi@core3.amsl.com
Delivered-To: hybi@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id 058E23A6A08 for <hybi@core3.amsl.com>; Thu, 5 Aug 2010 13:52:09 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.48
X-Spam-Level:
X-Spam-Status: No, score=-2.48 tagged_above=-999 required=5 tests=[AWL=0.119, BAYES_00=-2.599]
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 kXCkQmMBGVgO for <hybi@core3.amsl.com>; Thu, 5 Aug 2010 13:52:07 -0700 (PDT)
Received: from peirce.dave.cridland.net (peirce.dave.cridland.net [217.155.137.61]) by core3.amsl.com (Postfix) with ESMTP id 7C44B3A699D for <hybi@ietf.org>; Thu, 5 Aug 2010 13:52:07 -0700 (PDT)
Received: from localhost (localhost.localdomain [127.0.0.1]) by peirce.dave.cridland.net (Postfix) with ESMTP id EE886116809F for <hybi@ietf.org>; Thu, 5 Aug 2010 21:52:36 +0100 (BST)
X-Virus-Scanned: Debian amavisd-new at peirce.dave.cridland.net
Received: from peirce.dave.cridland.net ([127.0.0.1]) by localhost (localhost.localdomain [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vTKP4QnMWwRU for <hybi@ietf.org>; Thu, 5 Aug 2010 21:52:35 +0100 (BST)
Received: from puncture (puncture [217.155.137.60]) by peirce.dave.cridland.net (Postfix) with ESMTPA id 77D61116809E for <hybi@ietf.org>; Thu, 5 Aug 2010 21:52:35 +0100 (BST)
MIME-Version: 1.0
Message-Id: <2286.1281041555.477702@puncture>
Date: Thu, 05 Aug 2010 21:52:35 +0100
From: Dave Cridland <dave@cridland.net>
To: Server-Initiated HTTP <hybi@ietf.org>
Content-Type: text/plain; delsp="yes"; charset="iso-8859-1"; format="flowed"
Content-Transfer-Encoding: 8bit
Subject: [hybi] Dave's Framing Proposal
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: Server-Initiated HTTP <hybi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/hybi>
List-Post: <mailto:hybi@ietf.org>
List-Help: <mailto:hybi-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Aug 2010 20:52:09 -0000

I thought I'd name mine, saves confusion. I gave it a nice neutral  
name, too. I wanted to call it "Dave's Really Great Framing  
Proposal", but I decided not to.

First off, feature negotiation is external. Presumably we'd do it in  
the framing layer. I'd include both compression (at stream level) and  
TLS (likewise) here. I believe that external negotiation is not  
contentious. I think the latter two may be, but I'd like to have  
optional TLS as well as mandatory TLS (ie, "StartTLS" as well as  
port-based old-school).

As for the framing itself, rather than describe actual bitfields, I  
thought I'd describe some properties.

1) Have a single leading octet, which has a frame type.

a) This frame type says if it's a leading chunk, a completing text, a  
completing blob, or a control.

b) If it's a control, then some of the remaining bits are used to  
indicate what it is, including Final Frame, Ping, Pong, etc.

c) There should be some bits left over (and therefore reserved, MUST  
zero, MUST ignore).

2) A stream identifier, set to 0x01 in the version of the standard.  
Other values MUST cause the frame to be discarded by receivers.  
Intermediaries MUST ignore this value.

3) A 16-bit, network order, extension length field. This describes  
how much of the packet is extension data (ie, designed for the stack  
to process) rather than payload data. This field MUST NOT exceed the  
length of the frame's payload.

4) A 16-bit, network order, payload length field. This describes the  
entire payload, including any extension data. A naïve intermediary  
MAY therefore ignore the extension length in order to forward frames;  
however if it chooses to refragment frames it MUST take into account  
the extension length.

5) Extension data. Note that we need to handle multiple extension  
data, therefore this field needs to be internally TLVed consistently.

6) Payload data.


I think this outlines something which:

A - Is likely to serve for the foreseeable future - it contains  
sufficient extension/expansion space to adapt as we find new  
requirements. Note I've specifically ignored multiplexing and Greg's  
MIME proposal, yet both have potential space.

B - Can be treated simply by intermediaries, particularly naïve ones.

Downside is that it's 6 octets, but I can't see an obvious way of  
avoiding this without either having a variable-length header, or  
dropping some features.

I know this will not please everyone completely, and that's okay. I'm  
more curious, though, as to whether this is likely to be workable for  
everyone if pushed.

Dave.
-- 
Dave Cridland - mailto:dave@cridland.net - xmpp:dwd@dave.cridland.net
  - acap://acap.dave.cridland.net/byowner/user/dwd/bookmarks/
  - http://dave.cridland.net/
Infotrope Polymer - ACAP, IMAP, ESMTP, and Lemonade