Skip to main content

L2 - Network layer

The Layer 2 (Network Layer) acts as the great equalizer for the NSLP stack, responsible for taking potentially large Transport Layer (L3) payloads and segmenting them into strict, predictable Network MTUs (Maximum Transmission Units). Overall NSLP packet size is strictly capped at 255 bytes to accommodate highly constrained mediums (e.g., LoRa, CAN)

Overview

L2 encapsulates each chunk with the standardized 4-byte NSLP routing header. This header contains critical information such as the source and destination addresses, protocol identifiers, and payload size. By enforcing a consistent packet structure, L2 ensures that all underlying Layer 1 implementations can reliably parse and route data regardless of the physical medium.

NSLP Packet

While the exact bit-level arrangements are dictated by the specific hardware medium, every Layer 1 implementation fundamentally acts as a protective envelope around your data. It wraps the standard Layer 2 packet with medium-agnostic transmission data such as size.

General structure

01
0123456789101112131415
VersionProtocolSource Address
Destination AddressSize
Data (Bytes 0 - 250)

Fields

  • Version (4 bits): The version of the NSLP protocol stack in use. Underlying implementations may parse packets differently based on this field.

    note

    The current latest version is 0x01.

  • Protocol (4 bits): The identifier of the encapsulated Layer 3 protocol payload.

  • Source Address (8 bits): The unique network identifier of the device transmitting the packet.

  • Destination Address (8 bits): The unique network identifier of the intended recipient device.

  • Size (8 bits): The exact size of the data payload.

    info

    Many underlying mediums have strict size constraints (e.g., LoRa, CAN). To accommodate this, we designed the packet to max out at 255 bytes total. With a 4-byte header, this allows for a maximum payload size of 251 bytes.

  • Data (up to 251 bytes): The actual L2 payload being securely delivered across the network.

TL;DR

NSLP Layer 2 is the critical bridge between your application data and the physical transmission medium. It enforces a strict 255 byte packet size limit, with a standardized 4-byte header. Latest version is 0x01 and it supports multiple Layer 3 protocols through the Protocol field.