Preliminary Design of MDSDV (MDSDV0)
4.4 Algorithms with an Example
4.4.2 Routing Updating
Tables 4.7 and 4.8 show that there are three new link ids(i.e., 80001, 80002, 80005).
Therefore, node 8 uses Initiating an Update Packet algorithm (Figure 4.7) to initiate 3 Update Packets, and broadcasts them as shown in Figure 4.8. Table 4.9 shows the format of the three Update Packets that are generated by the new node (node 8).
When the neighbour receives the Update Packets, it uses the Receiving an Update Packet algorithm shown in Figure 4.9 to update its RT. Next, it updates the Update
Packets according to the Updating the Update Packet algorithm (Figure 4.10), and broadcasts them to its neighbours as well. Table 4.10 shows the Update Packets that node 5 updated and broadcast.
01 The new node initiates an Update Packet by setting the fields of the packet as follows:
02 Sender ← Address of the new node that initiates the update packet 03 First hop ← Null
04 Second hop ← Null 05 Number of hops ← 0 06 Destination ← Null
07 Link_id ← The link id between the new node and its neighbour node 08 Neighbour ← address of the neighbour
09 Sequence Number ← Sequence number generated by the neighbour
Figure 4.7: Initiating an Update Packet Algorithm
Figure 4.8: Node 8 Initiates and broadcasts 3 Update Packets
Sender First Second Number Destination Link Neighbour Sequence
Hop Hop Of hops Id Number
8 Null Null 0 Null 80001 1 56
8 Null Null 0 Null 80002 2 24
8 Null Null 0 Null 80005 5 42
Table 4.9: The Update Packets generated by Node 8
01 Whenever a node receives an Update Packet, it checks..
02 If my address is equal to destination or first hop fields in the Update Packet 03 {
04 the Update Packet is discarded because the packet is generated by me.
05 } 06 else 07 {
08 Number of hops in the received Update Packet is checked....
09 If (number of hops = 0)
10 {
11 This means that the packet is received from a new node.
12 Invoke algorithm shown in Figure 4.11
13 }
14 else
15 {
16 This means that the packet is received from a known node 17 Invoke algorithm shown in Figure 4.13
18 }
19 }
Figure 4.9: Receiving an Update Packet Algorithm
01 When a node receives an Update Packet, it modifies the packet’s fields as follows:
02 Sender ← my address
03 Copy Link id, Neighbour, and Sequence Number fields
04 If (number_of_ hops = 0 and node address 6= neighbour field) 05 {
06 First hop ← sender field in the Update Packet 07 Second hop ← Neighbour field in the Update Packet 08 Number_of_hops ← 2
09 Destination ← Address in the neighbour field 10 else
11 {
12 First hop ← sender field in the Update Packet 13 Second hop ← First hop in the Update Packet
14 Number_of_hops ← Number of hops in the Update Packet + 1 15 Destination ← Destination in the Update Packet
16 }
Figure 4.10: Updating the Update Packet Algorithm
Sender First Second Number Destination Link Neighbour Sequence
Hop Hop Of hops Id Number
5 8 1 2 1 80001 1 56
5 8 2 2 2 80002 2 24
5 8 Null 1 8 80005 5 42
Table 4.10: Node 5 updates and broadcasts the Update Packets
By updating its routing table according to the received Update Packets, each node in the entire network gets multiple paths to the new node and other paths to the neigh-bours of the new node. Tables 4.11a - 4.11g show the new routes that are obtained by each node in the network after receiving the Update Packets.
Ds Fs Sh Nh Ln Sn
Table 4.11: Routing Tables of the nodes after receiving the Update Packets
01 When a node receives an Update Packet from a new node, it checks...
02 If my address = neighbour field in the Update Packet 03 {
04 My RT is updated by setting the link id field of the corresponding entry 05 to the link id field in the Update Packet. Then, the algorithm shown in 06 Figure 4.10 is used to update the Update Packet. Finally, I broadcast 07 the Update Packet to my neighbours.
08 } 09 Else 10 {
11 Invoking the algorithm shown in Figure 4.12 to add an entry as a path 12 to the node in the neighbour field through the new node. Then, the 13 algorithm shown in Figure 4.10 is used to update the Update Packet.
14 Finally, I broadcast the Update Packet to my neighbours.
15 }
Figure 4.11: Receiving an Update Packet from a new neighbour Algorithm
01 If number_of_ hops = 0 AND node number <> neighbour field 02 {
03 The node adds an entry as a path to the neighbour of the new node by setting the fields as follows...
04 First hop field ← Sender field in the Update Packet 05 Second hop field ← neighbour field in the Update Packet 06 Number of hops field ← 2
07 Destination field ← neighbour field in the Update Packet 08 Copy Link_id, Sequence Number fields
09 }
Figure 4.12: Getting a route to the neighbour of the new node Algorithm
01 If the destination and first hop in any entry are equal to the destination and first hop in the Update Packet. Also, the first hop and the destination in the Update Packet are not the same. Finally, if the received Sn is smaller {
02 the Update Packet is discarded 03 }
04 Else{
05 If the destination and link_id in any entry are equal to the destination and link id in the received Update Packet {
06 If number of hops in the Update Packet ≥ number of hops in the entry{
07 the Update Packet is discarded
08 }
09 Else{
10 If sender field in the Update Packet 6= first hop field in the entry
11 the Update Packet is discarded
12 Else
13 the entry is updated according to Update Packet
14 }
15 }
16 Else{
17 If the destination in the Update Packet is equals to destination in any entry{
18 If the sender is equal to the first hop{
19 If number of hops in the Update Packet ≥ number of hops in the entry
20 the Update Packet is discarded
21 Else
22 the entry is updated according to the Update Packet
23 }
24 }
25 Else{
26 If any entry has the same destination and the same link-id{
27 If number of hops in the Update Packet ≥ number of hops in the entry
28 the Update Packet is discarded
29 Else
30 the entry is updated according to the Update Packet
31 }
32 Else
33 My RT is updated according to the algorithm in figure 4.14 by adding an entry as a route to the destination. Then, the algorithm in figure 4.10 is used to update the Update Packet. Finally, the packet is broadcast to neighbours.
34 }
35 }
36 }
Figure 4.13: Receiving an Update Packet from a known neighbour Algorithm
01 The node updates an entry in its RT by setting the fields as follows...
02 First hop field ← Sender in the Update Packet 03 Second hop field ← First hop in the Update Packet
04 Number of hops field ← Number of hops in the Update Packet + 1 05 Destination field ← Destination in the Update Packet
06 Link_id field ← Link_id in the Update Packet
07 Sequence No. field ← Sequence No. in the Update Packet
Figure 4.14: Updating an existing entry Algorithm