|
SASC-NG
DVBSoftCAM
|
#include <system.h>
Inheritance diagram for cSystem:Public Member Functions | |
| cSystem (const char *Name, int Pri) | |
| virtual | ~cSystem () |
| void | SetOwner (cCam *Cam) |
| virtual int | CheckECM (const cEcmInfo *ecm, const unsigned char *data, bool sync) |
| virtual void | CheckECMResult (const cEcmInfo *ecm, const unsigned char *data, bool result) |
| virtual bool | ProcessECM (const cEcmInfo *ecm, unsigned char *buffer)=0 |
| virtual void | ProcessEMM (int pid, int caid, const unsigned char *buffer) |
| virtual void | ParseCADescriptor (cSimpleList< cEcmInfo > *ecms, unsigned short sysId, int source, const unsigned char *data, int len) |
| virtual void | ParseCAT (cPids *pids, const unsigned char *buffer, int source, int transponder) |
| void | AddHook (cLogHook *hook) |
| bool | TriggerHook (int id) |
| unsigned char * | CW (void) |
| void | DoLog (bool Log) |
| int | Pri (void) |
| const char * | CurrentKeyStr (void) |
| const char * | Name (void) |
| int | MaxEcmTry (void) |
| bool | HasLogger (void) |
| bool | NeedsLogger (void) |
| bool | Local (void) |
| bool | NeedsData (void) |
| bool | Constant (void) |
Static Public Member Functions | |
| static void | CaidsChanged (void) |
| static void | FoundKey (void) |
| static void | NewKey (void) |
| static void | KeyStats (int &fk, int &nk) |
Protected Member Functions | |
| void | KeyOK (cPlainKey *pk) |
| void | KeyOK (const char *txt) |
| void | KeyFail (int type, int id, int keynr) |
| void | StartLog (const cEcmInfo *ecm, int caid) |
Protected Attributes | |
| const char * | name |
| unsigned char | cw [16] |
| bool | doLog |
| int | maxEcmTry |
| bool | local |
| bool | hasLogger |
| bool | needsLogger |
| bool | needsDescrData |
| bool | constant |
Friends | |
| class | cKeySnoop |
| cSystem::cSystem | ( | const char * | Name, |
| int | Pri | ||
| ) |
Definition at line 99 of file system.c.
References constant, cw, doLog, hasLogger, local, maxEcmTry, Name(), name, needsDescrData, needsLogger, and Pri().
{
name=Name; pri=Pri;
currentKeyStr[0]=0; doLog=true; cam=0; logecm=0;
check=new struct EcmCheck;
memset(check,0,sizeof(struct EcmCheck));
memset(cw,0,sizeof(cw));
// default config
maxEcmTry=2; // try to get a key X times from the same ECM pid (default)
hasLogger=false;
needsLogger=false;
local=true;
needsDescrData=false;
constant=false;
}
| cSystem::~cSystem | ( | ) | [virtual] |
Definition at line 115 of file system.c.
References cCam::LogEcmStatus().
{
delete check;
if(logecm && cam) cam->LogEcmStatus(logecm,false);
delete logecm;
}
| void cSystem::AddHook | ( | cLogHook * | hook | ) |
Definition at line 133 of file system.c.
References cCam::AddHook().
Referenced by cTpsKeys::Check(), and cSatTime::Now().
{
if(cam) cam->AddHook(hook);
}
| void cSystem::CaidsChanged | ( | void | ) | [static] |
Definition at line 143 of file system.c.
{
cGlobal::CaidsChanged();
}
| int cSystem::CheckECM | ( | const cEcmInfo * | ecm, |
| const unsigned char * | data, | ||
| bool | sync | ||
| ) | [virtual] |
Definition at line 202 of file system.c.
References EcmCheck::caid, cEcmInfo::caId, L_CORE_ECMPROC, name, PRINTF, EcmCheck::sys06, and WORD.
Referenced by cEcmHandler::Process().
{
switch(ecm->caId>>8) {
case 0x06: // Irdeto
{
const int chid=WORD(data,6,0xFFFF);
// if multiple channel id's, use current one only
if(sync && check->caid.sys06.current>0 && chid!=check->caid.sys06.current) {
PRINTF(L_CORE_ECMPROC,"ecmcheck(%s): chid %04x != current %04x",name,chid,check->caid.sys06.current);
return 3;
}
/*
//XXX is that still needed? Seems to conflict with some Irdeto2 provider
// search for fake channel id's on Stream
const int cur=data[4];
const int max=data[5];
if(!sync && max>0 && max<MAX_CHID) {
if(cur==0) check->caid.sys06.startFlag=true;
if(check->caid.sys06.startFlag) {
if(cur<=max) check->caid.sys06.chids[cur]=chid;
if(cur==max) {
for(int i=0 ; i<max ; i++) {
if(check->caid.sys06.chids[i]==0) {
check->caid.sys06.startFlag=false;
PRINTF(L_CORE_ECMPROC,"ecmcheck(%s): zero chid",name);
return 1;
}
for(int j=i+1 ; j<=max ; j++) {
if(check->caid.sys06.chids[i]==check->caid.sys06.chids[j]) {
check->caid.sys06.startFlag=false;
PRINTF(L_CORE_ECMPROC,"ecmcheck(%s): duplicate chid %04x",name,check->caid.sys06.chids[i]);
return 1;
}
}
}
}
}
}
*/
break;
}
}
return 0;
}
| void cSystem::CheckECMResult | ( | const cEcmInfo * | ecm, |
| const unsigned char * | data, | ||
| bool | result | ||
| ) | [virtual] |
Definition at line 247 of file system.c.
References EcmCheck::caid, cEcmInfo::caId, EcmCheck::sys06, and WORD.
Referenced by cEcmHandler::Process().
| bool cSystem::Constant | ( | void | ) | [inline] |
Definition at line 142 of file system.h.
References constant.
Referenced by cEcmHandler::Process().
{ return constant; }
| const char* cSystem::CurrentKeyStr | ( | void | ) | [inline] |
Definition at line 135 of file system.h.
Referenced by cEcmHandler::CurrentKeyStr().
{ return currentKeyStr; }
| unsigned char* cSystem::CW | ( | void | ) | [inline] |
| void cSystem::DoLog | ( | bool | Log | ) | [inline] |
| static void cSystem::FoundKey | ( | void | ) | [inline, static] |
Definition at line 144 of file system.h.
Referenced by cSystemViaccess::ProcessEMM(), cSystemSeca::ProcessEMM(), cSystemNagra2::ProcessEMM(), cSystemNagra::ProcessEMM(), cSystemIrd2::ProcessEMM(), and cSystemIrd::ProcessEMM().
{ foundKeys++; }
| bool cSystem::HasLogger | ( | void | ) | [inline] |
| void cSystem::KeyFail | ( | int | type, |
| int | id, | ||
| int | keynr | ||
| ) | [protected] |
Definition at line 271 of file system.c.
References doLog, keys, cPlainKeys::KeyString(), L_CORE_ECM, cLastKey::NotLast(), PRINTF, and cPlainKeys::Trigger().
Referenced by cKeySnoop::~cKeySnoop().
| void cSystem::KeyOK | ( | const char * | txt | ) | [protected] |
| void cSystem::KeyOK | ( | cPlainKey * | pk | ) | [protected] |
Definition at line 256 of file system.c.
References doLog, cPlainKey::id, cPlainKey::keynr, L_CORE_ECM, cLastKey::NotLast(), PRINTF, strn0cpy(), cPlainKey::ToString(), and cPlainKey::type.
Referenced by cKeySnoop::OK(), cSystemCardClient::ProcessECM(), and cSystemScCore::ProcessECM().
| static void cSystem::KeyStats | ( | int & | fk, |
| int & | nk | ||
| ) | [inline, static] |
Definition at line 146 of file system.h.
Referenced by cMenuInfoSc::cMenuInfoSc().
{ fk=foundKeys; nk=newKeys; }
| bool cSystem::Local | ( | void | ) | [inline] |
| int cSystem::MaxEcmTry | ( | void | ) | [inline] |
Definition at line 137 of file system.h.
References maxEcmTry.
Referenced by cEcmHandler::Process().
{ return maxEcmTry; }
| const char* cSystem::Name | ( | void | ) | [inline] |
Definition at line 136 of file system.h.
References name.
Referenced by cSystem(), main(), cLogChain::Parse(), and cEcmHandler::Process().
{ return name; }
| bool cSystem::NeedsData | ( | void | ) | [inline] |
Definition at line 141 of file system.h.
References needsDescrData.
Referenced by cEcmHandler::Process().
{ return needsDescrData; }
| bool cSystem::NeedsLogger | ( | void | ) | [inline] |
| static void cSystem::NewKey | ( | void | ) | [inline, static] |
Definition at line 145 of file system.h.
Referenced by cSystemViaccess::ProcessEMM(), cSystemSeca::ProcessEMM(), cSystemNagra2::ProcessEMM(), cSystemNagra::ProcessEMM(), cSystemIrd2::ProcessEMM(), and cSystemIrd::ProcessEMM().
{ newKeys++; }
| void cSystem::ParseCADescriptor | ( | cSimpleList< cEcmInfo > * | ecms, |
| unsigned short | sysId, | ||
| int | source, | ||
| const unsigned char * | data, | ||
| int | len | ||
| ) | [virtual] |
Reimplemented in cSystemScViaccess, and cSystemViaccess.
Definition at line 148 of file system.c.
References cSimpleListBase::Add(), name, cEcmInfo::SetDataIdx(), and WORD.
{
const int pid=WORD(data,2,0x1FFF);
switch(sysId>>8) {
case 0x01: // Seca style
for(int p=2; p<len; p+=15) {
cEcmInfo *n=new cEcmInfo(name,WORD(data,p,0x1FFF),sysId,WORD(data,p+2,0xFFFF));
if(data[p+4]==0xFF) n->SetDataIdx(p+5);
ecms->Add(n);
}
break;
case 0x05: // Viaccess style
for(int p=4; p<len; p+=2+data[p+1])
if(data[p]==0x14)
ecms->Add(new cEcmInfo(name,pid,sysId,(data[p+2]<<16)|(data[p+3]<<8)|(data[p+4]&0xF0)));
break;
default: // default style
ecms->Add(new cEcmInfo(name,pid,sysId,0));
break;
}
}
| void cSystem::ParseCAT | ( | cPids * | pids, |
| const unsigned char * | buffer, | ||
| int | source, | ||
| int | transponder | ||
| ) | [virtual] |
Definition at line 170 of file system.c.
References cOverrides::AddEmmPids(), cPids::AddPid(), caid, i, overrides, and WORD.
Referenced by cLogChain::Parse().
{
if(buffer[0]==0x09) {
int caid=WORD(buffer,2,0xFFFF);
int pid=WORD(buffer,4,0x1FFF);
if(overrides.AddEmmPids(caid,source,transponder,pids,pid)) return;
switch(caid>>8) {
case 0x01: // Seca style (82/84)
if(buffer[1]>4) {
pids->AddPid(pid,0x82,0xFF); // Unique updates
for(int i=7, nn=buffer[6] ; nn ; nn--,i+=4)
pids->AddPid(WORD(buffer,i,0x1FFF),0x84,0xFF); // Shared updates
}
break;
case 0x05: // Viaccess style (88/8c/8d/8e)
pids->AddPid(pid,0x88,0xF9); // mismatching 8a
pids->AddPid(pid,0x8D,0xFF);
break;
case 0x0d: // Cryptoworks style (82/84/86/88/89)
pids->AddPid(pid,0x82,0xF9); // mismatching 80
pids->AddPid(pid,0x88,0xFE);
break;
case 0x18: // Nagra style (82/83)
pids->AddPid(pid,0x82,0xFE);
break;
default: // default style (82)
pids->AddPid(pid,0x82,0xFF);
break;
}
}
}
| int cSystem::Pri | ( | void | ) | [inline] |
Definition at line 134 of file system.h.
Referenced by cSystem(), main(), and cLogChain::Parse().
{ return pri; }
| virtual bool cSystem::ProcessECM | ( | const cEcmInfo * | ecm, |
| unsigned char * | buffer | ||
| ) | [pure virtual] |
Implemented in cSystemScCore, cSystemCardClient, cSystemConax, cSystemConstCw, cSystemCryptoworks, cSystemIrd, cSystemIrd2, cSystemNagra, cSystemNagra2, cSystemFakeNDS, cSystemSeca, and cSystemViaccess.
Referenced by main(), and cEcmHandler::Process().
| virtual void cSystem::ProcessEMM | ( | int | pid, |
| int | caid, | ||
| const unsigned char * | buffer | ||
| ) | [inline, virtual] |
Reimplemented in cSystemScCore, cSystemCardClient, cSystemIrd, cSystemIrd2, cSystemNagra, cSystemNagra2, cSystemSeca, and cSystemViaccess.
Definition at line 125 of file system.h.
Referenced by main().
{};
| void cSystem::SetOwner | ( | cCam * | Cam | ) | [inline] |
| void cSystem::StartLog | ( | const cEcmInfo * | ecm, |
| int | caid | ||
| ) | [protected] |
Definition at line 122 of file system.c.
References caid, cEcmInfo::caId, cEcmInfo::emmCaId, and cCam::LogEcmStatus().
Referenced by cSystemNagra2::ProcessECM().
{
if(!logecm || logecm->caId!=caid) {
if(logecm && cam) cam->LogEcmStatus(logecm,false);
delete logecm;
logecm=new cEcmInfo(ecm);
logecm->caId=caid; logecm->emmCaId=0;
if(cam) cam->LogEcmStatus(logecm,true);
}
}
| bool cSystem::TriggerHook | ( | int | id | ) |
Definition at line 138 of file system.c.
References cCam::TriggerHook().
Referenced by cTpsKeys::Check(), and cSatTime::Now().
{
return cam && cam->TriggerHook(id);
}
bool cSystem::constant [protected] |
Definition at line 110 of file system.h.
Referenced by Constant(), cSystem(), and cSystemConstCw::cSystemConstCw().
unsigned char cSystem::cw[16] [protected] |
Definition at line 106 of file system.h.
Referenced by cSystem(), cSystemFakeNDS::cSystemFakeNDS(), CW(), cSystemViaccess::ProcessECM(), cSystemSeca::ProcessECM(), cSystemFakeNDS::ProcessECM(), cSystemNagra2::ProcessECM(), cSystemNagra::ProcessECM(), cSystemIrd2::ProcessECM(), cSystemIrd::ProcessECM(), cSystemCryptoworks::ProcessECM(), cSystemConstCw::ProcessECM(), cSystemCardClient::ProcessECM(), and cSystemScCore::ProcessECM().
bool cSystem::doLog [protected] |
Definition at line 107 of file system.h.
Referenced by cSystem(), DoLog(), KeyFail(), KeyOK(), cSystemSeca::ProcessECM(), cSystemFakeNDS::ProcessECM(), cSystemNagra2::ProcessECM(), cSystemNagra::ProcessECM(), cSystemIrd2::ProcessECM(), cSystemIrd::ProcessECM(), cSystemCryptoworks::ProcessECM(), and cSystemConax::ProcessECM().
bool cSystem::hasLogger [protected] |
Definition at line 110 of file system.h.
Referenced by cSystem(), cSystemCardClient::cSystemCardClient(), cSystemIrd::cSystemIrd(), cSystemIrd2::cSystemIrd2(), cSystemNagra::cSystemNagra(), cSystemNagra2::cSystemNagra2(), cSystemScConax::cSystemScConax(), cSystemScCryptoworks::cSystemScCryptoworks(), cSystemScIrdeto::cSystemScIrdeto(), cSystemScNagra::cSystemScNagra(), cSystemScSeca::cSystemScSeca(), cSystemScViaccess::cSystemScViaccess(), cSystemScVideoGuard2::cSystemScVideoGuard2(), cSystemSeca::cSystemSeca(), cSystemViaccess::cSystemViaccess(), and HasLogger().
bool cSystem::local [protected] |
Definition at line 110 of file system.h.
Referenced by cSystem(), cSystemCardClient::cSystemCardClient(), and Local().
int cSystem::maxEcmTry [protected] |
Definition at line 109 of file system.h.
Referenced by cSystem(), MaxEcmTry(), and cSystemViaccess::ProcessECM().
const char* cSystem::name [protected] |
Definition at line 105 of file system.h.
Referenced by CheckECM(), cSystem(), KeyOK(), Name(), and ParseCADescriptor().
bool cSystem::needsDescrData [protected] |
Definition at line 110 of file system.h.
Referenced by cSystem(), cSystemScSeca::cSystemScSeca(), and NeedsData().
bool cSystem::needsLogger [protected] |
Definition at line 110 of file system.h.
Referenced by cSystem(), and NeedsLogger().