Distance Vector Routing for a Self-Organizing Peer-to-Peer Network
This assignment builds on Project 2. In Project 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 three entries: the destination HostId, the next hop HostId, and the cost.
To find the routing table there are 3 steps.
We will refer to the node where the program is running as thisHost. The forwarding table must satisfy the following properties:
Hint 1: The first step to making a new forwarding table is to put thisHost in the table with a cost of zero. Then loop through the destinations from each bidirectionalNeighbor's routing tables. Add to the forwarding 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 forwarding table.
Hint 2: From Project 2, add a function to compute the forwarding table every time a hello message arrives. Then make a few changes in how hello messages are made (i.e., include forwarding table information) and how a HostID is sotred and copied.
Function ideas:
Change sendHelloToAllNeighbors to include the routing table as argument, i.e.,
void sendHelloToAllNeighbors(bool searchingForNeighborFlag,
list<NeighborInfo> &bidirectionalNeighbors,
list<NeighborInfo> &unidirectionalNeighbors,
NeighborInfo &tempNeighbor,
HostId &thisHost,
UdpSocket &udpSocket,
RoutingTable &routingTable);
in addition to the functions used in project 2
void makeRoutingTable(RoutingTable &routingTable, list<NeighborInfo> &bidirectionalNeighbors, HostId &thisHost);
Also, there have been some slight modification to these files
helperClasses.cpp (this one has changed)
someFunctions.cpp (the same as in project 2)
someFunctions.h (the same as in project 2)
neighbors.cpp (this file has changed)
target.h (the same as in project 2)
What to turn in: