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.

  1. Whenever a hello packet is sent, the node that is sending the packet must include its current routing table.
  2. When a packet arrives from a neighbor, the routing table form the neighbor is saved.
  3. The routing tables from the nodes in the ActiveNeighborList are used to determine the routing table.

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:

  1. Each destination reported in one or more neighbor's routing table must be included in the routing table.
  2. The cost to reach ThisHost is zero.
  3. The next hop to reach ThisHost is recorded as ThisHost (i.e., the next hop IP and port are the same as ThisHost's)
  4. The costs to reach other destinations besides ThisHost is the minimum of the costs advertised in the received routing tables plus 1.
  5. The node that advertises the lowest cost to a destination is the next hop in the routing table.

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 &ActiveNeighbors);

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

helpers.cpp

helpers.h

MaintainNeighbors.cpp

datatypes.h

What to turn in:

  1. Turn in your code.
  2. A discussion of your code and the project.
  3. Turn in output (time and node stamped routing table and neighborhood advertisements) that shows the routing table as it takes SEVERAL steps to converge after it starts.
  4. Turn in output that shows the count to infinity problem.

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.