Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save syzdek/9a05a161d9e542f0f694f20576cd6c75 to your computer and use it in GitHub Desktop.
Save syzdek/9a05a161d9e542f0f694f20576cd6c75 to your computer and use it in GitHub Desktop.
Converting base 10 frame diagram to base 8 with byte offsets:
Original (https://tools.ietf.org/html/rfc6455#section-5.2):
This wire format for the data transfer part is described by the ABNF
[RFC5234] given in detail in this section. (Note that, unlike in
other sections of this document, the ABNF in this section is
operating on groups of bits. The length of each group of bits is
indicated in a comment. When encoded on the wire, the most
significant bit is the leftmost in the ABNF). A high-level overview
of the framing is given in the following figure. In a case of
conflict between the figure below and the ABNF specified later in
this section, the figure is authoritative.
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
+-+-+-+-+-------+-+-------------+-------------------------------+
|F|R|R|R| opcode|M| Payload len | Extended payload length |
|I|S|S|S| (4) |A| (7) | (16/64) |
|N|V|V|V| |S| | (if payload len==126/127) |
| |1|2|3| |K| | |
+-+-+-+-+-------+-+-------------+ - - - - - - - - - - - - - - - +
| Extended payload length continued, if payload len == 127 |
+ - - - - - - - - - - - - - - - +-------------------------------+
| |Masking-key, if MASK set to 1 |
+-------------------------------+-------------------------------+
| Masking-key (continued) | Payload Data |
+-------------------------------- - - - - - - - - - - - - - - - +
: Payload Data continued ... :
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
| Payload Data continued ... |
+---------------------------------------------------------------+
Base 8 with byte offsets:
This wire format for the data transfer part is described by the ABNF
[RFC5234] given in detail in this section. (Note that, unlike in
other sections of this document, the ABNF in this section is
operating on groups of bits. The length of each group of bits is
indicated in a comment. When encoded on the wire, the most
significant bit is the leftmost in the ABNF). A high-level overview
of the framing is given in the following figure. In a case of
conflict between the figure below and the ABNF specified later in
this section, the figure is authoritative.
0 1 2 3
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+-+-+-+-+-------+-+-------------+-------------------------------+
|F|R|R|R| opcode|M| Payload len | Extended payload length |
|I|S|S|S| (4) |A| (7) | (16/64) |
|N|V|V|V| |S| | (if payload len >= 126) |
| |1|2|3| |K| | |
+-+-+-+-+-------+-+-------------+ - - - - - - - - - - - - - - - +
| Extended payload length continued, if payload len == 127 |
+ - - - - - - - - - - - - - - - +-------------------------------+
| |Masking-key, if MASK set to 1 |
+-------------------------------+-------------------------------+
| Masking-key (continued) | Payload Data |
+-------------------------------- - - - - - - - - - - - - - - - +
: Payload Data continued ... :
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
| Payload Data continued ... |
+---------------------------------------------------------------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment