Full project rename, decided 2026-06-10: - Crates/binaries: punktfunk-core / punktfunk-host / punktfunk-client-rs. - C ABI: punktfunk_* symbols, Punktfunk* types, include/punktfunk_core.h, PUNKTFUNK_FEATURE_QUIC guard (header regenerated; cbindgen renames updated, incl. PUNKTFUNK_BTN_*/PUNKTFUNK_AXIS_* wire constants). - Protocol: punktfunk/1 — control-plane magic LMN1 → PKF1, nonce salt lmn1 → pkf1. WIRE BREAK: clients must be rebuilt from this revision. - Env knobs: PUNKTFUNK_VIDEO_SOURCE / PUNKTFUNK_COMPOSITOR / PUNKTFUNK_ZEROCOPY / …. - Host config dir: ~/.config/punktfunk (the box's dir was migrated in place — the persistent identity is unchanged, pinned fingerprints stay valid). - Swift package: PunktfunkKit + PunktfunkCore.xcframework + PunktfunkConnection (Sources/PunktfunkClient app + tests renamed with it); build-xcframework.sh updated. - scripts/: 60-punktfunk.rules, punktfunk-host.service; OpenAPI doc regenerated. Also: scripts/headless/run-headless-kde.sh — full headless Plasma bringup. Root cause of "desktop but no apps/settings" over the stream: plasmashell launched without XDG_MENU_PREFIX=plasma-, so the launcher resolved a nonexistent applications.menu and rendered an empty menu. The script sets the complete KDE session env (menu prefix, KDE_FULL_SESSION, session version) and rebuilds ksycoca before starting plasmashell. Gate: 97/97 tests, clippy -D warnings (both feature sets), fmt, C-ABI harness PASS, zero lumen references left outside .git. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
//! Error type and the stable C ABI status codes it maps to.
|
||||
|
||||
use thiserror::Error;
|
||||
|
||||
/// The core's internal error type. Crosses the C ABI as a [`PunktfunkStatus`] code.
|
||||
#[derive(Debug, Error)]
|
||||
pub enum PunktfunkError {
|
||||
#[error("invalid argument: {0}")]
|
||||
InvalidArg(&'static str),
|
||||
#[error("fec error: {0}")]
|
||||
Fec(#[from] crate::fec::FecError),
|
||||
#[error("crypto seal/open failed")]
|
||||
Crypto,
|
||||
#[error("malformed packet")]
|
||||
BadPacket,
|
||||
#[error("no complete frame available yet")]
|
||||
NoFrame,
|
||||
#[error("unsupported: {0}")]
|
||||
Unsupported(&'static str),
|
||||
#[error("io error: {0}")]
|
||||
Io(#[from] std::io::Error),
|
||||
#[error("timed out")]
|
||||
Timeout,
|
||||
#[error("session closed")]
|
||||
Closed,
|
||||
}
|
||||
|
||||
pub type Result<T> = core::result::Result<T, PunktfunkError>;
|
||||
|
||||
/// Stable C ABI status codes. `Ok` is 0; all errors are negative so callers can
|
||||
/// test `rc < 0`. Do not renumber existing variants — only append.
|
||||
#[repr(i32)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum PunktfunkStatus {
|
||||
Ok = 0,
|
||||
InvalidArg = -1,
|
||||
Fec = -2,
|
||||
Crypto = -3,
|
||||
BadPacket = -4,
|
||||
NoFrame = -5,
|
||||
Unsupported = -6,
|
||||
Io = -7,
|
||||
NullPointer = -8,
|
||||
Timeout = -9,
|
||||
Closed = -10,
|
||||
Panic = -99,
|
||||
}
|
||||
|
||||
impl PunktfunkError {
|
||||
/// Map to the C ABI status code.
|
||||
pub fn status(&self) -> PunktfunkStatus {
|
||||
match self {
|
||||
PunktfunkError::InvalidArg(_) => PunktfunkStatus::InvalidArg,
|
||||
PunktfunkError::Fec(_) => PunktfunkStatus::Fec,
|
||||
PunktfunkError::Crypto => PunktfunkStatus::Crypto,
|
||||
PunktfunkError::BadPacket => PunktfunkStatus::BadPacket,
|
||||
PunktfunkError::NoFrame => PunktfunkStatus::NoFrame,
|
||||
PunktfunkError::Unsupported(_) => PunktfunkStatus::Unsupported,
|
||||
PunktfunkError::Io(_) => PunktfunkStatus::Io,
|
||||
PunktfunkError::Timeout => PunktfunkStatus::Timeout,
|
||||
PunktfunkError::Closed => PunktfunkStatus::Closed,
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user