SASC-NG
DVBSoftCAM

SI::CRC32 Class Reference

#include <util.h>

List of all members.

Public Member Functions

 CRC32 (const char *d, int len, u_int32_t CRCvalue=0xFFFFFFFF)
bool isValid ()

Static Public Member Functions

static bool isValid (const char *d, int len, u_int32_t CRCvalue=0xFFFFFFFF)

Static Protected Member Functions

static u_int32_t crc32 (const char *d, int len, u_int32_t CRCvalue)

Protected Attributes

const char * data
int length
u_int32_t value

Static Protected Attributes

static u_int32_t crc_table [256]

Detailed Description

Definition at line 146 of file util.h.


Constructor & Destructor Documentation

SI::CRC32::CRC32 ( const char *  d,
int  len,
u_int32_t  CRCvalue = 0xFFFFFFFF 
)

Definition at line 278 of file util.c.

References data, length, and value.

                                                       {
   data=d;
   length=len;
   value=CRCvalue;
}

Member Function Documentation

u_int32_t SI::CRC32::crc32 ( const char *  d,
int  len,
u_int32_t  CRCvalue 
) [static, protected]

Definition at line 267 of file util.c.

References crc_table, and i.

Referenced by isValid().

{
   register int i;
   const unsigned char *u=(unsigned char*)d; // Saves '& 0xff'

   for (i=0; i<len; i++)
      crc = (crc << 8) ^ crc_table[((crc >> 24) ^ *u++)];

   return crc;
}
bool SI::CRC32::isValid ( ) [inline]

Definition at line 149 of file util.h.

References crc32(), length, and value.

{ return crc32(data, length, value) == 0; }
static bool SI::CRC32::isValid ( const char *  d,
int  len,
u_int32_t  CRCvalue = 0xFFFFFFFF 
) [inline, static]

Definition at line 150 of file util.h.

References crc32().

{ return crc32(d, len, CRCvalue) == 0; }

Member Data Documentation

u_int32_t SI::CRC32::crc_table [static, protected]

Definition at line 152 of file util.h.

Referenced by crc32().

const char* SI::CRC32::data [protected]

Definition at line 155 of file util.h.

Referenced by CRC32().

int SI::CRC32::length [protected]

Definition at line 156 of file util.h.

Referenced by CRC32(), and isValid().

u_int32_t SI::CRC32::value [protected]

Definition at line 157 of file util.h.

Referenced by CRC32(), and isValid().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines