Skip to content

JahazielLem/spacecan_lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SpaceCAN Library

Build Status License: GPL-3.0-or-later

A high-performance, lightweight C implementation of the SpaceCAN protocol. Designed for modular spacecraft communication and research, this library provides a simulated environment to test satellite bus architectures, telemetry flows, and cybersecurity vulnerabilities (ICS-style) without requiring physical hardware.

Note: This version 1.0.0, is not a full implementation of the https://librecube.gitlab.io/standards/spacecan/

Core Features

  • Standard Compliance: Implementation of SpaceCAN ID management (Request/Reply frames).
  • Packet Fragmentation: Native support for multi-frame transfer and reassembly for payloads exceeding the 8-byte CAN limit.
  • Network Management (NMT): Built-in Heartbeat and Synchronization (SYNC) mechanisms for node health monitoring.
  • Virtual Bus Architecture: A robust server-client model (busd) using Unix sockets to emulate a physical CAN bus.
  • Research Oriented: Designed for "Space-ICSim" scenarios, allowing for fault injection and protocol analysis.

Toolset

The library includes a suite of CLI and TUI tools for network interaction:

Tool Description
controller The central bus daemon (busd) acting as the communication hub.
scsniffer Diagnostic tool with filtering. Supports PCAP (Wireshark) and custom Replay formats.
scviewer Real-time Ncurses TUI for monitoring packet frequency, timing, and data.
scmonitor Dedicated TUI for real-time telemetry visualization from simulated sensors.
scinjection Command-line utility for manual frame crafting and bus injection.
screplay Automated traffic replay engine for testing state-machine persistence.

Getting Started

Prerequisites

  • GCC / Clang
  • Ncurses Development Libraries
  • Make

Installation

sudo apt update
sudo apt install meson libncurses-dev

git clone https://github.com/JahazielLem/spacecan_lib.git
cd spacecan_lib
meson setup buildDir
meson compile -C buildDir
meson install -C buildDir

Usage Workflow

  1. Initialize the Bus:

    Start the central controller to allow nodes to connect.

    ./controller
  2. Network Monitoring:

    Use the sniffer to capture traffic or the viewer for a live overview.

    ./scsniffer -o capture.pcap  # Capture to Wireshark format
    ./scviewer                   # Launch real-time TUI
  3. Sensor Visualization:

    Monitor simulated node data (telemetry).

    ./scmonitor
  4. Traffic Injection:

    Inject a manual frame (Example: CANID 0x284, 2 bytes of data).

    ./scinjection 0x284 01 12

Node Emulation

The library provides pre-defined worker patterns for Sensors and Motors. These templates include state management and telemetry loops, allowing researchers to quickly instantiate operational nodes within the simulation.

License

This project is licensed under the GPL-3.0-or-later license.

About

A high-performance, lightweight C implementation of the **SpaceCAN** protocol. Designed for modular spacecraft communication and research, provides a simulated environment to test satellite bus architectures, telemetry flows, and cybersecurity vulnerabilities (ICS-style).

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors