Home | History | Annotate | Download | only in android-clat

Lines Matching defs:checksum

16  * checksum.c - ipv4/ipv6 checksum calculation
26 #include "checksum.h"
29 * adds data to a checksum
30 * current - the current checksum (or 0 to start a new checksum)
31 * data - the data to add to the checksum
35 uint32_t checksum = current;
40 checksum += *data_16;
45 checksum += *(uint8_t *)data_16;
48 return checksum;
52 * folds a 32-bit partial checksum into 16 bits
54 * returns: the folded checksum in network byte order
64 * folds and closes the checksum
66 * returns: a header checksum value in network byte order
74 * data - data to checksum
85 * calculate the pseudo header checksum for use in tcp/udp/icmp headers
105 * calculate the pseudo header checksum for use in tcp/udp headers
125 * calculates a new checksum given a previous checksum and the old and new pseudo-header checksums
126 * checksum - the header checksum in the original packet in network byte order
127 * old_hdr_sum - the pseudo-header checksum of the original packet
128 * new_hdr_sum - the pseudo-header checksum of the translated packet
129 * returns: the new header checksum in network byte order
131 uint16_t ip_checksum_adjust(uint16_t checksum, uint32_t old_hdr_sum, uint32_t new_hdr_sum) {
134 checksum = ~checksum;
135 uint16_t folded_sum = ip_checksum_fold(checksum + new_hdr_sum);