In this assignment you will write a program that does

Assignment Help Python Programming
Reference no: EM13379913

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

<port number to listen at> <routing table file path> <statistics file path>

Then your program will:

• read its routing table from the specified file

? The file will consist of multiple lines with the format:
<subnet> <netmask> <nexthop>

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:
<packet ID>,<source IP>,<destination IP>,<TTL>,<payload>

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=<packet ID>, dest=<dest. IP address>

? 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

Reference no: EM13379913

Questions Cloud

Security in bluetooth and other mobile devicesbefore : security in bluetooth and other mobile devicesbefore supporting mobile and wireless devices organizations need to
Suppose that a vector processor has a memory system in : suppose that a vector processor has a memory system in which it takes 10 cycles to load a single 64-bit word from
Consider any of the supercomputing examples we discussed in : consider any of the supercomputing examples we discussed in class and find a scientific paper describing it. you must
In this assignment you are to write a program that analyzes : in this assignment you are to write a program that analyzes a selection of text counting the number of times each word
In this assignment you will write a program that does : in this assignment you will write a program that does simple packet routing. your program will take three command-line
1 write an algorithm that converts a linear measurement in : 1. write an algorithm that converts a linear measurement in feet and inches into meters. one inch is equivalent to 2.54
1 give an example to show that the group of permutations s5 : 1. give an example to show that the group of permutations s5 is not commutative.2. use ecb mode with block length 3 and
1 write a c program to display the following sum4 812162024 : 1. write a c program to display the following sum4 812162024 ...4042. write a program that will convert us dollar
Perform the tasks below by using the correct sql statements : perform the tasks below by using the correct sql statements. you must create the statements in oracle by using the

Reviews

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd