Distance Vector Routing for a Self-Organizing Peer-to-Peer Network
This assignment builds on assignment 2. In assignment 2, neighborhoods were found and maintained. In this assignment, routing for the topology is be computed.
We will assume that each link has an administrative cost of one. Thus, the routing will compute the shortest path in terms of hops. The objective is to determine the routing table. For each destination, the routing table has six entries: the destination IP, the destination port, the next hop IP, the next hop port, and the cost. See datatypes.h for details.
To find the routing table there are 3 steps.
For point of discussion, we will refer to the node where the program is running as ThisHost. The routing table must satisfy the following properties:
Hint: The first step to making a new routing table is to put ThisHost's IP and port in the table with a cost of zero. Then loop through the destinations from each ActiveNeighbor's routing tables. Add to the routing table only those destinations that are not already in the routing table. If a destination appears in two or more neighbor's routing table, then only put the one with the least cost into the routing table.
Function ideas:
void PutRoutingTableInPacket(struct PktStruct &pkt, struct HostID &ThisHost) ; // this puts the routing table of ThisHost into the pkt
struct HostID GetSendersID(struct PktStruct *pkt) ; // this function must be changed so that the routing table from pkt into the struct HostID
void MakeRoutingTable(struct HostID &ThisHost, std::list
Some of the functions provided for the second project have changed. Specifically, void PrintStatus(...) is slightly different and a new function void ShowRoutingTable(struct HostID &ThisHost); has been provided. Also PrintPacketTransmitted and PrintPacketRecieved have slight changed.
Ideally, a new routing table should be made only when needed. However, for simplicity, you can make a new routing table every time a new hello packet arrives.
Also, there have been some slight modification to these files
What to turn in:
For these last two parts, make sure to include a diagram of the topology and verify that the routing is correct. Furthermore, make sure to include enough neighbors and a small enough DesiredNumberOfNeighbors so that the behavior of the routing is interesting.