FlexStack Logo

1. Overview & Architecture

  • Ecosystem Overview
  • Getting Started
  • Unified Architecture & Design
  • Supported ETSI C-ITS Standards
  • Performance & Validation

2. Python (v2xflexstack)

  • Python Quickstart (v2xflexstack)
  • Python Concurrency & Architecture
  • Python Link Layer Abstraction
  • Python GeoNetworking (GN) Protocol
  • Python Basic Transport Protocol (BTP)
  • Python Security Subsystem
  • Cooperative Awareness (CA) Basic Service
  • Decentralized Environmental Notification (DEN) Service
  • Vulnerable Road User (VRU) Awareness Service
  • Local Dynamic Map
  • Python Location & Time Utilities
  • Python API Reference
    • flexstack.linklayer Module
    • flexstack.geonet Module
    • flexstack.btp Module
    • flexstack.security Module
    • flexstack.facilities Module
    • flexstack.management Module
    • flexstack.utils Module

3. Rust (rustflexstack)

  • Rust Quickstart (rustflexstack)
  • Rust Actor Architecture & Concurrency
  • Rust Link Layer Drivers
  • Rust GeoNetworking (GN) Router
  • Rust Basic Transport Protocol (BTP)
  • Rust Security Subsystem
  • Rust Cooperative Awareness (CAM)
  • Rust Decentralized Environmental (DENM)
  • Rust VRU Awareness (VAM)
  • Rust Local Dynamic Map (LDM)
  • Cross-Compilation for Embedded Linux
  • Embedded Qualcomm C-V2X (Cohda MK6 Deployment)
  • Rust API Reference
    • Rust API: Link Layer
    • Rust API: GeoNetworking
    • Rust API: BTP
    • Rust API: Security
    • Rust API: Facilities
    • Rust API: Management

4. Tutorials & Hardware Deployment

  • Docker Deployment Tutorial
  • V2X Over Ethernet & Virtual Pairs (veth) Tutorial
  • Logging Configuration Tutorial
  • Rust V2X CLI Tool Tutorial (v2x_cli)
  • Certificates: Static Chains and PKI Provisioning
  • Cohda MK6 C-V2X Hardware Deployment Tutorial

5. About & Community

  • Academic Citation & Research Paper
  • Research Projects & Grants
  • License & Attributions
FlexStack
  • Rust Link Layer Drivers
  • View page source

Rust Link Layer Drivers

The rustflexstack::link_layer module moves GeoNetworking packets between the GeoNetworking router and the network interface. Every driver is connected to the router by two std::sync::mpsc channels: received packets go to the router, and the router’s outgoing packets come from it.

Available Drivers

Driver

Underlying Technology

Feature Flag

RawLinkLayer

pnet raw datalink channels (Ethernet, IEEE 802.11p OCB), EtherType 0x8947

Default

Cv2xLinkLayer

Qualcomm Telematics SDK through a C FFI (e.g. Cohda MK6)

--features cv2x

RawLinkLayer

RawLinkLayer::new(gn_tx, gn_rx, iface, mac) takes the sender of received packets, the receiver of the router’s packets, the interface name and the station’s MAC address; start() launches its receive and transmit threads. Received frames with the GeoNetworking EtherType are passed on without the Ethernet header; outgoing packets are broadcast, or sent to the next hop’s MAC address when unicast forwarding is enabled with with_unicast_receiver.

use std::sync::mpsc;
use std::thread;
use rustflexstack::geonet::gn_address::{GNAddress, M, MID, ST};
use rustflexstack::geonet::mib::{GnIfType, Mib};
use rustflexstack::geonet::router::Router as GNRouter;
use rustflexstack::link_layer::raw_link_layer::RawLinkLayer;

let mac = [0x02u8, 0x11, 0x22, 0x33, 0x44, 0x55];
let mut mib = Mib::new();
mib.itsGnLocalGnAddr = GNAddress::new(M::GnMulticast, ST::PassengerCar, MID::new(mac));
mib.itsGnIfType = GnIfType::ItsG5;
let (gn_handle, gn_to_ll_rx, _gn_to_btp_rx) = GNRouter::spawn(mib, None, None, None);

let (ll_to_gn_tx, ll_to_gn_rx) = mpsc::channel::<Vec<u8>>();
let (unicast_tx, unicast_rx) = mpsc::channel();
gn_handle.set_unicast_sender(unicast_tx);
let raw_ll = RawLinkLayer::new(ll_to_gn_tx, gn_to_ll_rx, "eth0", mac).with_unicast_receiver(unicast_rx);
// ETSI TS 103 836-4-2 clause 6.1: over ITS-G5 the MID is the interface MAC address
assert!(mib.media_dependent_address_ok(Some(raw_ll.media_dependent_mid())));
raw_ll.start();

// Received packets to the GeoNetworking router
let gn = gn_handle.clone();
thread::spawn(move || {
    while let Ok(packet) = ll_to_gn_rx.recv() {
        gn.send_incoming_packet(packet);
    }
});

Opening raw sockets needs root privileges or the CAP_NET_RAW capability.

Qualcomm C-V2X Driver (Cv2xLinkLayer)

Built with --features cv2x against the Qualcomm Telematics SDK (see Embedded Qualcomm C-V2X (Cohda MK6 Deployment)), Cv2xLinkLayer::new(gn_tx, gn_rx) opens the C-V2X transmit and receive flows and is started in the same way. examples/cv2x_denm_sender_receiver.rs and examples/v2x_cli_cv2x.rs show the complete wiring.

Previous Next

© Copyright 2025-2026, i2CAT Foundation.

Built with Sphinx using a theme provided by Read the Docs.