SASC
DVBSoftCAM

cValidityRange Class Reference

#include <override.h>

Inheritance diagram for cValidityRange:

List of all members.

Public Member Functions

 cValidityRange (void)
bool Match (int caid, int source, int freq) const
 cValidityRange (void)
bool Match (int caid, int source, int freq) const

Protected Member Functions

char * Parse3 (char *s)
char * Parse2 (char *s, bool wildAllow=false)
cString Print (void)
char * Parse3 (char *s)
char * Parse2 (char *s, bool wildAllow=false)
cString Print (void)

Detailed Description

Definition at line 27 of file override.h.


Constructor & Destructor Documentation

cValidityRange::cValidityRange ( void  )

Definition at line 33 of file override.c.

{
  fromCaid=toCaid=-1; fromSource=toSource=-1; fromFreq=toFreq=-1;
  wildcard=false;
}
cValidityRange::cValidityRange ( void  )

Member Function Documentation

bool cValidityRange::Match ( int  caid,
int  source,
int  freq 
) const

Definition at line 39 of file override.c.

Referenced by cOverrides::Find().

{
  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)));
}
bool cValidityRange::Match ( int  caid,
int  source,
int  freq 
) const
char * cValidityRange::Parse2 ( char *  s,
bool  wildAllow = false 
) [protected]

Definition at line 75 of file override.c.

References isempty(), L_CORE_LOAD, PRINTF, and skipspace().

Referenced by cOverrideEcmPrio::Parse(), cOverrideIgnore::Parse(), and cOverrideCat::Parse().

{
  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;
      if(ParseSourceRange(s)) {
        s=p+1;
        if(!*s || ParseFreqRange(s)) return e;
        }
      log=false;
      }
    }
  if(log) PRINTF(L_CORE_LOAD,"override: RANGE format error");
  return 0;
}
char* cValidityRange::Parse2 ( char *  s,
bool  wildAllow = false 
) [protected]
char* cValidityRange::Parse3 ( char *  s) [protected]
char * cValidityRange::Parse3 ( char *  s) [protected]

Definition at line 47 of file override.c.

References L_CORE_LOAD, PRINTF, and skipspace().

Referenced by cOverrideTunnel::Parse(), cOverrideEmmTable::Parse(), cOverrideEcmTable::Parse(), and cOverrideEmmCaid::Parse().

{
  bool log=true;
  s=skipspace(s);
  char *e=index(s,'}');
  if(e && *s++=='{') {
    *e=0; e=skipspace(e+1);
    char *p;
    if((p=index(s,':'))) {
      *p=0;
      if(ParseCaidRange(s)) {
        s=p+1;
        if((p=index(s,':'))) {
          *p=0;
          if(s==p || ParseSourceRange(s)) {
            s=p+1;
            if(!*s || ParseFreqRange(s)) return e;
            }
          log=false;
          }
        }
      else log=false;
      }
    }
  if(log) PRINTF(L_CORE_LOAD,"override: RANGE format error");
  return 0;
}
cString cValidityRange::Print ( void  ) [protected]

Definition at line 151 of file override.c.

References cSource::ToString().

Referenced by cOverrideEcmPrio::Parse(), cOverrideIgnore::Parse(), cOverrideTunnel::Parse(), cOverrideEmmTable::Parse(), cOverrideEcmTable::Parse(), cOverrideEmmCaid::Parse(), and cOverrideCat::Parse().

{
  if(wildcard) return "*";
  char buff[256];
  int q=0;
  if(fromCaid>0) {
    q+=snprintf(buff+q,sizeof(buff)-q,"%04x",fromCaid);
    if(toCaid>0)
      q+=snprintf(buff+q,sizeof(buff)-q,"-%04x",toCaid);
    q+=snprintf(buff+q,sizeof(buff)-q,":");
    }
  if(fromSource>0) {
    q+=snprintf(buff+q,sizeof(buff)-q,"%s",*cSource::ToString(fromSource));
    if(toSource>0)
      q+=snprintf(buff+q,sizeof(buff)-q,"-%s",*cSource::ToString(toSource));
    }
  q+=snprintf(buff+q,sizeof(buff)-q,":");
  if(fromFreq>0) {
    q+=snprintf(buff+q,sizeof(buff)-q,"%d",fromFreq);
    if(toFreq>0)
      q+=snprintf(buff+q,sizeof(buff)-q,"-%d",toFreq);
    }
  return buff;
}
cString cValidityRange::Print ( void  ) [protected]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines