Class CSpoofSocket::
CalculateChecksum()
Base ClassesData ItemsConstructorsDestructorsFunctionsCustom CodeGo to hierarchy chart    Prev page: BindNext page: CalculatePseudoChecksum    Show member index
Public Function Declared in:
SpoofSocket.h

'Declaration' icon -- Shortcut to top of page. Declaration

static unsigned short CalculateChecksum(
    const unsigned short* pBuffer,
    int iSize);

'Description' icon -- Shortcut to top of page. Description

Calculate the data checksum

'Function Body' icon -- Shortcut to top of page. Function Body

try
{
    unsigned long usChksum=0;

    //Calculate the checksum
    while (iSize>1)
    {
        usChksum+=*pBuffer++;
        iSize-=sizeof(unsigned short);
    }

    //If we have one char left
    if (iSize)
        usChksum+=*(unsigned char*)pBuffer;

    //Complete the calculations
    usChksum=(usChksum >> 16) + (usChksum & 0xffff);
    usChksum+=(usChksum >> 16);

    //Return the value (inversed)
    return (unsigned short)(~usChksum);
}
ERROR_HANDLER_STATIC_RETURN(CSpoofSocket_LOGNAME,"CalculateChecksum",0)

'See Also' icon -- Shortcut to top of page. See Also

Class Overview Class Overview  |  Public base class CSpoofBase  |  Hierarchy Chart Hierarchy Chart


Get Surveyor!This web site was generated using Surveyor V4.50.811.1.  Click here for more information. Site content copyright © 2003 Komodia LTD.. See the About page for additional notices. This page last updated: 24 Feb 2003.