#[unsafe(no_mangle)]pub unsafe extern "C" fn pamoja_router_observe(
router: *mut PamojaRouter,
origin: u32,
via: u32,
cost: u16,
) -> boolExpand description
Learns a route from a packet that arrived.
When a packet from a distant node comes in via a neighbour, that neighbour is the way back to it. The table keeps the cheapest way it knows to each node, and when full gives up the most expensive route to make room for a cheaper one.
§Arguments
router- the routing table.origin- the node the packet came from.via- the neighbour it arrived through.cost- what that path costs, usually a hop count.
§Returns
true if the table changed, or false if it already knew a route at least
this cheap, had no room for one this expensive, or router is null.
§Safety
router must be a live handle from pamoja_router_new, or null.