## 4 System Design and Goals
### Modification to Message Intervals and New Message Variables
#### 4.4.3 DNRI Function  
This function iterates through the values that were stored in the three array variables (MTypeArray, AddressArray, and HoldTimeArray) by Algorithm 2. Each group of related records (comprising message type, hold time, and addresses) is saved or updated to Link and Neighbor Sets. The algorithm broadcasts the HI message at the end of the database update and sets EH to 1 if the node has not previously emitted a HELLO message. Setting EH to 1 allows the nodes to broadcast a HELLO message before the next LISTEN period (LI function). The process, as presented in Algorithm 3, is designed to optimize routing in our proposed protocol by effectively managing the network topology. This interval governs how frequently a node processes HELLO messages to update its Neighbor Set, ensuring that the node maintains accurate and timely information about its immediate network environment. Each node starts by entering the DB_NEIGHBORS_RCVD state upon receiving a HELLO message from a neighboring node. This state is critical for processing neighbor information and updating the node's Neighbor Set. The node examines the HELLO message to extract information about its neighbors, such as their identities, link status, and other relevant parameters. ```
1.\(\textit{UNRI\_Module}(\,)\)
2\(\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\



#### 4.4.4 DNBI Function

The major difference between the DNRI and DNBI function is that DNRI only processes HI messages and uses the information extracted from HI packets to determine one-hop and two-hop symmetric neighbors. MPR selection processes also take place during this period since each node has enough information to determine nodes with which they share a two-hop symmetric neighbor. Nodes are expected to spend some part of the DNBI period processing incoming HI messages and building links from such messages before committing them to tables. Technically, Algorithm Six is a combination of Algorithms Four and Five; however, Algorithm Six checks if there are changes in the Link and Neighbor Sets before broadcasting TC messages. The procedure is presented in Algorithm 4. The algorithm is designed to optimize the frequency at which a node updates both its Neighbor Set and Link Set in a wireless ad hoc network. This interval dictates how often the node processes incoming HELLO messages to maintain accurate and up-to-date information about its immediate network environment. The node uses the DB_NEIGHBORS INTERVAL to determine when to process HELLO messages. These messages provide critical information about neighboring nodes and the status of direct links between the node and its neighbors. During each interval, the node updates both its Neighbor Set (tracking all recognized neighbors) and its Link Set (monitoring the quality and status of connections). ```
1. Function DNBI_Module( )
2. AddressArray \(\leftarrow[\;]\), \(t\gets 0\), \(HelloHeard\gets 0\), \(StartTime\leftarrow Time.Now()\)
3. While Time.Now( ) - StartTime \(<\) 3 do:
4. Packets \(\leftarrow\) \"\", Address \(\leftarrow\)\"\"
5. Try:
6. Address\(\leftarrow\) getOLSRHost()
7. Socket\(\leftarrow\) (Address, 269)
8. Packets\(\leftarrow\) GetPacketStream(Socket)
9. Close Socket
10. For \(\forall\) CurrentPacket \(\in\) Packets, do
11. Address \(\leftarrow\) getOLSRHost()
12. Socket \(\leftarrow\) (Address, 269)
13. Packet \(\leftarrow\) getPacketStream(Socket)
14. Socket.Close()
15. Catch all exceptions and discard silently:
16. For \(\forall\) CurrentPacket \(\in\) Packets, do:
17. MType \(\leftarrow\) GetMessageType(CurrentPacket)
18. VTime \(\leftarrow\) GetVTime(CurrentPacket
19. Address\([]\leftarrow\) GetAddr(CurrentPacket)
20. IF MType \(\leftarrow\) \"Hi\"&VTime \(\leq\) HetHiHoldTime:
21. AddressArray[i][i] \(\leftarrow\) Addresses
22. MTypeArray[ArrayCounter] \(\leftarrow\) MType
23. HelloHeard \(\leftarrow\) 1
24. i \(\leftarrow\) i + 1
25. End While
26. \(i\gets 0,\)CEx \(\leftarrow\) 0#Change Exists
27. For \(\forall\) PacketType \(\in\) MTypeArray, do:
28. For \(\forall\) Addr \(\in\) AddressArray[i][], do:
29.