nros_platform/board/network.rs
1//! [`NetworkError`] — the vocabulary for a link-up failure.
2//!
3//! **The `NetworkWait` TRAIT was removed in phase-206 W4 (issue 1067).** It had
4//! one implementation and no callers, and the one place that would have called
5//! it — the `nros::main!` Zephyr arm — deliberately routed around it, because
6//! `ZephyrBoard::wait_link_up` calls `net_if_is_up` / `k_msleep`, `static
7//! inline` header functions with no link symbol, so the native_sim final link
8//! failed on undefined references.
9//!
10//! The documented boot order it belonged to could not be built either: the
11//! shape the book described,
12//! `impl<B: Board + TransportBringup + NetworkWait> BoardEntry for B`, OVERLAPS
13//! the twelve direct `BoardEntry` impls, and Rust has no "call this method if
14//! the type happens to implement it". "Skipped if the board doesn't impl the
15//! mixin" was not expressible.
16//!
17//! What boards actually do — and the contract that now stands — is
18//! [`super::BoardEntry::run`], whose body (usually a family helper such as
19//! `nros_board_freertos::run_entry`) owns bring-up in the order that board
20//! needs. `ZephyrBoard::wait_link_up` survives as an INHERENT method, which is
21//! how its one caller (its own README example) already used it.
22//!
23//! The error type stays: it is the shared vocabulary a board reports a link
24//! failure in, and it is used whether or not a trait wraps it.
25
26/// Network bringup failure mode.
27#[derive(Debug, Clone, Copy, PartialEq, Eq)]
28#[non_exhaustive]
29pub enum NetworkError {
30 /// PHY linked but no DHCP lease before the board's deadline.
31 DhcpTimeout,
32 /// Static-IP configuration referenced a non-existent interface
33 /// or duplicate address.
34 ConfigInvalid,
35 /// No default route or gateway unreachable.
36 NoRoute,
37 /// Board-specific failure not covered by the above.
38 Other,
39}