Rust V2X CLI Tool Tutorial (v2x_cli)

The rustflexstack crate includes a complete command-line station, located at examples/v2x_cli.rs. It demonstrates how to assemble the complete stack—from Link Layer and GeoNetworking through BTP, Security, and Facilities (CAM, DENM, VAM, and LDM)—into a single executable.

Downloading Precompiled Binaries (No Compilation Required)

You do not need to install Rust or clone the entire repository to use v2x_cli. Standalone Linux executables are precompiled and directly downloadable from GitHub Releases:

Available binary packages:

  • v2x_cli (x86_64): For standard Intel/AMD Linux PCs, servers, and simulation testbeds.

  • v2x_cli (aarch64): For Arm64 platforms such as Raspberry Pi 5 and single-board computers.

  • v2x_cli_cv2x (aarch64): Precompiled for Cohda Wireless MK6 OBUs/RSUs operating over Qualcomm PC5 direct radio.

Simply download the binary for your platform, grant execution permissions, and run:

chmod +x v2x_cli
sudo ./v2x_cli --help

Command-Line Options

v2x_cli [OPTIONS]

OPTIONS:
    -i, --iface <NAME>     Network interface [default: lo]
    --send <cam|vam>       Transmit CAMs or VAMs [default: receive-only]
    --security             Enable ETSI TS 103 097 signing/verification
    --pki                  Obtain certificates from an ETSI TS 102 941 PKI (implies --security)
    --ea-url <URL>         EA access point [default: http://localhost:8080/ea/v1/enrolment]
    --aa-url <URL>         AA access point [default: http://localhost:8081/aa/v1/authorization]
    --rca-cert <PATH>      Root CA certificate file [default: <certs-dir>/root_ca.cert or rca.coer]
    --ea-cert <PATH>       EA certificate file [default: <certs-dir>/ea.cert or ea.coer]
    --aa-cert <PATH>       AA certificate file [default: <certs-dir>/aa.cert or aa.coer]
    --reprovision          Force reprovisioning from the PKI even if a cached AT exists
    --at <1|2>             Authorization Ticket index (static mode) [default: 1]
    --certs-dir <PATH>     Certificate directory [default: certs/]
    --canonical-key <PATH> Canonical private key, created when absent [default: <certs-dir>/canonical_key.pem]
    --its-id <HEX>         Canonical identifier [default: generated from the canonical public key]
    --gpsd <ADDR>          Use real GPS from gpsd [e.g. 127.0.0.1:2947]
    --lat <DEG>            Static GPS latitude [default: 41.552]
    --lon <DEG>            Static GPS longitude [default: 2.134]
    -h, --help             Print this help

v2x_cli_cv2x (C-V2X link layer, see below) takes the same options except -i, --canonical-key and --its-id.

Common Usage Recipes

1. Receive-Only Sniffer (All Message Types)

Listen on all standard BTP ports (CAM 2001, DENM 2002, VAM 2018), decode incoming packets, and store remote vehicle positions in the Local Dynamic Map:

# Using the precompiled binary:
sudo ./v2x_cli -i eth0

# Or from source:
sudo cargo run --example v2x_cli -- -i eth0

2. Transmit CAMs with Static Coordinates

Broadcast Cooperative Awareness Messages at 10 Hz over interface eth0:

# Using the precompiled binary:
sudo ./v2x_cli -i eth0 --send cam

# Or from source:
sudo cargo run --example v2x_cli -- -i eth0 --send cam

3. Transmit Secured CAMs with ECDSA P-256

Enable ETSI TS 103 097 signing using pre-generated authorization tickets:

# If building from source, generate certificate chain:
cargo run --example generate_certificate_chain

# Transmit secured CAMs:
sudo ./v2x_cli -i eth0 --send cam --security --at 1

4. Transmit VAMs Using Live GPSD Receiver

Connect to a USB or serial GNSS receiver managed by gpsd:

sudo ./v2x_cli -i wlan0 --send vam --gpsd 127.0.0.1:2947

C-V2X Direct Radio Variant (v2x_cli_cv2x)

For deployment on Qualcomm PC5 hardware (such as the Cohda MK6 OBU or RSU):

  • Download the precompiled v2x_cli_cv2x binary from the GitHub Releases page.

  • Copy it to the device via SCP and run:

# Transmit CAMs over real Qualcomm PC5 sidelink
./v2x_cli_cv2x --send cam

# Receive packets over the air
./v2x_cli_cv2x            # receive-only (default)

See Cohda MK6 Deployment Tutorial for the complete hardware setup guide.