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

Give example of the network layer, Most protocol suites have dissimilar OSI...

Most protocol suites have dissimilar OSI layer protocols within them. At layer 3, IP is for TCP/IP. TCP is layer 4. IPX is for IPX/SPX. SPX is layer 4. DDP is for Appletal

Fat tree, Fat tree It is a modified version of the tree network. In thi...

Fat tree It is a modified version of the tree network. In this group the bandwidth of edge (or the connecting wire among nodes) increases towards the root. It is a more practic

Application layer - computer network, Application Layer The  applicati...

Application Layer The  application layer is where  network  applications and their  application layer protocols  reside. The internet application layer includes many protocols

Fiber optic cable - computer network, Fiber Optic Cable A fiber  opt...

Fiber Optic Cable A fiber  optic  cable is made  of glass or plastic and transmits signals in the form of light pulses. An optical fiber  is a thin  flexible medium  conducts

What is meant by symmentric multiprocessing, What is meant by Symmentric Mu...

What is meant by Symmentric Multiprocessing (SMP)? It treats all processors as equal. Any processor can do the work of any other processor. Applications are divided into thread

What is an ethernet, What is an Ethernet? The Ethernet topology was dev...

What is an Ethernet? The Ethernet topology was developed at the University of Hawaii to connect computers on the many Islands. It was radio based design. Later, Robert Metacalf

Exam, i have an exam i need it to be solved

i have an exam i need it to be solved

Categories of networks, Distance covered, Based on size, ownership and phys...

Distance covered, Based on size, ownership and physical architecture - LAN (Local Area Network) - Suitable for smaller geographical area - MAN (Metropolitan Area Network) - S

Distributed Algorithms, can we solve the problem using bounded buffer space...

can we solve the problem using bounded buffer space if the propagation delay is arbitrarily large ?

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