(e.g. SHL seems pretty useless nowadays).
-When using a cardclient, be as precise as possible with the CAID/MASK values in
the cardclient.conf file. Using wide open 0000/0000 is not recommended.
--Add CAIDs which you cannot use due to lack of keys to the SC.CaIgnore setting.
+-Add CAIDs which you cannot use due to lack of keys to the ignore setup in
+ override.conf.
}
else {
LBPUT(" ->");
- int Pri=0;
- while((sys=cSystems::FindBySysId(caid,!softCSA,Pri))) {
- Pri=sys->Pri();
- if(sys->HasLogger()) {
- sys->CardNum(cardNum);
- sys->ParseCAT(&pids,cat,source,transponder);
- systems.Add(sys);
- LBPUT(" %s(%d)",sys->Name(),sys->Pri());
+ if(!overrides.Ignore(source,transponder,caid)) {
+ int Pri=0;
+ while((sys=cSystems::FindBySysId(caid,!softCSA,Pri))) {
+ Pri=sys->Pri();
+ if(sys->HasLogger()) {
+ sys->CardNum(cardNum);
+ sys->ParseCAT(&pids,cat,source,transponder);
+ systems.Add(sys);
+ LBPUT(" %s(%d)",sys->Name(),sys->Pri());
+ }
+ else
+ delete sys;
}
- else
- delete sys;
}
}
if(systems.Count()==0) LBPUT(" none available");
{
int ident, pri=0;
while(1) {
+ if(overrides.Ignore(n->source,n->transponder,n->caId)) break;
if(!n->Cached()) ident=cSystems::FindIdentBySysId(n->caId,!cam->IsSoftCSA(filterCwIndex==0),pri);
else ident=(pri==0) ? cSystems::FindIdentBySysName(n->caId,!cam->IsSoftCSA(filterCwIndex==0),n->name,pri) : 0;
if(ident<=0) break;
int sysId=WORD(buff,index+2,0xFFFF);
if(SysId!=0xFFFF && sysId!=SysId) continue;
if(dolog) LDUMP(L_CORE_ECM,&buff[index+2],buff[index+1],"%s: descriptor",id);
+ if(overrides.Ignore(filterSource,filterTransponder,sysId)) {
+ if(dolog) PRINTF(L_CORE_ECM,"%s: system %04x ignored",id,sysId);
+ continue;
+ }
int sysPri=0;
cSystem *sys;
while((sys=cSystems::FindBySysId(sysId,!cam->IsSoftCSA(filterCwIndex==0),sysPri))) {
void Dump(int n);
const caid_t *Caids(void) { caids[numcaids]=0; return caids; }
int NumCaids(void) { return numcaids; }
+ int Source(void) const { return source; }
+ int Transponder(void) const { return transponder; }
};
cChannelCaids::cChannelCaids(cChannel *channel)
const caid_t *ids=ch->Caids();
while(*ids) {
int pri=0;
- if(!cSystems::FindIdentBySysId(*ids,false,pri)) {
+ if(overrides.Ignore(ch->Source(),ch->Transponder(),*ids))
+ ch->Del(*ids);
+ else if(!cSystems::FindIdentBySysId(*ids,false,pri)) {
for(cChannelCaids *ch2=Next(ch); ch2; ch2=Next(ch2)) ch2->Del(*ids);
ch->Del(*ids);
}
int cScDvbDevice::ProvidesCa(const cChannel *Channel) const
{
if(cam && Channel->Ca()>=CA_ENCRYPTED_MIN) {
- int j;
- caid_t ids[MAXCAIDS+1];
- for(j=0; j<=MAXCAIDS; j++) if((ids[j]=Channel->Ca(j))==0) break;
- if(cSystems::Provides(ids,!softcsa)>0) return 2;
+ int caid;
+ for(int j=0; (caid=Channel->Ca(j)); j++)
+ if(!overrides.Ignore(Channel->Source(),Channel->Transponder(),caid)) {
+ int n=cSystems::CanHandle(caid,!softcsa);
+ if(n<0) break;
+ if(n>0) return 2;
+ }
}
return cDvbDevice::ProvidesCa(Channel);
}
; {1234::}
;
+;
+; Define ignored CAIDs for general processing
+;
+; NOTE: this replace the CaIgnore option in setup.conf. See below on how to
+; convert your settings
+;
+; format:
+; ignore:{src[-src]:[freq[-freq]]}caid[:caid][...]
+; ignore:{*}caid[:caid][...]
+;
+; if your ignore line in setup.conf looks like this
+; sc.CaIgnore = 622 9c4 b00 d22 1702 1722 1836 1837
+; then you should add an entry like this
+; ignore:{*}0622:09c4:0b00:0d22:1702:1722:1836:1837
+; Of course you could set a more fine grade validity range as well.
+;
+; examples
+; ignore:{S61.5W-S148W:}1801:0D04:0600
+; ignore:{*}0622:1833
+
;
; Add entries to the CAT (conditional access table) in case a EMM stream is
; not announced there.
; format:
; tunnel:{caid[-caid]:[src[-src]]:[freq[-freq]]}newcaid[:rewriter]
;
-;
; examples:
; tunnel:{1833:S19.2E:}1702:nagra-beta
cValidityRange::cValidityRange(void)
{
fromCaid=toCaid=-1; fromSource=toSource=-1; fromFreq=toFreq=-1;
+ wildcard=false;
}
bool cValidityRange::Match(int caid, int source, int freq) const
{
- return (caid<0 || fromCaid<0 || (toCaid<0 && caid==fromCaid) || (caid>=fromCaid && caid<=toCaid)) &&
- (fromSource<0 || (toSource<0 && source==fromSource) || (source>=fromSource && source<=toSource)) &&
- (fromFreq<0 || (toFreq<0 && freq==fromFreq) || (freq>=fromFreq && freq<=toFreq));
+ return wildcard ||
+ ((caid<0 || fromCaid<0 || (toCaid<0 && caid==fromCaid) || (caid>=fromCaid && caid<=toCaid)) &&
+ (fromSource<0 || (toSource<0 && source==fromSource) || (source>=fromSource && source<=toSource)) &&
+ (fromFreq<0 || (toFreq<0 && freq==fromFreq) || (freq>=fromFreq && freq<=toFreq)));
}
char *cValidityRange::Parse3(char *s)
return 0;
}
-char *cValidityRange::Parse2(char *s)
+char *cValidityRange::Parse2(char *s, bool wildAllow)
{
bool log=true;
s=skipspace(s);
char *e=index(s,'}');
if(e && *s++=='{') {
*e=0; e=skipspace(e+1);
+ s=skipspace(s);
+ if(wildAllow && *s=='*' && isempty(s+1)) {
+ wildcard=true;
+ return e;
+ }
char *p;
if((p=index(s,':'))) {
*p=0;
cString cValidityRange::Print(void)
{
+ if(wildcard) return "*";
char buff[256];
int q=0;
if(fromCaid>0) {
#define OV_ECMTABLE 3
#define OV_EMMTABLE 4
#define OV_TUNNEL 5
+#define OV_IGNORE 6
// -- cOverrideCat -------------------------------------------------------------
return caid;
}
+// -- cOverrideIgnore ----------------------------------------------------------
+
+#define OV_MAXIGNORES 64
+
+class cOverrideIgnore : public cOverride {
+private:
+ int num, caid[OV_MAXIGNORES];
+public:
+ cOverrideIgnore(void) { type=OV_IGNORE; }
+ virtual bool Parse(char *str);
+ bool Ignore(int Caid);
+ };
+
+bool cOverrideIgnore::Parse(char *str)
+{
+ if((str=Parse2(str,true))) {
+ num=0;
+ int n=-1;
+ do {
+ int l=n+1;
+ if(sscanf(&str[l],"%x%n",&caid[num],&n)!=1) {
+ PRINTF(L_CORE_LOAD,"override: IGNORE format error");
+ return false;
+ }
+ n+=l; num++;
+ } while(num<OV_MAXTABLES && str[n]==':');
+ LBSTART(L_CORE_OVER);
+ LBPUT("ignore: %s - caids",*Print());
+ for(int i=0; i<num; i++) LBPUT(" %02x",caid[i]);
+ LBEND();
+ return true;
+ }
+ return false;
+}
+
+bool cOverrideIgnore::Ignore(int Caid)
+{
+ for(int i=0; i<num; i++)
+ if(Caid==caid[i]) return true;
+ return false;
+}
+
// -- cOverrides ---------------------------------------------------------------
cOverrides overrides;
else if(!strncasecmp(line,"ecmtable",8)) ov=new cOverrideEcmTable;
else if(!strncasecmp(line,"emmtable",8)) ov=new cOverrideEmmTable;
else if(!strncasecmp(line,"tunnel",6)) ov=new cOverrideTunnel;
+ else if(!strncasecmp(line,"ignore",6)) ov=new cOverrideIgnore;
if(ov && !ov->Parse(p)) { delete ov; ov=0; }
}
return ov;
ListUnlock();
return res;
}
+
+bool cOverrides::Ignore(int source, int transponder, int caid)
+{
+ bool res=false;
+ ListLock(false);
+ for(cOverride *ov=0; (ov=Find(OV_IGNORE,-1,source,transponder,ov)) && !res;) {
+ cOverrideIgnore *ovi=dynamic_cast<cOverrideIgnore *>(ov);
+ if(ovi && ovi->Ignore(caid)) res=true;
+ }
+ ListUnlock();
+ return res;
+}
int fromCaid, toCaid;
int fromSource, toSource;
int fromFreq, toFreq;
+ bool wildcard;
//
bool ParseCaidRange(const char *str);
bool ParseSourceRange(const char *str);
bool ParseFreqRange(const char *str);
protected:
char *Parse3(char *s);
- char *Parse2(char *s);
+ char *Parse2(char *s, bool wildAllow=false);
cString Print(void);
public:
cValidityRange(void);
int GetCat(int source, int transponder, unsigned char *buff, int len);
void UpdateEcm(cEcmInfo *ecm, bool log);
bool AddEmmPids(int caid, int source, int transponder, cPids *pids, int pid);
+ bool Ignore(int source, int transponder, int caid);
};
extern cOverrides overrides;
ScCaps[0]=1;
ScCaps[1]=2;
ConcurrentFF=0;
- memset(CaIgnore,0,sizeof(CaIgnore));
LocalPriority=0;
ForceTransfer=1;
PrestartAU=0;
PRINTF(L_CORE_LOAD,"** ECM cache is set to %s",EcmCache ? (EcmCache==1?"READ-ONLY":"DISABLED"):"enabled");
LBSTART(L_CORE_LOAD);
LBPUT("** ScCaps are"); for(int i=0; i<MAXSCCAPS ; i++) LBPUT(" %d",ScCaps[i]);
- LBFLUSH();
- LBPUT("** Ignored CAIDs"); for(int i=0; i<MAXCAIGN ; i++) LBPUT(" %04X",CaIgnore[i]);
LBEND();
}
return false;
}
-bool cScSetup::Ignore(unsigned short caid)
-{
- for(int i=0; i<MAXCAIGN; i++)
- if(CaIgnore[i]==caid) return true;
- return false;
-}
-
// --- cSoftCAM ---------------------------------------------------------------
bool cSoftCAM::Load(const char *cfgdir)
ScOpts->Add(new cOptBool ("LocalPriority",trNOOP("Prefer local systems") ,&ScSetup.LocalPriority));
ScOpts->Add(new cOptSel ("EcmCache" ,trNOOP("ECM cache") ,&ScSetup.EcmCache,3,ecache));
ScOpts->Add(new cOptMInt ("ScCaps" ,trNOOP("Active on DVB card") , ScSetup.ScCaps,MAXSCCAPS,0));
- ScOpts->Add(new cOptMInt ("CaIgnore" ,trNOOP("Ignore CAID") , ScSetup.CaIgnore,MAXCAIGN,2));
LogOpts=new cOpts(0,6);
LogOpts->Add(new cOptBool ("LogConsole" ,trNOOP("Log to console") ,&logcfg.logCon));
LogOpts->Add(new cOptBool ("LogFile" ,trNOOP("Log to file") ,&logcfg.logFile));
#define ___SC_SETUP_H
#define MAXSCCAPS 10
-#define MAXCAIGN 64
// ----------------------------------------------------------------
int AutoUpdate;
int ScCaps[MAXSCCAPS];
int ConcurrentFF;
- int CaIgnore[MAXCAIGN];
int LocalPriority;
int ForceTransfer;
int PrestartAU;
void Check(void);
void Store(bool AsIs);
bool CapCheck(int n);
- bool Ignore(unsigned short caid);
};
extern cScSetup ScSetup;
#include <openssl/md5.h>
#include "sc.h"
-#include "scsetup.h"
#include "system.h"
#include "data.h"
#include "override.h"
first=sysLink;
}
-int cSystems::Provides(const unsigned short *SysIds, bool ff)
+int cSystems::CanHandle(int SysId, bool ff)
{
- int n=0;
- for(; *SysIds; SysIds++) {
- if(ScSetup.Ignore(*SysIds)) continue;
- cSystemLink *sl=first;
- while(sl) {
- if(sl->CanHandle(*SysIds)) {
- if(sl->noFF && ff) return 0;
- n++;
- break;
- }
- sl=sl->next;
- }
- }
- return n;
+ for(cSystemLink *sl=first; sl; sl=sl->next)
+ if(sl->CanHandle(SysId))
+ return (sl->noFF && ff) ? -1:1;
+ return 0;
}
cSystemLink *cSystems::FindByName(const char *Name)
cSystem *cSystems::FindBySysId(unsigned short SysId, bool ff, int oldPri)
{
- if(!ScSetup.Ignore(SysId)) {
- cSystemLink *csl=FindById(SysId,ff,oldPri);
- if(csl) return csl->Create();
- }
- return 0;
+ cSystemLink *csl=FindById(SysId,ff,oldPri);
+ return csl ? csl->Create() : 0;
}
int cSystems::FindIdentBySysId(unsigned short SysId, bool ff, int &Pri)
{
- if(!ScSetup.Ignore(SysId)) {
- cSystemLink *csl=FindById(SysId,ff,Pri);
- if(csl) {
- Pri=csl->pri;
- return csl->sysIdent;
- }
+ cSystemLink *csl=FindById(SysId,ff,Pri);
+ if(csl) {
+ Pri=csl->pri;
+ return csl->sysIdent;
}
return 0;
}
int cSystems::FindIdentBySysName(unsigned short SysId, bool ff, const char *Name, int &Pri)
{
- if(!ScSetup.Ignore(SysId)) {
- cSystemLink *csl=FindByName(Name);
- if(csl && (!ff || !csl->noFF) && csl->CanHandle(SysId)) {
- Pri=csl->pri;
- return csl->sysIdent;
- }
+ cSystemLink *csl=FindByName(Name);
+ if(csl && (!ff || !csl->noFF) && csl->CanHandle(SysId)) {
+ Pri=csl->pri;
+ return csl->sysIdent;
}
return 0;
}
static cSystemLink *FindById(unsigned short SysId, bool ff, int oldPri);
static cSystemLink *FindByIdent(int ident);
public:
- static int Provides(const unsigned short *SysIds, bool ff);
+ static int CanHandle(int SysId, bool ff);
static cSystem *FindBySysId(unsigned short SysId, bool ff, int oldPri);
static int FindIdentBySysId(unsigned short SysId, bool ff, int &Pri);
static int FindIdentBySysName(unsigned short SysId, bool ff, const char *Name, int &Pri);