SASC-NG
DVBSoftCAM

cMapReg Class Reference

#include <nagra2.h>

List of all members.

Public Member Functions

 cMapReg (int &_pos, int *_defwordsize=0, int _maxwordsize=DEF_MAXWORDSIZE)
 operator BIGNUM * ()
BIGNUM * operator-> ()
BIGNUM * Value (int wsize=0, bool mask=false)
void Commit (int wsize=-1, int resync=-1)
void Reload (int wsize=0)
void GetLE (const unsigned char *in, int n=0)
void PutLE (unsigned char *out, int n=0)
void Set (BIGNUM *val, int wsize)
void Clear (int wsize)
void SetPos (int _pos)

Protected Member Functions

void SetMaxWordSize (int max)
void SetDefWordSize (int *_defwordsize)

Detailed Description

Definition at line 56 of file nagra2.h.


Constructor & Destructor Documentation

cMapReg::cMapReg ( int &  _pos,
int *  _defwordsize = 0,
int  _maxwordsize = DEF_MAXWORDSIZE 
)

Definition at line 356 of file nagra2.c.

References DEF_WORDSIZE, SetDefWordSize(), and SetMaxWordSize().

:pos(_pos)
{
  SetDefWordSize(_defwordsize);
  SetMaxWordSize(_maxwordsize);
  wordsize=DEF_WORDSIZE;
}

Member Function Documentation

void cMapReg::Clear ( int  wsize)

Definition at line 458 of file nagra2.c.

References Commit().

{
  wsize=OpWordSize(wsize);
  if(wordsize!=wsize) {
    Commit();
    ClearFullReg(wsize);
    }
  ClearReg(wsize);
}
void cMapReg::Commit ( int  wsize = -1,
int  resync = -1 
)

Definition at line 400 of file nagra2.c.

Referenced by Clear(), GetLE(), cMap0101::Map(), PutLE(), Set(), and Value().

{
  if(resync<0 && wsize<0) resync=1;
  wsize=OpWordSize(wsize>=0?wsize:wordsize);
  ClearFullReg(wsize);
  PrepTmp(reg,wsize);
  BN_add(fullreg,fullreg,tmp);
  if(resync) {
    if(wordsize==wsize) BN_mask_bits(reg,wsize*64);
    else wordsize=wsize;
    }
}
void cMapReg::GetLE ( const unsigned char *  in,
int  n = 0 
)

Definition at line 421 of file nagra2.c.

References Commit(), and cBN::GetLE().

Referenced by cMap4101::Map(), cMap0501::Map(), and cMap0101::Map().

{
  int wsize=OpWordSize(n<=0?n:(n+7)/8);
  if(wordsize>wsize) Commit();
  reg.GetLE(in,wsize*8);
  Commit(wsize);
  pos=0;
}
cMapReg::operator BIGNUM * ( ) [inline]

Definition at line 72 of file nagra2.h.

References Value().

{ return Value(); }
BIGNUM* cMapReg::operator-> ( ) [inline]

Definition at line 73 of file nagra2.h.

References Value().

{ return Value(); }
void cMapReg::PutLE ( unsigned char *  out,
int  n = 0 
)

Definition at line 430 of file nagra2.c.

References Commit(), i, and cBN::PutLE().

Referenced by cMap0101::Map().

{
  int wsize=OpWordSize(n<=0?n:(n+7)/8);
  Commit();
  fullreg.PutLE(out,wsize*8);
  if(pos&7) {
    int s=pos/8*8;
    for(int i=0; i<(pos&7); i++) {
      unsigned char c=out[s];
      memmove(out+s,out+s+1,7);
      out[s+7]=c;
      }
    }
}
void cMapReg::Reload ( int  wsize = 0)

Definition at line 413 of file nagra2.c.

Referenced by Value().

{
  wsize=OpWordSize(wsize>=0?wsize:wordsize);
  wordsize=wsize;
  BN_copy(reg,fullreg);
  BN_mask_bits(reg,64*wsize);
}
void cMapReg::Set ( BIGNUM *  val,
int  wsize 
)

Definition at line 445 of file nagra2.c.

References Commit().

{
  wsize=OpWordSize(wsize);
  if(wordsize!=wsize) Commit();
  ClearReg(wsize);
  PrepTmp(val,wsize);
  if(wordsize!=wsize) {
    ClearFullReg(wsize);
    BN_add(fullreg,fullreg,tmp);
    }
  BN_add(reg,reg,tmp);
}
void cMapReg::SetDefWordSize ( int *  _defwordsize) [inline, protected]

Definition at line 69 of file nagra2.h.

Referenced by cMapReg().

{ defwordsize=_defwordsize; }
void cMapReg::SetMaxWordSize ( int  max) [inline, protected]

Definition at line 68 of file nagra2.h.

References max().

Referenced by cMapReg().

{ maxwordsize=max; }
void cMapReg::SetPos ( int  _pos) [inline]

Definition at line 81 of file nagra2.h.

Referenced by cMapCore::IMonInit0(), and cMap0101::Map().

{ pos=_pos; }
BIGNUM * cMapReg::Value ( int  wsize = 0,
bool  mask = false 
)

Definition at line 364 of file nagra2.c.

References Commit(), and Reload().

Referenced by operator BIGNUM *(), and operator->().

{
  wsize=OpWordSize(wsize);
  if(wordsize!=wsize) {
    Commit();
    Reload();
    }
  else if(mask)
    BN_mask_bits(reg,wsize*64);
  return reg;
}

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