Re: [hybi] Framing Take VI (a compromise proposal)

Douglas Otis <dotis@mail-abuse.org> Tue, 17 August 2010 00:35 UTC

Return-Path: <dotis@mail-abuse.org>
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 594DE3A6835 for <hybi@core3.amsl.com>; Mon, 16 Aug 2010 17:35:48 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -105.71
X-Spam-Level:
X-Spam-Status: No, score=-105.71 tagged_above=-999 required=5 tests=[AWL=-0.311, BAYES_00=-2.599, J_CHICKENPOX_44=0.6, J_CHICKENPOX_54=0.6, RCVD_IN_DNSWL_MED=-4, USER_IN_WHITELIST=-100]
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 GV4mLjTzeiIk for <hybi@core3.amsl.com>; Mon, 16 Aug 2010 17:35:47 -0700 (PDT)
Received: from harry.mail-abuse.org (harry.mail-abuse.org [168.61.5.27]) by core3.amsl.com (Postfix) with ESMTP id E1D743A67E3 for <hybi@ietf.org>; Mon, 16 Aug 2010 17:35:45 -0700 (PDT)
Received: from sjc-office-nat-210.mail-abuse.org (gateway1.sjc.mail-abuse.org [168.61.5.81]) by harry.mail-abuse.org (Postfix) with ESMTP id CFD06A94490 for <hybi@ietf.org>; Tue, 17 Aug 2010 00:36:17 +0000 (UTC)
Message-ID: <4C69D981.3040905@mail-abuse.org>
Date: Mon, 16 Aug 2010 17:36:17 -0700
From: Douglas Otis <dotis@mail-abuse.org>
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.8) Gecko/20100802 Thunderbird/3.1.2
MIME-Version: 1.0
To: hybi@ietf.org
References: <AANLkTi=TBXO_Cbb+P+e2BVfx69shkf8E1-9ywDh_Y+Kz@mail.gmail.com> <AANLkTimJOGWgV6rx5JJYSJMC26OzQzskzVtkYz0L_EAg@mail.gmail.com> <op.vhe7qtmu64w2qv@anne-van-kesterens-macbook-pro.local> <AANLkTimqvQGJab-XdMuRFE8M2eB_xn_ipJZoNDuc28R2@mail.gmail.com> <4C66F67C.2080406@caucho.com>
In-Reply-To: <4C66F67C.2080406@caucho.com>
Content-Type: text/plain; charset="UTF-8"; format="flowed"
Content-Transfer-Encoding: 7bit
Subject: Re: [hybi] Framing Take VI (a compromise 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: Tue, 17 Aug 2010 00:35:48 -0000

  On 8/14/10 1:03 PM, Scott Ferguson wrote:
> Well, the complexity is more of a spec issue than a coding one because 
> none of these proposals are hugely complicated to implement. 
> (Implementing them efficiently is a different matter.)
>
> A Jamie-style proposal less complex because it leaves the basic frame 
> clean without needing the extension length or the extension payload 
> and without the extra complete-length field. The frame would look like:
>
> 0                   1                   2                   3
> 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
> +-+-+-+---------+-------------------------------+---------------+
> |I|F|B|opcode(5)| length(16)                    |               |
> |N|I|I|         |                               |               |
> |I|N|G|         |                               |               |
> +-+-+-+---------+-------------------------------+ - - - - - - - +
> | big-length(48) if BIG = 1                                     |
> + - - - - - - - +-----------------------------------------------+
> |               | payload(length)                               |
> +---------------+                                               |
> |                                                               |
> +---------------------------------------------------------------+
>
> As a measure of complexity, compare the features that can vary the 
> frame-header size:
>
>  a) short/long payload length
>  b) extension data
>  c) short/long extension length
>  d) complete message-length
>
> A Jamie-style extension only has the single complexity-feature (a) to 
> the frame-header, while your proposal adds 3 more (b,c,d). Since the 
> Jamie-style extension supports all the extension capabilities that 
> yours does, there's no added capabilities with the extra complexity 
> added by b,c,d.
>
> As a separate issue, your code's signature doesn't capture the essence 
> of the problem, because you really need to consider all the APIs when 
> evaluating a framing proposal, not just one that happens to be easy to 
> implement for the proposal. Your example was a specialized API that 
> really only works for utf-8 encoded 8-bit C-strings.
>
> The basic sender APIs that framing needs to support are:
>
> a)  sendTextMessage(char []buffer, int offset, int length); // 
> JavaScript 16-bit text send
> a*) sendTextMessage(byte []buffer, int offset, int length); // utf-8 
> encoded text (like PHP)
>
> b)  sendBinaryMessage(byte []buffer, int offset, int length); // 
> binary single-buffer send
>
> c)  class BinaryMessageOutputStream {
>    write(byte []buffer, int offset, int length);
>    close();
>  }
>
> d)  class TextMessageWriter {
>    write(char []buffer, int offset, int length);
>    close();
>  }
>
> The receiver variations are
>
> a) char []receiveTextMessage()
>
> b) byte []receiveBinaryMessage() // if returning utf-8 8-bit strings, 
> this is the text receive
>
> c) class BinaryMessageInputStream {
>      int read(byte []buffer, int offset, int length);
>    }
>
> d) class TextMessageReader {
>      int read(char []buffer, int offset, int length);
>    }
>
> A good frame design will support all 5 sender API styles and 4 
> receiver API styles in a straightforward/efficient manner. You can't 
> just pick one API that happens to make a frame proposal work.
>
> -- Scott

This offers a cleaner definition.  The higher level protocol could also 
define an initial frame as a TLV content declaration where the next 
frame (after the TLV) begins the payload.  Perhaps this is what is meant 
by extension?  Having this information in a defined place helps with 
content filtering. Perhaps one of the 5 opcode bits could signal the 
presence of the declaration.

-Doug