NWSMGenerateCRC

Generates a CRC value for the given data or continues the CRC calculation from previous data to the current data.

Syntax

  #include <smsutapi.h> 
   
  UINT32 NWSMGenerateCRC ( 
     UINT32      size, 
     UINT32      crc, 
     BUFFERPTR   ptr);
  

Parameters

size

(IN) Specifies the number of bytes in the buffer pointed to by ptr.

crc

(IN) Specifies the initial CRC value (-1) or a previously accumulated CRC.

ptr

(IN) Points to the data used in calculating the CRC.

Return Values

If NWSMGenerateCRC is successful, it returns the new CRC value.

Remarks

NWSMGenerateCRC returns a 32-bit CRC. A CRC value needs to be calculated for the whole data set. However, the whole data set cannot be brought into memory; so the data set is broken into sections and CRC values are generated for each section. CRC values generated for the previous section are passed to NWSMGenerateCRC when calculating the current section’s CRC.

Example

  #include <smsutapi.h> 
   
  UINT32 genCRC, size, crc = -1; 
  BUFFERPTR ptr; 
   
  /* Set ptr to point to a buffer and set size to the number of data bytes in the buffer */ 
   
  genCRC = NWSMGenerateCRC(size, crc, ptr);