void cLogStats::Action(void) { while(Running()) { cCondWait::SleepMs(50); if(sTime.Elapsed()>SAMPLE) { sCounts[sIdx][0]=sCount; sCount=0; sCounts[sIdx][1]=sTime.Elapsed(); sTime.Set(); if(++sIdx >= COUNTS) sIdx=0; } if(repTime.Elapsed()>REPORT) { repTime.Set(); if(sCounts[(sIdx+COUNTS-1)%COUNTS][0]>0) { LBSTART(L_CORE_AUSTATS); LBPUT("EMM packet load average (%d/%d/%dmin)",AVR1/60000,AVR2/60000,AVR3/60000); int s=0, t=0; for(int i=1; i<=COUNTS; i++) { s+=sCounts[(sIdx+COUNTS-i)%COUNTS][0]; t+=sCounts[(sIdx+COUNTS-i)%COUNTS][1]; if(i==(AVR1/SAMPLE) || i==(AVR2/SAMPLE) || i==(AVR3/SAMPLE)) LBPUT(" %4d",(int)((float)s/(float)t*1000.0)); } LBPUT(" pks/s"); LBEND(); } } } }
void cPidFilter::Start(int Pid, int Section, int Mask, int Mode, bool Crc) { cMutexLock lock(this); if(fd>=0) { Stop(); struct dmx_sct_filter_params FilterParams; memset(&FilterParams,0,sizeof(FilterParams)); FilterParams.filter.filter[0]=Section; FilterParams.filter.mask[0]=Mask; FilterParams.filter.mode[0]=Mode; FilterParams.flags=DMX_IMMEDIATE_START; if(Crc) FilterParams.flags|=DMX_CHECK_CRC; FilterParams.pid=Pid; if(ioctl(fd,DMX_SET_FILTER,&FilterParams)<0) { PRINTF(L_GEN_ERROR,"filter '%s': DMX_SET_FILTER failed: %s",id,strerror(errno)); return; } pid=Pid; active=true; LBSTART(L_CORE_ACTION); LBPUT("filter '%s' -> pid=0x%04x sct=0x%02x/0x%02x/0x%02x crc=%d matching",id,Pid,Section,Mask,Mode,Crc); int mam =Mask & (~Mode); int manm=Mask & ~(~Mode); for(int i=0; i<256; i++) { int xxxor=Section ^ i; if((mam&xxxor) || (manm && !(manm&xxxor))) {} else LBPUT(" 0x%02x",i); } LBEND(); } }
bool cCardClient::ParseStdConfig(const char *config, int *num) { int n, emm=0; if(!num) num=&n; if(sscanf(config,"%63[^:]:%d:%d%n",hostname,&port,&emm,num)<3) return false; if(emm>0) emmAllowed=1; if(emm==2) emmAllowed=2; // EMM caching disabled if(config[*num]=='/') { numCaid=0; do { emmMask[numCaid]=0xFFFF; int start=(*num)+1; if(sscanf(&config[start],"%x%n/%x%n",&emmCaid[numCaid],num,&emmMask[numCaid],num)<1) return false; *num+=start; if(emmMask[numCaid]==0x0000 && emmCaid[numCaid]!=0x0000) PRINTF(L_GEN_WARN,"CAID %04x MASK %04x in cardclient config doesn't match anything!",emmCaid[numCaid],emmMask[numCaid]); numCaid++; } while(numCaid<MAX_CC_CAID && config[*num]==','); } LBSTART(L_CC_CORE); LBPUT("hostname=%s port=%d emm=%d emmCaids",hostname,port,emmAllowed); for(int i=0; i<numCaid; i++) LBPUT(" %04x/%04x",emmCaid[i],emmMask[i]); LBEND(); return true; }
void cScSetup::Check(void) { if(AutoUpdate==0) PRINTF(L_GEN_WARN,"Keys updates (AU) are disabled."); for(int i=0; i<MAXSCCAPS; i++) if(ScCaps[i]>=16) { PRINTF(L_GEN_WARN,"ScCaps contains unusual value. Check your config! (You can ignore this message if you have more than 16 dvb cards in your system ;)"); break; } PRINTF(L_CORE_LOAD,"** Key updates (AU) are %s (%sprestart)",AutoUpdate?(AutoUpdate==1?"enabled (active CAIDs)":"enabled (all CAIDs)"):"DISABLED",PrestartAU?"":"no "); PRINTF(L_CORE_LOAD,"** Local systems %stake priority over cached remote",LocalPriority?"":"DON'T "); PRINTF(L_CORE_LOAD,"** %sorce transfermode with digital audio",ForceTransfer?"F":"DON'T f"); PRINTF(L_CORE_LOAD,"** ECM cache is set to %s",EcmCache ? (EcmCache==1?"READ-ONLY":"DISABLED"):"enabled"); PRINTF(L_CORE_LOAD,"** TsBufferSize is %d MB",DeCsaTsBuffSize); LBSTART(L_CORE_LOAD); LBPUT("** ScCaps are"); for(int i=0; i<MAXSCCAPS ; i++) LBPUT(" %d",ScCaps[i]); LBEND(); }
bool cOverrideEmmTable::Parse(char *str) { if((str=Parse3(str))) { num=0; int n=-1; do { mask[num]=0xFF; int l=n+1; if(sscanf(&str[l],"%x%n/%x%n",&table[num],&n,&mask[num],&n)<1) { PRINTF(L_CORE_LOAD,"override: EMMTABLE format error"); return false; } n+=l; num++; } while(num<OV_MAXTABLES && str[n]==':'); LBSTART(L_CORE_OVER); LBPUT("emmtable: %s - tables",*Print()); for(int i=0; i<num; i++) LBPUT(" %02x/%02x",table[i],mask[i]); LBEND(); return true; } return false; }
void cPidFilter::Start(int Pid, int Section, int Mask) { cMutexLock lock(this); Stop(); fd=device->OpenFilter(Pid,Section,Mask); if(fd>=0) { pid=Pid; LBSTART(L_CORE_ACTION); LBPUT("filter '%s' -> pid=0x%04x sct=0x%02x/0x%02x matching",id,Pid,Section,Mask); int Mode=0; int mam =Mask & (~Mode); int manm=Mask & ~(~Mode); for(int i=0; i<256; i++) { int xxxor=Section ^ i; if((mam&xxxor) || (manm && !(manm&xxxor))) {} else LBPUT(" 0x%02x",i); } LBEND(); } }