Cps 470570- show the histogram of lookup delays for all


Assignment: Computer Networks

1. Purpose

Understand how to design non-ASCII application-layer protocols and learn how to provide reliable transfer over UDP.

2. Description

Overview

Your goal is to implement a DNS resolver that runs over UDP. The user inputs strings that can be either host names or IP addresses, which need to be resolved through DNS. Your program must directly use UDP and parse DNS responses without using any shortcuts from Platform SDK. The answers returned by the local DNS server must be displayed to the user including any additional records and multiple answers. A complete specification of packet headers and the various fields is contained in RFCs 1034-1035.

The program can be run in two modes - interactive (i.e., using command-line input) and batch (i.e., using input file dns-in.txt). In the former case, the code will return a detailed answer to the query provided by the user (see examples below). In the latter case, the code will read the input file (one question per line) and perform lookups using N threads, where N is specified in the command line. To distinguish between the modes, check if the first argument to the program is an integer. If so, assume this integer is the number of threads for batch lookups. Otherwise, assume the interactive mode.

Requirements for interactive lookups:

1. Your code must be able to decide whether input is an IP or a hostname based on the syntax of the string. Invalid IPs should be rejected immediately without contacting DNS (see below for more).

2. You must be able to send A and PTR requests based on user input and parse CNAME, A, and PTR responses. You must parse responses in both the answer section and the additional-records section; however, you may skip the authoritative section even if the number of answers there is non-zero.

3. You must be able to handle compressed resource records (RRs) as most DNS servers will return compressed data. The compression scheme in DNS is very simple and is documented fully in RFC 1035.

4. You must differentiate between successful lookups and failures, as well as detect errors and interpret them for the user. For example, return code 3 signifies a non-existent DNS name (print "No DNS entry") and code 2 means that the authoritative server cannot be found/contacted by your local DNS server (print "Authoritative DNS server not found").

If your program times out waiting for the local DNS server, display "Local DNS server timeout." For all other errors, print the numerical error and exit.

5. The code must be able to dynamically find the local DNS server for your computer (no hardcoding of its IP).

6. The program must not crash or exceed array boundaries under any circumstances (sanity checks for all pointers and fixed headers).

Requirements for batch lookups (either single-threading or multi-threading):

1. The main thread must read all strings from dns-in.txt (a list of IP addresses) into a shared queue inputQ, then start N threads, which will draw items from the queue, perform DNS lookups, write all answers into another shared queue outputQ, and continue looping until inputQ becomes empty. When all done, the main thread will write the items from outputQ into file dns-out.txt. The order of answers on output does not have to match that on input. Note that errors must be recorded as well. Note: attaching timestamps (request/response time) to each answer will allow you to reconstruct how long each query took. This info can also be used to compute the number of queries per second completed by the program.

Requirements for the report:

1. Document your code.

2. Show sample output from your program and its handling of all types of cases outlined above (you do not need to use the same exact input, but rather examples that are similar in spirit). To find an example for each case, perform reverse DNS lookups on the entire list of IP addresses in the input file. Show several examples of hosts that produce "authoritative DNS not found" and "local DNS timeout." Find examples of IPs that are aliased to other IPs.

3. Examine the issue of packet loss by analyzing the number of times you had to transmit requests to the local DNS server before the attempt was successful (i.e., you received some response). Note that this value is the attempt number to which the server has responded, not the total number of attempts made. Plot a distribution similar to the one shown in Figure 1(a), except your maximum number of attempts will be 3 instead of 6. The numbers in the figure will add up to 100%.

4. Show the histogram of lookup delays for all successfully resolved IPs. Histograms are plotted by partitioning a dataset into fixed bins and counting the fraction of data in each bin. See Figure 1(b) for an example that uses 200-ms bins. The numbers in the figure will also add up to 100%.

5. Document the percentage of successful lookups for IP addresses in dns-in.txt and compare this number to that obtained using gethostbyaddr() in homework #1.

6. Using multiple threads starting from 2 and going up to 100 in some increments, document the performance of your resolver (i.e., loopups per sec = 1 / average-lookup- delay) in comparison to gethostbyaddr(). Specify the average CPU utilization for each case. Draw conclusions on the efficiency of your implementation. See Table 1 for an idea (numbers in the table do not necessarily have to correspond to yours).

Attachment:- Assignment.pdf

Solution Preview :

Prepared by a verified Expert
Computer Network Security: Cps 470570- show the histogram of lookup delays for all
Reference No:- TGS02240693

Now Priced at $75 (50% Discount)

Recommended (91%)

Rated (4.3/5)