Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This needs to be in Java... Each router maintains a table of destination addresses that it knows about, and which port (direction) to travel to

This needs to be in Java...

  1. Each router maintains a table of destination addresses that it knows about, and which port (direction) to travel to get to that destination. So when a message or datat packetleaves its source address, it travels to the first router on its path. This router will look up the destination address in its routing table. If the destination address is found, then the packet is sent out the port entry for that destination in the table, which will result in the packet being sent and received at the next router. This process continues until the packet arrives at the destination. If at any point along the way, a router does not have a table entry for the destination address, then the packet is dropped immediately by the router.
  2. Special packets are sent from each router to all of its neighboring routers, telling the neighbors of destination address that it knows about. (In effect, these packets say,I know about such-and-such a destination, so add an entry to your table for that destination and send any packets for that destination to me). These are called protocol or routing packets.
  3. This description is simplified, and any of you with more detailed networking knowledge will recognize the simplicity. However, it is truly the basis for the processing on a router and we will be able to produce a version of this software.
  4. So, we want our program to read packets from a file each line on the file will be a packet. This will simulate a data stream arriving on a router port or interface. Each packet will consist of
  • The type of packet - p for protocol (this packet should be used to update the routing table) or d (this packet should be routed and contains only data)
  • A destination IP address
  • A source IP address
  • Data which consists of: the data associated with that type - string information about the port (ex e0) if packet is of type p OR a string of data which should be routed if packet is of type d
  1. IP Addresses consist of four integer values between 0 and 255 representing the four octets . I have written a class that handles this data type for you. You should not need to changes
  2. Our program should build a table of destination addresses/ port to travel to get there. The required size of this table is unknown but we will implement it as a dynamically allocated array of RoutingTableEntries of some arbitrary size and this is the important part of the assignment.

RoutingTableEntry Class:

  • This class models a single entry in the routing table. It will have the following data members:
  • An IPAddressobject to hold the destination address
  • String object to hold the portCode (for example e0, e1, s0/0/0 or s1/0) see router class next below

  • The actions that will be needed in this class include:
  • Default constructor
  • addEntry to update the information in the current object from the parameters passed into the method
  • toString to display this entry to a String
  • searchForPort to compare the destination IP Address in parameter to this entry to see if they match, and if they do, send back portCode; or send back "" (empty String) if they dont match. This will be used to process data packets in the input and determine which port they should continue out of.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions