SASC
DVBSoftCAM

cPlainKeyVia Class Reference

Inheritance diagram for cPlainKeyVia:

List of all members.

Public Member Functions

 cPlainKeyVia (bool Super)
virtual bool Parse (const char *line)
virtual bool SetKey (void *Key, int Keylen)
virtual bool SetBinKey (unsigned char *Mem, int Keylen)
 cPlainKeyVia (bool Super)
virtual bool Parse (const char *line)
virtual bool SetKey (void *Key, int Keylen)
virtual bool SetBinKey (unsigned char *Mem, int Keylen)

Protected Member Functions

virtual int IdSize (void)
virtual cString PrintKeyNr (void)
virtual int IdSize (void)
virtual cString PrintKeyNr (void)

Detailed Description

Definition at line 55 of file viaccess.c.


Constructor & Destructor Documentation

cPlainKeyVia::cPlainKeyVia ( bool  Super)

Definition at line 68 of file viaccess.c.

:cPlainKeyStd(Super)
{}
cPlainKeyVia::cPlainKeyVia ( bool  Super)

Member Function Documentation

virtual int cPlainKeyVia::IdSize ( void  ) [inline, protected, virtual]

Reimplemented from cPlainKey.

Definition at line 57 of file viaccess.c.

{ return 6; }
virtual int cPlainKeyVia::IdSize ( void  ) [inline, protected, virtual]

Reimplemented from cPlainKey.

Definition at line 57 of file viaccess.c.

{ return 6; }
virtual bool cPlainKeyVia::Parse ( const char *  line) [virtual]

Reimplemented from cPlainKeyStd.

bool cPlainKeyVia::Parse ( const char *  line) [virtual]

Reimplemented from cPlainKeyStd.

Definition at line 84 of file viaccess.c.

References Bin2Int, GetChar(), GetHex(), cPlainKey::keynr, MBC3, SetBinKey(), skipspace(), cPlainKey::type, VIA1_KEYLEN, VIA2_KEYLEN, and VIATPS_KEYLEN.

{
  unsigned char sid[3], skeynr, skey[VIA2_KEYLEN];
  int len;
  if(GetChar(line,&type,1) && (len=GetHex(line,sid,3,false))) {
     type=toupper(type); id=Bin2Int(sid,len);
     line=skipspace(line);
     bool ok=false;
     if(!strncasecmp(line,"TPSMK",5) && line[5]>='0' && line[5]<='9') {
       keynr=MBC3('M','K',line[5]-'0');
       line+=6;
       ok=(len=GetHex(line,skey,VIATPS_KEYLEN));
       }
     else if(!strncasecmp(line,"TPS ",4)) {
       line+=4;
       keynr=MBC3('T','P','S');
       ok=(len=GetHex(line,skey,VIATPS_KEYLEN));
       }
     else if(GetHex(line,&skeynr,1)) {
       keynr=skeynr;
       ok=((len=GetHex(line,skey,VIA2_KEYLEN,false)) && (len==VIA1_KEYLEN || len==VIA2_KEYLEN));
       }
     if(ok) {
       SetBinKey(skey,len);
       return true;
       }
    }
  return false;
}
cString cPlainKeyVia::PrintKeyNr ( void  ) [protected, virtual]

Reimplemented from cPlainKey.

Definition at line 114 of file viaccess.c.

References C3, cPlainKey::keynr, and MBC3.

{
  char tmp[12];
  const char *kn=tmp;
  switch(keynr) {
    case MBC3('T','P','S'):
      kn="TPS"; break;
    case MBC3('M','K',0): case MBC3('M','K',1): case MBC3('M','K',2):
    case MBC3('M','K',3): case MBC3('M','K',4): case MBC3('M','K',5):
    case MBC3('M','K',6): case MBC3('M','K',7): case MBC3('M','K',8):
    case MBC3('M','K',9):
      snprintf(tmp,sizeof(tmp),"TPSMK%d",C3(keynr)); break;
    default:
      snprintf(tmp,sizeof(tmp),"%02X",keynr); break;
    }
  return kn;
}
virtual cString cPlainKeyVia::PrintKeyNr ( void  ) [protected, virtual]

Reimplemented from cPlainKey.

bool cPlainKeyVia::SetBinKey ( unsigned char *  Mem,
int  Keylen 
) [virtual]

Reimplemented from cHexKey.

Definition at line 78 of file viaccess.c.

References cPlainKey::keynr, MBC3, and cPlainKey::SetSupersede().

Referenced by Parse().

{
  if(keynr==MBC3('T','P','S')) SetSupersede(false);
  return cPlainKeyStd::SetBinKey(Mem,Keylen);
}
virtual bool cPlainKeyVia::SetBinKey ( unsigned char *  Mem,
int  Keylen 
) [virtual]

Reimplemented from cHexKey.

virtual bool cPlainKeyVia::SetKey ( void *  Key,
int  Keylen 
) [virtual]

Reimplemented from cHexKey.

bool cPlainKeyVia::SetKey ( void *  Key,
int  Keylen 
) [virtual]

Reimplemented from cHexKey.

Definition at line 72 of file viaccess.c.

References cPlainKey::keynr, MBC3, and cPlainKey::SetSupersede().

{
  if(keynr==MBC3('T','P','S')) SetSupersede(false);
  return cPlainKeyStd::SetKey(Key,Keylen);
}

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