forked from ipruthi/sasc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
override.h
104 lines (90 loc) · 2.91 KB
/
override.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*
* Softcam plugin to VDR (C++)
*
* This code is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This code is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* Or, point your browser to http://www.gnu.org/copyleft/gpl.html
*/
#ifndef ___OVERRIDE_H
#define ___OVERRIDE_H
#include "data.h"
// ----------------------------------------------------------------
class cValidityRange {
private:
int fromCaid, toCaid;
int fromSource, toSource;
int fromFreq, toFreq;
bool wildcard;
//
bool ParseCaidRange(const char *str);
bool ParseSourceRange(const char *str);
bool ParseFreqRange(const char *str);
protected:
char *Parse3(char *s);
char *Parse2(char *s, bool wildAllow=false);
cString Print(void);
public:
cValidityRange(void);
bool Match(int caid, int source, int freq) const;
};
// ----------------------------------------------------------------
class cRewriter {
private:
unsigned char *mem;
int mlen;
protected:
const char *name;
int id;
//
unsigned char *Alloc(int len);
public:
cRewriter(const char *Name, int Id);
virtual ~cRewriter();
virtual bool Rewrite(unsigned char *&data, int &len)=0;
int Id(void) const { return id; }
};
// ----------------------------------------------------------------
class cRewriters {
public:
static cRewriter *CreateById(int id);
static int GetIdByName(const char *name);
};
// ----------------------------------------------------------------
class cOverride : public cStructItem, public cValidityRange {
protected:
int type;
public:
virtual ~cOverride() {}
virtual bool Parse(char *str)=0;
int Type(void) { return type; }
};
// ----------------------------------------------------------------
class cOverrides : public cStructList<cOverride> {
private:
bool caidTrigger;
protected:
cOverride *Find(int type, int caid, int source, int transponder, cOverride *ov=0);
virtual cOverride *ParseLine(char *line);
virtual void PreLoad(void);
virtual void PostLoad(void);
public:
cOverrides(void);
int GetCat(int source, int transponder, unsigned char *buff, int len);
void UpdateEcm(cEcmInfo *ecm, bool log);
bool AddEmmPids(int caid, int source, int transponder, cPids *pids, int pid);
bool Ignore(int source, int transponder, int caid);
int GetEcmPrio(int source, int transponder, int caid, int prov);
};
extern cOverrides overrides;
#endif //___OVERRIDE_H