Skip to main content

pamoja_router_forward

Function pamoja_router_forward 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn pamoja_router_forward( router: *const PamojaRouter, dst: u32, out_next_hop: *mut u32, ) -> PamojaForward
Expand description

Decides what to do with a packet bound for a node.

§Arguments

  • router - the routing table.
  • dst - the node the packet is addressed to.
  • out_next_hop - receives the neighbour to unicast to, written only when the answer is PamojaForward::Relay.

§Returns

PamojaForward::Deliver when the packet is for this node, PamojaForward::Relay when a route is known, or PamojaForward::Flood when none is, which hands the packet back to the flooding layer. A null router answers PamojaForward::Flood, the choice that always works.

§Safety

router must be a live handle from pamoja_router_new, or null, and out_next_hop must point to a writable uint32_t or be null.