⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

OspfRouter

Struct OspfRouter 

Source
pub struct OspfRouter {
    pub router_id: u32,
    pub area_id: u32,
    /* private fields */
}
Expand description

OSPF Router

Fields§

§router_id: u32

This router’s ID

§area_id: u32

Area ID (0 for backbone)

Implementations§

Source§

impl OspfRouter

Source

pub fn new( router_id: u32, area_id: u32, priority: u8, network_mask: u32, ) -> Self

Create a new OSPF router

Source

pub fn tick(&mut self, ticks: u64)

Advance the tick counter

Source

pub fn lsdb(&self) -> &LsDatabase

Get the link-state database

Source

pub fn lsdb_mut(&mut self) -> &mut LsDatabase

Get the link-state database mutably

Source

pub fn neighbor_count(&self) -> usize

Get number of neighbors

Source

pub fn get_neighbor(&self, router_id: u32) -> Option<&OspfNeighbor>

Get a neighbor by router ID

Source

pub fn neighbors(&self) -> Vec<&OspfNeighbor>

Get all neighbors

Source

pub fn process_hello( &mut self, header: &OspfHeader, hello: &HelloPacket, source: Ipv4Address, )

Process an incoming Hello packet from a neighbor

Source

pub fn process_dbd(&mut self, header: &OspfHeader, _lsa_headers: &[LsaHeader])

Process a Database Description packet (simplified: just advance state)

Source

pub fn install_lsa(&mut self, lsa: Lsa) -> bool

Install an LSA into the database and return whether SPF recalculation is needed

Source

pub fn check_dead_neighbors(&mut self)

Check for dead neighbors and remove them

Source

pub fn generate_hello(&self) -> HelloPacket

Generate a Hello packet for this interface

Source

pub fn run_spf(&self) -> Vec<SpfEntry>

Run SPF (Dijkstra) algorithm on the LSDB and return routing table entries

Auto Trait Implementations§

§

impl Freeze for OspfRouter

§

impl RefUnwindSafe for OspfRouter

§

impl Send for OspfRouter

§

impl Sync for OspfRouter

§

impl Unpin for OspfRouter

§

impl UnwindSafe for OspfRouter

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.