Question: Question: The following code can be used to compute the checksum of a set of 16-bit binary numbers u_short_cksum(u_short buf, int count) f register w.ong.sum=0;

 Question: The following code can be used to compute the checksum

Question: The following code can be used to compute the checksum of a set of 16-bit binary numbers u_short_cksum(u_short "buf, int count) f register w.ong.sum=0; while (count- sumt-"buftt if (sum & 0xFFFF0000) { sum&=0xFFFF; sum+t; return (sum&0xFFFF); (i) Provide comments for each line in the above code explaining what the line does. Why should the variables be unsigned? Why is the buf short and the sum long? Implement the code on a platform of your choice. Make necessary changes in the code to make it compatible with the compiler you would be using. Run the code to calculate both UDP checksum (from Credit Hw #2) and TCP checksum by inputting all the data needed and verify your hand calculations. Question: The following code can be used to compute the checksum of a set of 16-bit binary numbers u_short_cksum(u_short "buf, int count) f register w.ong.sum=0; while (count- sumt-"buftt if (sum & 0xFFFF0000) { sum&=0xFFFF; sum+t; return (sum&0xFFFF); (i) Provide comments for each line in the above code explaining what the line does. Why should the variables be unsigned? Why is the buf short and the sum long? Implement the code on a platform of your choice. Make necessary changes in the code to make it compatible with the compiler you would be using. Run the code to calculate both UDP checksum (from Credit Hw #2) and TCP checksum by inputting all the data needed and verify your hand calculations

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!