Algorithm 2.
IRL - Routing at Intermediate Node.
1: | nexthop ← ∅; |
2: | Mtemp = ∅ |
3: | if Signature of new packet already exists in buffer then |
4: | Mtemp = {Mtemp} + LasttimePrevhop |
5: | Mtemp = {Mtemp} + LasttimeNexthop |
6: | Set counter = timesReceviedBefore + 1; |
7: | Remove signature from buffer; |
8: | ifcounter = 3 then |
9: | Drop packet and exit; |
10: | end if |
11: | end if |
12: | Mtemp = {Mtemp} + prevhop |
13: | if (M(tF) − {M(tF) ∩ Mtemp}) ≠ ∅ then |
14: | nexthop(k) = Rand(M(tF) − {M(tF) ∩ Mtemp}); |
15: | else |
16: | if packet came from Brthen |
17: | Mtemp1 = M(tBl) ∪ M(tBm) |
18: | ifMtemp1 ≠ ∅ then |
19: | nexthop(k) = Rand(Mtemp1); |
20: | else ifM(tBr) ≠ ∅ then |
21: | nexthop(k) = Rand(M(tBr) − {M(tBr) ∩ Mtemp}); |
22: | else |
23: | Drop packet and Exit; |
24: | end if |
25: | else if packet came from Blthen |
26: | Mtemp2 = M(tBr) ∪ M(tBm) |
27: | ifMtemp2 ≠ ∅ then |
28: | nexthop(k) = Rand(Mtemp2 − {Mtemp2 ∩ Mtemp}); |
29: | else ifM(tBl) ≠ ∅ then |
30: | nexthop(k) = Rand(M(tBl) − {M(tBl) ∩ Mtemp}); |
31: | else |
32: | Drop packet and Exit; |
33: | end if |
34: | else |
35: | Mtemp3 = M(tBr) ∪M(tBl) |
36: | ifMtemp3 ≠ ∅ then |
37: | nexthop(k) = Rand(Mtemp3 − {Mtemp3 ∩Mtemp}); |
38: | else ifM(tBm) ≠ ∅ then |
39: | nexthop(k) = Rand(M(tBm) − {M(tBm)∩Mtemp}); |
40: | else |
41: | Drop packet and Exit; |
42: | end if |
43: | end if |
44: | end if |
45: | Rest is same as Algorithm 1 from lines 13:21; |