nros_platform/board/network.rs
1//! [`NetworkWait`] — Phase 212.N.1 mixin.
2//!
3//! Gate `BoardEntry::run` on carrier / DHCP / link-up before it
4//! tries to open RMW sessions. Boards without an L3 stack (CAN-only,
5//! serial-only, IVC-only) leave it unimplemented.
6
7/// Carrier / DHCP / link-up gate for IP-aware transports.
8pub trait NetworkWait: super::Board {
9 /// Block until the board's IP stack is ready: carrier detected,
10 /// DHCP lease acquired (or static IP applied), default route
11 /// installed. Returns when the executor can open sockets.
12 ///
13 /// Returning `Err` ends boot via
14 /// [`super::BoardExit::exit_failure`]. `Ok` proceeds into the
15 /// `setup` callback.
16 fn wait_link_up() -> Result<(), NetworkError>;
17}
18
19/// Network bringup failure mode (matches the coarse shape of
20/// [`super::transport::TransportError`]).
21#[derive(Debug, Clone, Copy, PartialEq, Eq)]
22#[non_exhaustive]
23pub enum NetworkError {
24 /// PHY linked but no DHCP lease before the board's deadline.
25 DhcpTimeout,
26 /// Static-IP configuration referenced a non-existent interface
27 /// or duplicate address.
28 ConfigInvalid,
29 /// No default route or gateway unreachable.
30 NoRoute,
31 /// Board-specific failure not covered by the above.
32 Other,
33}