mirror of
https://github.com/vacp2p/specs.git
synced 2026-01-08 23:08:09 -05:00
@@ -54,7 +54,7 @@ Implementations in:
|
||||
|
||||
Every communication in mplex consists of a header, and a length prefixed data segment.
|
||||
|
||||
The header is an unsigned base128 varint, as defined in the [protocol buffers spec](https://developers.google.com/protocol-buffers/docs/encoding#varints). The lower three bits are the message flags, and the rest of the bits (shifted down by three bits) are the stream ID this message pertains to:
|
||||
The header is an [unsigned base128 varint](https://github.com/multiformats/unsigned-varint). The lower three bits are the message flags, and the rest of the bits (shifted down by three bits) are the stream ID this message pertains to:
|
||||
|
||||
```
|
||||
header = readUvarint()
|
||||
@@ -62,6 +62,8 @@ flag = header & 0x07
|
||||
id = header >> 3
|
||||
```
|
||||
|
||||
The maximum length is 9 bytes (per the unsigned-varint spec) and the maximum stream ID is 60 bytes (`2^60 - 1`).
|
||||
|
||||
### Flag Values
|
||||
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user