Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Network & Security Expert

If you are referencing any outside sources you must cite them clearly.

In this assignment you will write a program that does simple packet routing. Your program will take three command-line arguments:

Then your program will:

  • read its routing table from the specified file

? The file will consist of multiple lines with the format:

The subnet and netmask will be in IPv4 dotted decimal. The nexthop value will be a port number, not an address. The three values will be separated by spaces. For example:

112.23.56.0 255.255.255.0 45334

  • listen on the specified UDP port
  • accept simplified IP packets in the format:

,,,,

Example:

23921,192.168.0.1,192.168.45.102,64,testing

For each received packet, your program will:

  • decrement the TTL field of the packet

? if it reaches zero, the packet will be dropped and the "expired packets" counter will be updated

  • figure out which of the entries in the routing table (if any) match the packet

? it will do this by checking whether the destination address in the packet matches the subnet entry for a particular route, after being ANDed with the netmask of that entry in the routing table.

? it will scan the routing table sequentially and will use the first route that matches (you can assume the table is sorted longest-prefix first)

? if there is no matching entry, the packet will be dropped and the "unroutable packets" counter will be updated

  • if the value of the nexthop field for the entry is 0:

? print the following:

Delivering direct: packet ID=, dest=

? update the "delivered direct" counter

? not process the packet any further

  • if the value of the nexthop field for the entry is a valid port number

? forward the IP packet, as a UDP packet to address 127.0.0.1 and UDP port equal to the nexthop value

? update the counter corresponding to the packets forwarded to that router

Note: whenever a packet is dropped, it should not be processed any further. Statistics file:

After every 100 processed packets you will update the statistics file (the path to which was given as a

command-line argument). The format of the file will be:
expired packets:
unroutable packets:
delivered direct:
router :
router :
...

And so on, for each router. is the port number corresponding to this router.

You will also update the statistics file before the program exits, when the user interrupts with Ctrl+C.

To do this you will need to handle the KeyboardInterrupt exception.

Error handling:

In addition to the above-mentioned  KeyboardInterrupt (used to terminate the program), you will need to handle any I/O-related exceptions.

If the routing table file does not exist or cannot be read, your program should print an error message and exit. If the statistics file does not exist and it is unable to create it, it should print an error message and exit. If, later, an error occurs while trying to update the statistics file, it should print an error message and it should continue running (i.e. it should not exit in this case).

If your program is unable to listen on the specified UDP port it should print an error message and exit.

If an error occurs while receiving an incoming packet, or while trying to forward the packet, it should print an error message and it should continue running (i.e. it should not exit in this case).

Computer Network & Security, Computer Science

  • Category:- Computer Network & Security
  • Reference No.:- M9894505
  • Price:- $70

Priced at Now at $70, Verified Solution

Have any Question?


Related Questions in Computer Network & Security

Two countries australia and france have their interest

Two Countries Australia and France have their interest rates to be 8% and 2 %, respectively. If their currencies trade according to 2 Australian $s buy one euro in the spot market, what will their future spot rate be in ...

Question calculate the total time required to transfer a

Question: Calculate the total time required to transfer a 1.5-MB file in the following cases, assuming an RTT of 80 ms, a packet size of 1 KB data, and an initial 2 × RTT of "handshaking" before data is sent: (a) The ban ...

You just signed a 30-year lease agreement for a business

You just signed a 30-year lease agreement for a business property. The monthly rent for the first year is $1,000/month, with the ?rst month's rent due today. Starting from the second year onward, the monthly rent will be ...

Advanced network design assessment - human factors in

Advanced Network Design Assessment - Human factors in network analysis and design Purpose of the assessment - This assignment is designed to assess students' knowledge and skills related to the following learning outcome ...

Shadow register setsa describe the use of shadow register

Shadow Register Sets a. Describe the use of shadow register sets. b. How many shadow register sets are supported? c. What instructions are used to move data between them? Floating Point Numbers. We have heretofore focuse ...

Question 12326 packet tracer - configuring pap and chap

Question 1 2.3.2.6 Packet Tracer - Configuring PAP and CHAP Authentication Submit your answer as Q1.pka Question 2 2.5.1.2 Packet Tracer - Skills Integration Challenge Submit your answer as Q2.pka Question 3 3.4.2.4 Pack ...

Assignment -need project made by packet truce follow the

Assignment - Need project made by packet Truce. Follow the given report and please don't make the project big and video will describe full project in details and with configuration. Project - Design and Implementation of ...

How would you explain the concept of a quality adjusted

How would you explain the concept of a quality adjusted life year? When is it appropriate to use "QALYs" instead of simply improved life expectancy as the outcome measure in an economic evaluation?

Task1 in each of the following scenarios there is a

Task 1. In each of the following scenarios there is a relationship to work life in the IT industry. With each of the following question, ensure that your answer includes the explanation of how it would be applied to work ...

Assignment -global finance inc gfi - global finance inc gfi

Assignment - GLOBAL FINANCE, INC. (GFI) - Global Finance, Inc. (GFI) is a financial company that manages thousands of accounts across Canada, the United States, and Mexico. A public company traded on the NYSE, GFI specia ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As