SASC-NG
DVBSoftCAM

cShares Class Reference

Inheritance diagram for cShares:

List of all members.

Public Member Functions

int GetShares (const cEcmInfo *ecm, cShares *ss)
void SetLag (int shareid, int lag)
bool HasCaid (int caid)

Detailed Description

Definition at line 493 of file cccam2.c.


Member Function Documentation

int cShares::GetShares ( const cEcmInfo *  ecm,
cShares *  ss 
)

Definition at line 528 of file cccam2.c.

References cSimpleListBase::Add(), cEcmInfo::caId, cSimpleListBase::Clear(), cSimpleListBase::Count(), cEcmShares::FindStatus(), cSimpleList< cShare >::First(), cSimpleList< T >::First(), cSimpleListBase::Ins(), cRwLock::Lock(), cSimpleList< cShare >::Next(), cSimpleList< T >::Next(), cEcmInfo::provId, and cRwLock::Unlock().

Referenced by cCardClientCCcam2::ProcessECM().

{
  Lock(true);
  Clear();
  ss->Lock(false);
  for(cShare *s=ss->First(); s; s=ss->Next(s)) {
    if(((s->caid==ecm->caId && (!s->UsesProv() || s->HasProv(ecm->provId))) ||
        (s->shareid<64 && s->caid==(ecm->caId&0xFF00))) &&
       !Find(s->shareid)) {
      cShare *n=new cShare(s);
      n->status=ecmshares.FindStatus(ecm,n->shareid);
      // keep the list sorted
      cShare *l=0;
      for(cShare *t=First(); t; t=Next(t)) {
        if(t->Compare(n)) {
          if(l) Add(n,l); else Ins(n);
          n=0; break;
          }
        l=t;
        }
      if(n) Add(n);
      }
    }
  ss->Unlock();
  Unlock();
  return Count();
}
bool cShares::HasCaid ( int  caid)

Definition at line 521 of file cccam2.c.

References caid, cSimpleList< cShare >::First(), and cSimpleList< cShare >::Next().

{
  for(cShare *s=First(); s; s=Next(s))
    if(s->CaID()==caid) return true;
  return false;
}
void cShares::SetLag ( int  shareid,
int  lag 
)

Definition at line 509 of file cccam2.c.

References cRwLock::Lock(), MAXLAG, min(), STDLAG, and cRwLock::Unlock().

Referenced by cCardClientCCcam2::ProcessECM().

{
  Lock(false);
  cShare *s=Find(shareid);
  if(s) {
    lag=min(lag,MAXLAG);
    if(s->lag==STDLAG) s->lag=(STDLAG+lag)/2;
    else s->lag=(3*s->lag+lag)/4;
    }
  Unlock();
}

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