You guys may find this handy to recalculate TCP checksums.

Thanks to Nnikhil Rao/Saurabh Dadu for finding this gem :)


--
Francis
francis@{cse.ogi.edu, francischang.com}
OGI School of Science & Engineering at OHSU, SySL Labs
(503) 332-4850          FAX:(503) 748-1553

-----Original Message-----
From: Saurabh Dadu [mailto:saurabh_dadu@yahoo.com]
Sent: Tuesday, May 13, 2003 21:15
To: francis@francischang.com
Subject: Checksum functions


The following functions are very useful in computing
the IP header & TCP header checksums:

/** Calculate 1's compliment checksum for the basic
20-octet ip4 header
   
    @param      ptr      pointer to to the ip4 header
    @param      chksum       where to return the 16-bit 1's
complement checksum
    @param      replace whether to replace the old
checksum with the newly
                        calulated checksum.
                        1:  replace old chacksum
                        0:  old chacksum unchange

    @returns an error token, zero for success.
*/
ix_error ix_checksum_ip4hsum( ix_ip4hdr *ptr, ix_16bit
*chksum, int replace);


/** Calculate the 1's compliment checksum of a TCP or
UDP header

    Note: this procedure is 'expensive' since it has
to access fields
    to make up the psuedo header.

    @param      hptr    pointer to the beginning of
the IP datagram
                        that contains the UDP/TCP
segment of interest
    @param      sptr    pointer to the beginning of
the TCP/UDP
                        segment of interest
    @param      chksum  where to return calculated
checksum
    @param      replace if the checksum field in
segment to be overwritten by
                        the newly calculated checksum
                        1: replace
                        0: no replace

    @returns an error token, zero for success.
*/
ix_error ix_checksum_calc_segment_checksum(ix_ip4hdr
*hptr, ix_16bit *sptr,
                                ix_16bit *chksum, int
replace);

They are defined in:
/opt/ixasdk.workingl3forwarder/include/ix/asl/tcpip/checksum.h



__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com


Yahoo! Groups Sponsor
ADVERTISEMENT

To unsubscribe from this group, send an email to:
ogi-cse58x-unsubscribe@yahoogroups.com



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.