|
SASC-NG
DVBSoftCAM
|
Go to the source code of this file.
Functions | |
| bool | DllsLoad (const char *libdir) |
| void | InitAll (const char *cfgdir) |
| void | LogAll (void) |
| void | LogNone (void) |
| void | SDump (const unsigned char *buffer, int n) |
| int | ReadRaw (const char *name, unsigned char *buff, int maxlen) |
| bool DllsLoad | ( | const char * | libdir | ) |
Definition at line 40 of file compat.c.
References AddDirectory(), APIVERSION, DllLoad(), LIBSC_PREFIX, cReadDir::Next(), SCAPIVERS, and SO_INDICATOR.
Referenced by main().
{
char pat[32];
snprintf(pat,sizeof(pat),"%s*-%d%s%s",LIBSC_PREFIX,SCAPIVERS,SO_INDICATOR,APIVERSION);
bool res=true;
cReadDir dir(libdir);
struct dirent *e;
while((e=dir.Next())) {
if(!fnmatch(pat,e->d_name,FNM_PATHNAME|FNM_NOESCAPE)) {
if(!DllLoad(AddDirectory(libdir,e->d_name))) res=false;
}
}
return res;
}
| void InitAll | ( | const char * | cfgdir | ) |
Definition at line 55 of file compat.c.
References cSystems::ConfigParse(), cSimpleListBase::Count(), cSmartCards::Disable(), cStructLoader::Disable(), Feature, filemaps, cSystems::Init(), cFeature::KeyFile(), keys, L_GEN_ERROR, cStructLoaders::Load(), logcfg, PRINTF, cStructLoaders::SetCfgDir(), cFileMaps::SetCfgDir(), cFeature::SmartCard(), and smartcards.
Referenced by main().
{
logcfg.logCon=1;
logcfg.noTimestamp=1;
cSystems::ConfigParse("Cardclient.Immediate","0");
cSystems::ConfigParse("Viaccess.TpsAU","1");
filemaps.SetCfgDir(cfgdir);
cStructLoaders::SetCfgDir(cfgdir);
if(!Feature.KeyFile()) keys.Disable();
if(!Feature.SmartCard()) smartcards.Disable();
cStructLoaders::Load(false);
if(Feature.KeyFile() && keys.Count()<1)
PRINTF(L_GEN_ERROR,"no keys loaded for softcam!");
if(!cSystems::Init(cfgdir)) exit(2);
}
| void LogAll | ( | void | ) |
| void LogNone | ( | void | ) |
| int ReadRaw | ( | const char * | name, |
| unsigned char * | buff, | ||
| int | maxlen | ||
| ) |
Definition at line 91 of file compat.c.
Referenced by main().
{
FILE *f=fopen(name,"r");
if(f) {
char line[512];
int len=0;
while(len<maxlen && fgets(line,sizeof(line),f)) {
if(strstr(line,"dump: n=")) continue;
char *p=index(line,'#');
if(p) *p=0;
p=index(line,'[');
if(p) {
p=index(p,']');
if(p) {
strcpy(line,p+1);
}
}
p=index(line,':');
if(p) p++; else p=line;
while(1) {
char *np;
int val=strtol(p,&np,16);
if(p!=np) {
buff[len++]=val;
p=np;
}
else break;
}
}
fclose(f);
// printf("using raw from %s:\n",name);
// HexDump(buff,len);
return len;
}
printf("failed to open raw file %s: %s\n",name,strerror(errno));
exit(1);
}