|
SASC
DVBSoftCAM
|
00001 /* 00002 * Softcam plugin to VDR (C++) 00003 * 00004 * This code is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This code is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 * Or, point your browser to http://www.gnu.org/copyleft/gpl.html 00018 */ 00019 00020 #ifndef ___SYSTEM_COMMON_H 00021 #define ___SYSTEM_COMMON_H 00022 00023 #include "data.h" 00024 #include "system.h" 00025 00026 // ---------------------------------------------------------------- 00027 00028 class cHexKey : public cPlainKey { 00029 private: 00030 int keylen; 00031 unsigned char *key; 00032 protected: 00033 virtual bool SetKey(void *Key, int Keylen); 00034 virtual bool SetBinKey(unsigned char *Mem, int Keylen); 00035 virtual cString Print(void); 00036 virtual bool Cmp(cPlainKey *k); 00037 virtual void Get(void *mem); 00038 virtual int Size(void) { return keylen; } 00039 public: 00040 cHexKey(bool Super); 00041 virtual ~cHexKey(); 00042 virtual bool Parse(const char *line) { return false; } 00043 }; 00044 00045 // ---------------------------------------------------------------- 00046 00047 class cBN; 00048 00049 class cBNKey : public cPlainKey { 00050 private: 00051 bool rotate; 00052 int keylen; 00053 cBN *key; 00054 protected: 00055 virtual bool SetKey(void *Key, int Keylen); 00056 virtual bool SetBinKey(unsigned char *Mem, int Keylen); 00057 virtual cString Print(void); 00058 virtual bool Cmp(cPlainKey *k); 00059 virtual void Get(void *mem); 00060 virtual int Size(void) { return keylen; } 00061 public: 00062 cBNKey(bool Super, bool Rotate=false); 00063 virtual ~cBNKey(); 00064 virtual bool Parse(const char *line) { return false; } 00065 }; 00066 00067 // ---------------------------------------------------------------- 00068 00069 class cDualKey : public cMutableKey { 00070 private: 00071 bool rotate; 00072 protected: 00073 virtual bool IsBNKey(void) const=0; 00074 virtual cPlainKey *Alloc(void) const; 00075 public: 00076 cDualKey(bool Super, bool Rotate); 00077 }; 00078 00079 // ---------------------------------------------------------------- 00080 00081 class cPlainKeyStd : public cHexKey { 00082 public: 00083 cPlainKeyStd(bool Super); 00084 virtual bool Parse(const char *line); 00085 }; 00086 00087 // ---------------------------------------------------------------- 00088 00089 template<class T> class cCardInfos : public cStructList<T> { 00090 public: 00091 cCardInfos(const char *Type, const char *Filename, int fl):cStructList<T>(Type,Filename,fl|SL_MISSINGOK|SL_WATCH) {} 00092 virtual cStructItem *ParseLine(char *line) 00093 { 00094 T *k=new T; 00095 if(k && !k->Parse(line)) { delete k; k=0; } 00096 return k; 00097 } 00098 }; 00099 00100 // ---------------------------------------------------------------- 00101 00102 class cSystemScCore : public cSystem { 00103 private: 00104 int scId; 00105 const char *scName; 00106 public: 00107 cSystemScCore(const char *Name, int Pri, int ScId, const char *ScName); 00108 virtual bool ProcessECM(const cEcmInfo *ecm, unsigned char *data); 00109 virtual void ProcessEMM(int pid, int caid, const unsigned char *data); 00110 }; 00111 00112 #endif //___SYSTEM_COMMON_H