520d7342dd
ci / rust (push) Has been cancelled
m3-host is now a real host, not a one-shot demo. Everything validated live on this box (two back-to-back sessions, pinned + TOFU, ~200 audio pkts/s, p50 0.84 ms at 720p60). lumen-core: - quic.rs: QUIC-datagram side planes demuxed by first byte — Opus audio 0xC9 ([magic][u32 seq][u64 pts_ns][opus], host→client) and rumble 0xCA ([magic][pad][low][high]). - Trust: endpoint::server_with_identity (persistent PEM identity) and endpoint::client_pinned — SHA-256 cert-fingerprint pinning with TOFU (observed fingerprint reported back for persisting). The verifier checks the TLS 1.3 CertificateVerify signature for real (an MITM replaying the host's public cert without its key is rejected; cert pinning alone would not prove key possession). - client.rs: NativeClient gains pin + host_fingerprint, audio/rumble receivers (next_audio / next_rumble); pull methods take &self so the C ABI's per-plane threads never alias a &mut (per-plane mutexed borrow slots in abi.rs). - abi.rs: lumen_connect(pin_sha256, observed_sha256_out) + lumen_connection_next_audio / next_rumble. input.rs: documented gamepad wire contract (GameStream buttonFlags bits, XInput axis conventions, +y = up) — exported as LUMEN_BTN_*/LUMEN_AXIS_* (bare BTN_* collides with <linux/input-event-codes.h> at different values). lumen-host (m3): - Persistent accept loop: sessions back to back on one endpoint (--max-sessions, 0 = forever); per-session failures log and the loop keeps serving; 10 s handshake deadline so a silent client can't wedge the sequential accept queue; teardown on every exit path (stop flag → conn.close → join audio+input threads). - Audio plane: desktop PipeWire capture → Opus 48 kHz stereo 5 ms CBR → datagrams; ONE capturer reused across sessions via an AudioCapSlot (PipeWire streams have no cheap teardown — per-session opens would leak a thread + core connection + live node each). - Gamepad routing: incremental GamepadButton/GamepadAxis datagrams accumulate into per-pad state feeding the uinput xpad manager; force feedback returns as rumble datagrams, with current state re-sent every 500 ms (idempotent-state healing for the lossy channel). QUIC endpoint serves the persistent ~/.config/lumen identity and logs the pinnable fingerprint. lumen-client-rs: --pin (malformed values abort — never silently downgrade to TOFU), TOFU fingerprint logging, audio/rumble datagram counters, gamepad events in --input-test. clients/apple: scaffold synced — pinSHA256/hostFingerprint (wrong-size pin throws, fail-closed), nextAudio/nextRumble, gamepad event constructors; README handoff updated (persistent listener, audio decode notes, trust UX). Adversarially reviewed (5-dimension multi-agent pass over the diff, 2-skeptic verification): fixed the MITM signature-check gap, a Y-axis contract inversion, header macro collisions, ABI aliasing UB, the PipeWire per-session leak, the missing handshake deadline, fail-open pin parsing, and teardown-on-error paths. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
57 lines
1.6 KiB
TOML
57 lines
1.6 KiB
TOML
language = "C"
|
|
pragma_once = true
|
|
include_guard = "LUMEN_CORE_H"
|
|
autogen_warning = "/* Generated by cbindgen from lumen-core. Do not edit by hand. */"
|
|
header = "/* lumen-core C ABI — see crates/lumen-core/src/abi.rs */"
|
|
style = "type"
|
|
cpp_compat = true
|
|
tab_width = 4
|
|
documentation = true
|
|
documentation_style = "c99"
|
|
|
|
[parse]
|
|
parse_deps = false
|
|
|
|
[export.rename]
|
|
"InputEvent" = "LumenInputEvent"
|
|
"InputKind" = "LumenInputKind"
|
|
# Gamepad wire constants: bare BTN_* names collide with <linux/input-event-codes.h> (at
|
|
# DIFFERENT values — last definition silently wins); prefix everything we export.
|
|
"BTN_DPAD_UP" = "LUMEN_BTN_DPAD_UP"
|
|
"BTN_DPAD_DOWN" = "LUMEN_BTN_DPAD_DOWN"
|
|
"BTN_DPAD_LEFT" = "LUMEN_BTN_DPAD_LEFT"
|
|
"BTN_DPAD_RIGHT" = "LUMEN_BTN_DPAD_RIGHT"
|
|
"BTN_START" = "LUMEN_BTN_START"
|
|
"BTN_BACK" = "LUMEN_BTN_BACK"
|
|
"BTN_LS_CLICK" = "LUMEN_BTN_LS_CLICK"
|
|
"BTN_RS_CLICK" = "LUMEN_BTN_RS_CLICK"
|
|
"BTN_LB" = "LUMEN_BTN_LB"
|
|
"BTN_RB" = "LUMEN_BTN_RB"
|
|
"BTN_GUIDE" = "LUMEN_BTN_GUIDE"
|
|
"BTN_A" = "LUMEN_BTN_A"
|
|
"BTN_B" = "LUMEN_BTN_B"
|
|
"BTN_X" = "LUMEN_BTN_X"
|
|
"BTN_Y" = "LUMEN_BTN_Y"
|
|
"AXIS_LS_X" = "LUMEN_AXIS_LS_X"
|
|
"AXIS_LS_Y" = "LUMEN_AXIS_LS_Y"
|
|
"AXIS_RS_X" = "LUMEN_AXIS_RS_X"
|
|
"AXIS_RS_Y" = "LUMEN_AXIS_RS_Y"
|
|
"AXIS_LT" = "LUMEN_AXIS_LT"
|
|
"AXIS_RT" = "LUMEN_AXIS_RT"
|
|
"AUDIO_MAGIC" = "LUMEN_AUDIO_MAGIC"
|
|
"RUMBLE_MAGIC" = "LUMEN_RUMBLE_MAGIC"
|
|
|
|
# QualifiedScreamingSnakeCase already qualifies each variant with the enum name
|
|
# (LumenStatus::Ok -> LUMEN_STATUS_OK); do NOT also set prefix_with_name or it doubles.
|
|
[enum]
|
|
rename_variants = "QualifiedScreamingSnakeCase"
|
|
|
|
[fn]
|
|
sort_by = "None"
|
|
|
|
[struct]
|
|
derive_eq = false
|
|
|
|
[defines]
|
|
"feature = quic" = "LUMEN_FEATURE_QUIC"
|