4 /* Set up for C function definitions, even when using C++ */
9 /* ----------- Includes -------------- */
13 /* ------------ Definitions --------- */
15 /* Definition shared by all CRC routines */
18 #define CrcUint32 unsigned int
21 #define CrcUint8 unsigned char
24 #ifdef ORIGINAL_METHOD
25 #define CRC32_POLY 0x04c11db7 /* AUTODIN II, Ethernet, & FDDI */
27 #define CRC32_POLY 0xEDB88320 /* Perl String::CRC32 compatible */
30 /* Data structure for CRC32 (checksum) computation */
33 CrcUint32 crc32_table[256]; /* CRC table */
36 /* ---------- Function Prototypes ------------- */
40 #define DLLINTERFACE __declspec(dllexport)
42 #define DLLINTERFACE __declspec(dllimport)
49 * utl_crc32Init: initialize the CRC context
53 * crcContext pointer to context variable
60 * Note: The function initializes the crc table required for crc calcs.
62 DLLINTERFACE int utl_crc32Init(CRC32_CTX * crcContext);
66 * utl_crc32Calc: calculate a crc32 from a data block
70 * crcContext pointer to context variable
71 * inBuf input buffer to checksum
72 * inLen length of input buffer
73 * crc32 pointer to Uint32 to store the final CRC into
82 DLLINTERFACE int utl_crc32Calc(CRC32_CTX * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32);
84 /* Same routine broken down into three steps */
86 DLLINTERFACE int utl_crc32CalcStart(CRC32_CTX * crcContext, CrcUint32 *crc32);
87 DLLINTERFACE int utl_crc32CalcEnd(CRC32_CTX * crcContext, CrcUint32 *crc32);
88 DLLINTERFACE int utl_crc32CalcBuffer(CRC32_CTX * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32);
92 * utl_crc32Done: clean up CRC context
96 * crcContext pointer to context variable
105 DLLINTERFACE int utl_crc32Done(CRC32_CTX * crcContext);
108 /* Ends C function definitions when using C++ */
113 #endif /* _utl_crc32_h */