Ip checksum, Computer Networking

Assignment Help:

This code properly implements the IP checksum function on a 32-bit machine: unsigned short cksum(unsigned short *buf, int count)
{
unsigned long sum = 0;
while (count--) {
sum += *buf++;
if (sum & 0xFFFF0000) {
sum &= 0xFFFF;
sum++;
}
}
return ~(sum & 0xFFFF);
}
The if statement performs "wraparound" if the sum over?ows 16 bits. That is, it takes the 1 that over?owed into the 17th bit and adds it to the lower 16 bits of the sum.

Here's how to compute and check the checksum. The sender should perform these actions:

1. Completely ?ll in the IP header, with zero in the checksum ?eld.

2. Compute the checksum and store it in the checksum ?eld.

The receiver should perform these actions:

1. Copy the checksum ?eld's value into a variable.

2. Zero the IP header's checksum ?eld.

3. Compute the checksum over the IP header.

4. Compare the computed checksum value with the value in the variable.


Related Discussions:- Ip checksum

What is data link of osi model, Q. What is data link of osi model? - Th...

Q. What is data link of osi model? - The data link layer offers access to the networking media and physical transmission across the media and this enables the data to locate it

Determine about the tree topology, Determine about the Tree Topology A ...

Determine about the Tree Topology A generalization of the bus topology. The transmission medium is a branching cable with no closed loops. The tree layout begins at a point kno

What is the role of ieee in computer networking, What is the role of IEEE i...

What is the role of IEEE in computer networking? IEEE, or the Institute of Electrical and Electronics Engineers, is an organization composed of engineers that issues and manage

Explain about domain name system, Q. Explain about Domain Name System? ...

Q. Explain about Domain Name System? -In the past, mapping of IP addresses was static using a host file -Impossible in today's dynamic environment -Domain Name System (DN

Network performance & characteristics, There are two kinds of characteristi...

There are two kinds of characteristics in case of network performance. Delay Throughput

Show the distribution of name space, Q. Show the Distribution of Name Space...

Q. Show the Distribution of Name Space? Distribution of Name Space --Information for domain name space must be stored on multiple servers (DNS servers) to be efficient

How do you disable advanced editing, We can deactivate advanced editing us ...

We can deactivate advanced editing us using  terminal no editing

What is the routing algorithm used by rip and igrp, Distance vector-based r...

Distance vector-based routing algorithms (also called as Bellman-Ford algorithms) pass periodic copies of a routing table from router to router. Regular updates among routers commu

Write Your Message!

Captcha
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