Expand description
SLIP framing, the Serial Line Internet Protocol of RFC 1055.
SLIP is the oldest and simplest way to put packets on a serial line. A single byte,
END, marks the end of a packet. When that byte (or the escape byte ESC) appears
in the payload it is replaced by a two-byte escape sequence, so the delimiter can never
be mistaken for data. That is the whole protocol; its appeal is that it fits in a
handful of bytes of code on the smallest microcontroller.
The four byte values are fixed by RFC 1055: END is 0xC0, ESC is 0xDB, and
the escape sequences are ESC ESC_END for a literal END and ESC ESC_ESC for a
literal ESC.
Structs§
- Slip
Decoder - A streaming SLIP decoder that reassembles whole frames from a serial byte stream.
Constants§
- END
- The SLIP frame delimiter, RFC 1055
END(octal 300). - ESC
- The SLIP escape byte, RFC 1055
ESC(octal 333). - ESC_END
- The byte that follows
ESCto encode a literalEND, RFC 1055ESC_END(octal 334). - ESC_ESC
- The byte that follows
ESCto encode a literalESC, RFC 1055ESC_ESC(octal 335).
Functions§
- decode
- Decodes a single SLIP frame, recovering the original payload.
- encode
- Encodes a payload into a SLIP frame, terminated by an
ENDbyte. - max_
encoded_ len - Returns an output length that is always large enough to hold the SLIP encoding of a
payload of
payload_lenbytes.