Subject: Re: [hybi] ABNF issue in draft-ietf-hybi-thewebsocketprotocol

From: "Martin J. Dürst" <[email-masked]>
Date: Sun, 02 Oct 2011 15:19:07 +0900

Again, just for the record; I'm NOT proposing that we make a change in 
this direction now:

On 2011/09/30 18:17, Alexey Melnikov wrote:
> Martin J. Dürst wrote:

>> [Just for the record, another way out would be to come up with a %b
>> notation, and define that the number of bits in a group is given by
>> the length of the 0/1 string after the %b.]
>
> But this would not be ABNF anymore, so validating it with existing tools
> would not be possible. But maybe something to do in the future.

Well actually, it turns out that %b is already defined in RFC 5234. 
Thinking about this some more, it dawned on me that to overcome the 
problem of varying lengths in the grammar is to realize that the basic 
underlying unit of our grammar for the protocol part is *a single bit*.

So instead of using the ABNF to describe sequences of characters (ASCII 
in general or Unicode e.g. in case of RFC 3097), we would use it to 
describe sequences of bits (and very clearly say so). So we'd get e.g. 
something like:

      short-frame-payload-length  = %b0 6*BIT
                                  | %b1.0 5*BIT
                                  | %b1.1.0 4*BIT
                                  | %b1.1.1.0 3*BIT
                                  | %b1.1.1.1.0 2*BIT
                                  | %b1.1.1.1.1.0 BIT
                              ; all 7-bit values except %x7E and %x7F

      middle-frame-payload-length = %b1.1.1.1.1.1.0   ; %x7E
                                    16*BIT    ; the actual length,
                                     ; some values ruled out by prose,

      long-frame-payload-length   = 7*%b1     ; %x7F
                                    64*BIT    ; the actual length,
                                    ; some values ruled out by prose,

      BIT                         = %b0 | %b1
      ; I prefer that to what RFC 5234 has:
      ; BIT            =  "0" / "1"

Regards,   Martin.