sliplib — A module for the SLIP protocol
sliplib module implements the encoding and decoding
functionality for SLIP packets, as described in RFC 1055.
It defines encoding, decoding, and validation functions,
as well as a driver class that can be used to implement
a SLIP protocol stack, and higher-level classes that
apply the SLIP protocol to TCP connections or IO streams.
Read the documentation
for detailed information.
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 data 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 data structures.
The recommended basic usage is to run all encoding and decoding operations
through an instantiation
driver of the
Driver class, in combination
with the appropriate I/O code.
Driver class itself works without any I/O, and can therefore be used with
any networking code, or any bytestream like pipes, serial I/O, etc.
It can work in synchronous as well as in asynchronous environments.
Driver class offers the methods
receive to handle
the conversion between messages and SLIP-encoded packets.
The module also provides a
SlipWrapper abstract baseclass
that provides the methods
recv_msg to send
and receive single SLIP-encoded messages. This base class
wraps an instance of the
Driver class with a user-provided stream.
Two concrete subclasses of
SlipWrapper are provided:
SlipStreamallows the wrapping of a buffered IO stream.
SlipSocketallows the wrapping of a TCP socket.
In addition, the module also provides a
to facilitate the creation of TCP servers that can handle
Contrary to the reference implementation described in RFC 1055,
which chooses to essentially ignore protocol errors,
the functions and classes in the
to indicate protocol errors, i.e. SLIP packets with invalid byte sequences.
Driver class raises the
as soon as a SLIP packet with an invalid byte sequence is received .
SlipWrapper class and its subclasses catch the
raised by the
Driver class, and re-raise them when
an attempt is made to read the contents of a SLIP packet with invalid data.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size sliplib-0.3.0-py3-none-any.whl (14.6 kB)||File type Wheel||Python version py3||Upload date||Hashes View hashes|
|Filename, size sliplib-0.3.0.tar.gz (11.8 kB)||File type Source||Python version None||Upload date||Hashes View hashes|