|
SASC
DVBSoftCAM
|
#include <stdio.h>#include <stdlib.h>#include <ctype.h>#include <dlfcn.h>#include <dirent.h>#include <fnmatch.h>#include "data.h"#include "sc.h"#include "scsetup.h"#include "opts.h"#include "misc.h"#include "system.h"#include "smartcard.h"#include "cam.h"#include "log-core.h"#include "version.h"#include <vdr/sources.h>#include <vdr/channels.h>Go to the source code of this file.
Classes | |
| class | cOptCap |
Defines | |
| #define | LIBSC_PREFIX "libsc-" |
| #define | SO_INDICATOR ".so." |
Functions | |
| static bool | DllLoad (const char *fileName) |
| 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) |
| const char * | I18nTranslate (const char *s, const char *Plugin) |
| int | GetCaDescriptors (int Source, int Transponder, int ServiceId, const int *CaSystemIds, int BufSize, uchar *Data, bool &StreamFlag) |
Variables | |
| static struct LogModule | lm_core |
| cScSetup | ScSetup |
| #define LIBSC_PREFIX "libsc-" |
Definition at line 20 of file compat.c.
Referenced by DllsLoad().
| #define SO_INDICATOR ".so." |
Definition at line 21 of file compat.c.
Referenced by DllsLoad().
| static bool DllLoad | ( | const char * | fileName | ) | [static] |
Definition at line 23 of file compat.c.
References dlerror(), dlopen(), dlsym(), and SCAPIVERS.
Referenced by DllsLoad().
{
const char *base=rindex(fileName,'/');
if(base) base++; else base=fileName;
void *handle=dlopen(fileName,RTLD_NOW|RTLD_LOCAL);
if(handle) {
dlerror();
int *libapivers=(int *)dlsym(handle,"ScLibApiVersion");
const char *error=dlerror();
if(!error && *libapivers==SCAPIVERS)
return true;
else printf("dload: %s: SCAPI version doesn't match (plugin=%d, library=%d)\n",base,SCAPIVERS,!error?*libapivers:0);
}
else printf("dload: %s: %s\n",base,dlerror());
return false;
}
| bool DllsLoad | ( | const char * | libdir | ) |
Definition at line 40 of file compat.c.
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;
}
| int GetCaDescriptors | ( | int | Source, |
| int | Transponder, | ||
| int | ServiceId, | ||
| const int * | CaSystemIds, | ||
| int | BufSize, | ||
| uchar * | Data, | ||
| bool & | StreamFlag | ||
| ) |
Gets all CA descriptors for a given channel. Copies all available CA descriptors for the given Source, Transponder and ServiceId into the provided buffer at Data (at most BufSize bytes). Only those CA descriptors are copied that match one of the given CA system IDs.
Definition at line 494 of file compat.c.
{
return 0;
}
| const char* I18nTranslate | ( | const char * | s, |
| const char * | Plugin | ||
| ) |
| void InitAll | ( | const char * | cfgdir | ) |
Definition at line 55 of file compat.c.
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);
}
| void SDump | ( | const unsigned char * | buffer, |
| int | n | ||
| ) |
{
(LMOD_ENABLE|L_CORE_ALL)&LOPT_MASK,
(LMOD_ENABLE|L_CORE_LOAD|L_CORE_ECM|L_CORE_PIDS|L_CORE_AU|L_CORE_AUSTATS|L_CORE_CAIDS|L_CORE_NET|L_CORE_CI|L_CORE_SC|L_CORE_HOOK|L_CORE_OVER)&LOPT_MASK,
"core",
{ "load","action","ecm","ecmProc","pids","au","auStats","auExtra","auExtern",
"caids","keys","dynamic","csa","ci","av7110","net","netData","msgcache",
"serial","smartcard","hook","ciFull","csaVerb","override" }
}