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

  The program should allow the student

The program should allow the student to enter the answer. If the answer is correct, a message of congratulations should be displayed. If the answer is incorrect, a message showing the correct answer should be displayed.

  Reinforce topic material on simple functions

Select 3 sets of test data that will demonstrate the correct 'normal' operation of your program. Select another 2 sets of test data that will demonstrate the "abnormal" operation of your program.

  Display the percent-ages of the overall grade

Write a program that uses a bar chart to display the percent-ages of the overall grade represented by the project, quizzes the midterm exam and the final exam

  Arithmetic progression is a sequence of numbers

An arithmetic progression is a sequence of numbers in which the distance (or difference) between any two successive numbers if the same.

  Design a function that accepts an integer

Design a function that accepts an integer argument and returns the sum of all the integers from 1 up to the number passed as an argument. For example, if 50 is passed as an argument, the function will return the sum of 1, 2, 3, 4, . . . 50. Use recur..

  Interaction between the customer and the machine

In Python:Simulate a cash register or ATM including the interaction between the customer and the machine (i.e. assume that you are automating the responses)

  We would like to implement the lexical order

We would like to implement the lexical order for lists. For simplicity, we only consider lists of numbers, where , >= have their usual meaning.

  Write a python program that computes the mean, median, mode

How to write a python program that computes the mean, median, and mode?

  Code for the haunted house game

Improve the game by adding more features, for example you can examine more items, more props etc. You may implement this using more lists regarding items and props, remember, you should check if the object is being carried or in the location of th..

  You will define an operation on positive integers called

you will define an operation on positive integers called twiddle which consists of summing the squares of the digits of

  Two-dimensional word puzzle

Write a python function called find_words that finds and prints the list of valid words in a two-dimensional word puzzle

  The function should return the day name (''su'',''mo''..etc)

Write the function day(d,m) where m is an integer from 1 through 12 expressing a month, and d is an integer from 1 through 31 expressing the day part of a date in 2014.

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