File:  [ELWIX - Embedded LightWeight unIX -] / libaitcrc / inc / aitcrc.h
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Wed Nov 5 17:02:55 2008 UTC (15 years, 7 months ago) by misho
Branches: MAIN
CVS tags: HEAD
Initial revision

/*************************************************************************
* (C) 2008 AITNET ltd - Sofia/Bulgaria - <misho@aitbg.com>
*  by Michael Pounov <misho@openbsd-bg.org>
*
* $Author: misho $
* $Id: aitcrc.h,v 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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>