/************************************************************************* * (C) 2008 AITNET ltd - Sofia/Bulgaria - * by Michael Pounov * * $Author: misho $ * $Id: aitcrc.h,v 1.1.1.1 2008/11/05 17:02:55 misho Exp $ * *************************************************************************/ #ifndef __AITCRC_H #define __AITCRC_H #define REVOPTS_REVERTBYTE 1 #define REVOPTS_REVERTCRC 2 struct tagCRCPoly { u_char poly_bits; u_long poly_num; char poly_name[19]; }; // size 24bytes typedef struct tagCRCPoly crcPoly_t; inline int crc_GetErrno(); inline const char *crc_GetError(); inline u_long crcReflect(u_long crcNum, u_char crcBits); inline u_long crcCalc(u_char * __restrict psBuf, u_int bufLen, u_char crcBits, u_char RevOpts, u_long initCRC, u_long xorCRC); inline u_short crcIP(u_short * __restrict nBuf, int bufLen); inline u_long crcFletcher(u_short * __restrict nBuf, int bufLen); inline u_long crcAdler(u_char * __restrict psBuf, int bufLen); #define crcEther(psBuf, bufLen) crcCalc((psBuf), (bufLen), 32, 3, 0xFFFFFFFF, 0xFFFFFFFF) #endif