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 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
Get step-by-step solutions from verified subject matter experts
