/*******************************************************************************
* Function:
AppProtocolCalcTAIPChecksum
* Parameters:
pszTAIPMsg, checksum
* Returns:
Pointer to Checksum Header ;* if found, NULL otherwise.
* Description:
This function checks for the presense of the TAIP checksum
*
header.
*
places it in the checksum parameter and returns a pointer
*
to the checksum header.
*
Otherwise it returns NULL without changing checksum.
******************************************************************************/
char* AppProtocolCalcTAIPChecksum(char *pszTAIPMsg, unsigned char *checksum)
{
char *pcEnd;
char *pc;
unsigned char cs;
if((pcEnd = strstr(pszTAIPMsg, ";*")) != NULL) {
pc = pszTAIPMsg;
pcEnd += 2;
cs = 0;
while(pc < pcEnd) {
cs ^= *pc;
pc++;
}
*checksum = cs;
return pcEnd-2;
} else {
return NULL;
}
}
Table 53, Sample XOR Checksum Source Code
If it exists it calculates the checksum and
// Start of the checsumed chars.
// Move to the first non-checksumed char.
TrimTrac ProE Locator Technical Manual v2.0e 143
Need help?
Do you have a question about the ProE Locator and is the answer not in the manual?
Questions and answers