Skip to main content

Slip package

Project description

ReadTheDocs Documentation Status Travis Test Status AppVeyor Test Status

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, 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.

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 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.

Usage

Installation

To install the sliplib module, use

pip install sliplib

Low-level usage

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. The 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.

The Driver class offers the methods send and receive to handle the conversion between messages and SLIP-encoded packets.

High-level usage

The module also provides a SlipWrapper abstract baseclass that provides the methods send_msg and 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:

  • SlipStream allows the wrapping of a byte IO stream.

  • SlipSocket allows the wrapping of a TCP socket.

In addition, the module also provides a SlipRequestHandler to facilitate the creation of TCP servers that can handle SLIP-encoded messages.

Error Handling

Contrary to the reference implementation described in RFC 1055, which chooses to essentially ignore protocol errors, the functions and classes in the sliplib module use a ProtocolError exception to indicate protocol errors, i.e. SLIP packets with invalid byte sequences. The Driver class raises the ProtocolError exception as soon as a complete SLIP packet with an invalid byte sequence is received . The SlipWrapper class and its subclasses catch the ProtocolErrors raised by the Driver class, and re-raise them when an attempt is made to read the contents of a SLIP packet that contained invalid data.

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

sliplib-0.6.2.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

sliplib-0.6.2-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file sliplib-0.6.2.tar.gz.

File metadata

  • Download URL: sliplib-0.6.2.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.0

File hashes

Hashes for sliplib-0.6.2.tar.gz
Algorithm Hash digest
SHA256 443f480339927c2a192783626dcab6eb1726e2ec78ce35405ff4935316138b29
MD5 c6f22d088305f757b853b75b9218ff3b
BLAKE2b-256 a56923ac21075ef1757a9bd10c9f01df0a06c41ec34384db2c0b7cbbfd6b3ede

See more details on using hashes here.

File details

Details for the file sliplib-0.6.2-py3-none-any.whl.

File metadata

  • Download URL: sliplib-0.6.2-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.0

File hashes

Hashes for sliplib-0.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 43622142805e08b0671210935b47f2d45cb94db84ffbba8660665750d0fde4e3
MD5 2128d30b0a9dcdf7a6300cdb52ed46c4
BLAKE2b-256 a2266f06fd6fe7f6edc550dfb75d37f9a92dc91b725ee8e2a3184ee774519bb4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page