CalcIPChecksum Function

Microchip TCP/IP Stack

Microchip TCP/IP Stack Help
CalcIPChecksum Function
C
WORD CalcIPChecksum(
    BYTE* buffer, 
    WORD len
);
Description

This function calculates an IP checksum over an array of input data. The checksum is the 16-bit one's complement of one's complement sum of all words in the data (with zero-padding if an odd number of bytes are summed). This checksum is defined in RFC 793.

Preconditions

buffer is WORD aligned (even memory address) on 16- and 32-bit PICs.

Parameters
Parameters 
Description 
buffer 
pointer to the data to be checksummed 
count 
number of bytes to be checksummed 
Returns

The calculated checksum.

Microchip TCP/IP Stack 5.42.08 - June 15, 2013
Copyright © 2012 Microchip Technology, Inc.  All rights reserved.