SASC-NG
DVBSoftCAM

cEcmCache Class Reference

#include <cam.h>

Inheritance diagram for cEcmCache:

List of all members.

Public Member Functions

 cEcmCache (void)
void New (cEcmInfo *e)
int GetCached (cSimpleList< cEcmInfo > *list, int sid, int Source, int Transponder)
void Delete (cEcmInfo *e)
void Flush (void)

Protected Member Functions

virtual bool ParseLinePlain (const char *line)

Detailed Description

Definition at line 45 of file cam.h.


Constructor & Destructor Documentation

cEcmCache::cEcmCache ( void  )

Definition at line 642 of file cam.c.


Member Function Documentation

void cEcmCache::Delete ( cEcmInfo *  e)

Definition at line 698 of file cam.c.

References cStructLoader::DelItem(), cEcmInfo::ecm_pid, cEcmInfo::ecm_table, cScSetup::EcmCache, cEcmInfo::grPrgId, L_CORE_ECM, cStructLoader::ListLock(), cStructLoader::ListUnlock(), PRINTF, ScSetup, cEcmInfo::source, and cEcmInfo::transponder.

{
  if(ScSetup.EcmCache>0) return;
  ListLock(false);
  cEcmData *dat=Exists(e);
  ListUnlock();
  if(dat) {
    DelItem(dat);
    PRINTF(L_CORE_ECM,"invalidated cached prgId=%d source=%x transponder=%x ecm=%x/%x",dat->grPrgId,dat->source,dat->transponder,dat->ecm_pid,dat->ecm_table);
    }
}
void cEcmCache::Flush ( void  )
int cEcmCache::GetCached ( cSimpleList< cEcmInfo > *  list,
int  sid,
int  Source,
int  Transponder 
)

Definition at line 677 of file cam.c.

References cSimpleListBase::Add(), cEcmInfo::caId, cSimpleListBase::Clear(), cEcmInfo::ecm_pid, cEcmInfo::ecm_table, cScSetup::EcmCache, cStructListPlain< cEcmData >::First(), cEcmInfo::grPrgId, L_CORE_ECM, cStructLoader::ListLock(), cStructLoader::ListUnlock(), cEcmInfo::name, cStructListPlain< cEcmData >::Next(), PRINTF, cEcmInfo::provId, ScSetup, cEcmInfo::SetCached(), cEcmInfo::source, and cEcmInfo::transponder.

{
  int n=0;
  list->Clear();
  if(ScSetup.EcmCache>1) return 0;
  ListLock(false);
  for(cEcmData *dat=First(); dat; dat=Next(dat)) {
    if(dat->grPrgId==sid && dat->source==Source && dat->transponder==Transponder) {
      cEcmInfo *e=new cEcmInfo(dat);
      if(e) {
        PRINTF(L_CORE_ECM,"from cache: system %s (%04x) id %04x with ecm %x/%x",e->name,e->caId,e->provId,e->ecm_pid,e->ecm_table);
        e->SetCached();
        list->Add(e);
        n++;
        }
      }
    }
  ListUnlock();
  return n;
}
void cEcmCache::New ( cEcmInfo *  e)

Definition at line 646 of file cam.c.

References cSimpleListBase::Add(), cEcmInfo::AddCaDescr(), cEcmInfo::ecm_pid, cEcmInfo::ecm_table, cScSetup::EcmCache, cEcmInfo::grPrgId, L_CORE_ECM, cStructLoader::ListLock(), cStructLoader::ListUnlock(), cStructLoader::Modified(), cEcmInfo::name, PRINTF, ScSetup, cEcmInfo::SetCached(), cEcmInfo::SetName(), cEcmInfo::source, and cEcmInfo::transponder.

{
  if(ScSetup.EcmCache>0) return;
  ListLock(true);
  cEcmData *dat;
  if(!(dat=Exists(e))) {
    dat=new cEcmData(e);
    Add(dat);
    Modified();
    PRINTF(L_CORE_ECM,"cache add prgId=%d source=%x transponder=%x ecm=%x/%x",e->grPrgId,e->source,e->transponder,e->ecm_pid,e->ecm_table);
    }
  else {
    if(strcasecmp(e->name,dat->name)) {
      dat->SetName(e->name);
      Modified();
      }
    if(dat->AddCaDescr(e))
      Modified();
    }
  ListUnlock();
  e->SetCached();
}
bool cEcmCache::ParseLinePlain ( const char *  line) [protected, virtual]

Implements cStructLoaderPlain.

Definition at line 719 of file cam.c.

References cSimpleListBase::Add(), and cEcmData::Parse().

{
  cEcmData *dat=new cEcmData;
  if(dat && dat->Parse(line) && !Exists(dat)) Add(dat);
  else delete dat;
  return true;
}

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