Support for the SLIP protocol (RFC 1055)
Project description
sliplib — A module for the SLIP protocol
The sliplib module implements the encoding and decoding functionality for SLIP packets, as described in RFC 1055. It defines encoding and decoding functions and classes, and registers these in the codecs module.
Background
The SLIP protocol is described in RFC 1055 (A Nonstandard for Transmission of IP Datagrams over Serial Lines: SLIP, J. Romkey, June 1988). The original purpose of the protocol is to provide a mechanism to indicate the boundaries of IP packets, in particular when the IP packets are sent over a connection that does not provide a framing mechanism, such as serial lines or dial-up connections.
There is, however, nothing specific to IP in the SLIP protocol. SLIP offers a generic framing method that can be used for any type of message that must be transmitted over a (continuous) byte stream. In fact, the main reason for creating this module was the need to communicate with a third-party application that used SLIP over TCP (which is a continuous byte stream) to frame variable length messages.
The SLIP protocol uses four special byte values:
Byte value |
Name |
Purpose |
---|---|---|
|
END |
to delimit messages |
|
ESC |
to escape END or ESC bytes in the message |
|
ESC_END |
the escaped value of the END byte |
|
ESC_ESC |
the escaped value of the ESC byte |
An END byte in the message is encoded as the sequence
ESC+ESC_END (b'\xdb\xdc'
)
in the slip packet,
and an ESC byte in the message is encoded
as the sequence ESC+ESC_ESC (b'\xdb\xdd'
).
Original |
Encoded |
---|---|
b'\xc0' |
b'\xdb\xdc' |
b'\xdb' |
b'\xdb\xdd' |
As a consequence, an ESC byte in a slip packet must always be followed by an ESC_END or an ESC_ESC byte; anything else is a protocol error. Although the implementation code proposed by RFC 1055 ignores such errors, the sliplib module raises an exception in such cases.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file sliplib-0.0.1.tar.gz
.
File metadata
- Download URL: sliplib-0.0.1.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b38ce79273709c7b17c16225c8f785676f0c4546ac483865b588b12d3aad5448 |
|
MD5 | 46c150ab3cc6e68b8ffce91bcb0cb2ce |
|
BLAKE2b-256 | b4b6e94054b5093b0a7e284a67d8ad5317904188fd2e5b5046713016b2e58329 |