SASC-NG
DVBSoftCAM

compat.h File Reference

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)

Function Documentation

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)
void LogAll ( void  )

Definition at line 73 of file compat.c.

References i, LCLASS, and cLogging::SetModuleOptions().

Referenced by main().

{
  for(int i=0; i<32; i++)
    cLogging::SetModuleOptions(LCLASS(i,0xFFFFFFFF));
}
void LogNone ( void  )

Definition at line 79 of file compat.c.

References i, LCLASS, and cLogging::SetModuleOptions().

Referenced by main().

{
  for(int i=0; i<32; i++)
    cLogging::SetModuleOptions(LCLASS(i,0));
}
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 
)

Definition at line 85 of file compat.c.

Referenced by Ecm(), Emm(), main(), and cTestNagra::Process().

{
  for(int l=0 ; l<n ; l++) printf("%02x ",buffer[l]);
  printf("\n");
}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines