Close

Who needs sleep?

A project log for Wakan μDTN

Mesh networking over WiFi and LoRa radios to support a Disruption Tolerant Network

hsingai-tigris-altaicaHsingai Tigris Altaica 04/04/2022 at 14:390 Comments
func passthruKa(R, A, B){
    if (I know of a shorter route from A to B than the route that passes thru R){
        return(False)
    else {
        return(True)
    }
}

 The difference between passthruKa and RelayKa is that if you don't know of any routes from A to B RelayKa will return True while passthruKa will return False.

when tracing route the stations will broadcast the Trace messages if they  passthruKa them.

when (station_A hears a ChartRoute message from station_B) then {
    if (ChartRoute isn't in station_A["recent_message_list"]) then {
       if RelayKa(station_A, station_B, Chart_Route["GOAL"]) then {
            if (ChartRoute["PATH"] is empty) then {
                broadcast Trace(PATH : [station_B])
            } else {
                broadcast Trace(PATH: [...ChartRoute["PATH"], station_B])
            }
            append station_B to the end of ChartRoute["PATH"]
            broadcast the modified ChartRoute
        }
    }
}
when(station_A hears a Trace from station_B) then {
    if (Trace isn't in station_A["recent_message_list"]) then {
        if passthruKa(station_A, station_B, Trace["PATH"][]) then {
            rebroadcast Trace
        }
    }
}
when (station_A hears a PingRoute message from station_B) then {
    if (station_A == PingRoute["ROUTE"][0]) then {
        add Ack(ORIGIN: station_B, FOUNT: PingRoute["ROUTE"][0]) to station_A["recent_message_list"]
        pop PingRoute["ROUTE"][0]
        broadcast modified PingRoute 
    } else if (station_A != PingRoute["ROUTE"][0]) then {
        broadcast Ack(ORIGIN: station_B, FOUNT: PingRoute["ORIGIN"])
}
when(station_A hears a Ack from station_B) then {
    if (Ack isn't in station_A["recent_message_list"]) then {
        if passthruKa(station_A, station_B, Ack["FOUNT"]) then {
            rebroadcast Ack
        }
    }
}

Discussions