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

    1: /*************************************************************************
    2: * (C) 2008 AITNET ltd - Sofia/Bulgaria - <misho@aitbg.com>
    3: *  by Michael Pounov <misho@openbsd-bg.org>
    4: *
    5: * $Author: misho $
    6: * $Id: aitcrc.h,v 1.1 2008/11/05 17:02:55 misho Exp $
    7: *
    8: *************************************************************************/
    9: #ifndef __AITCRC_H
   10: #define __AITCRC_H
   11: 
   12: 
   13: #define REVOPTS_REVERTBYTE	1
   14: #define REVOPTS_REVERTCRC	2
   15: 
   16: 
   17: struct tagCRCPoly {
   18: 	u_char	poly_bits;
   19: 	u_long	poly_num;
   20: 	char	poly_name[19];
   21: };	// size 24bytes
   22: typedef struct tagCRCPoly crcPoly_t;
   23: 
   24: 
   25: inline int crc_GetErrno();
   26: inline const char *crc_GetError();
   27: 
   28: inline u_long crcReflect(u_long crcNum, u_char crcBits);
   29: inline u_long crcCalc(u_char * __restrict psBuf, u_int bufLen, u_char crcBits, u_char RevOpts, u_long initCRC, u_long xorCRC);
   30: 
   31: inline u_short crcIP(u_short * __restrict nBuf, int bufLen);
   32: inline u_long crcFletcher(u_short * __restrict nBuf, int bufLen);
   33: inline u_long crcAdler(u_char * __restrict psBuf, int bufLen);
   34: 
   35: #define crcEther(psBuf, bufLen)		crcCalc((psBuf), (bufLen), 32, 3, 0xFFFFFFFF, 0xFFFFFFFF)
   36: 
   37: 
   38: #endif

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