Go to the documentation of this file.
20 #define MAX_CAM_SLOTS_PER_ADAPTER 16 // maximum possible value is 255 (same value as MAXDEVICES!)
21 #define MAX_CONNECTIONS_PER_CAM_SLOT 8 // maximum possible value is 254
22 #define CAM_READ_TIMEOUT 50 // ms
45 int GetTag(
int &Length,
const uint8_t **Data);
46 const uint8_t *
GetData(
const uint8_t *Data,
int &Length);
47 void SendData(
int Tag,
int Length = 0,
const uint8_t *Data = NULL);
56 virtual void Process(
int Length = 0,
const uint8_t *Data = NULL);
78 virtual void Process(
int Length = 0,
const uint8_t *Data = NULL);
163 void Reply(
const char *s);
183 virtual void Action(
void);
187 virtual int Read(uint8_t *Buffer,
int MaxLength) {
return 0; }
192 virtual void Write(
const uint8_t *Buffer,
int Length) {}
194 virtual bool Reset(
int Slot) {
return false; }
228 cCiCaPmt *
Add(uint8_t CmdId,
int Source,
int Transponder,
int ProgramNumber,
const int *CaSystemIds);
257 void KeepSharedCaPids(
int ProgramNumber,
const int *CaSystemIds,
int *CaPids);
350 virtual bool Reset(
void);
375 virtual bool Ready(
void);
377 virtual bool HasMMI(
void);
391 virtual bool ProvidesCa(
const int *CaSystemIds);
398 virtual void AddPid(
int ProgramNumber,
int Pid,
int StreamType);
401 virtual void SetPid(
int Pid,
bool Active);
520 void Reset(
int CamSlotNumber);
527 void Load(
const char *FileName);
533 bool CamResponsesLoad(
const char *FileName,
bool AllowComments =
false,
bool MustExist =
false);
virtual cCiSession * GetNewCiSession(uint32_t ResourceId, uint16_t SessionId, cCiTransportConnection *Tc)=0
Returns a new cCiSession, according to the given ResourceId.
virtual bool Reset(int Slot)
Resets the CAM in the given Slot.
bool Devices(cVector< int > &DeviceNumbers)
Adds the numbers of any devices that currently use this CAM to the given DeviceNumbers.
cCaPidReceiver * caPidReceiver
cChannelCamRelations ChannelCamRelations
void AddCamSlot(cCamSlot *CamSlot)
Adds the given CamSlot to this CI adapter.
cCiTransportConnection * Tc(void)
bool CamDecrypt(tChannelID ChannelID, int CamSlotNumber)
void KeepSharedCaPids(int ProgramNumber, const int *CaSystemIds, int *CaPids)
int MtdPutData(uchar *Data, int Count)
Sends at most Count bytes of the given Data to the individual MTD CAM slots that are using this CAM.
cCiTransportConnection * tc
cCaActivationReceiver * caActivationReceiver
uint32_t ResourceId(void)
int GetTag(int &Length, const uint8_t **Data)
cCiCaPmt * Add(uint8_t CmdId, int Source, int Transponder, int ProgramNumber, const int *CaSystemIds)
void Load(const char *FileName)
virtual cCiMenu * GetMenu(void)
Gets a pending menu, or NULL if there is no menu.
void SendData(int Tag, int Length=0, const uint8_t *Data=NULL)
virtual bool HasMMI(void)
Returns 'true' if the CAM in this slot has an active MMI.
cCamSlot * camSlots[MAX_CAM_SLOTS_PER_ADAPTER]
virtual void SendCaPmt(uint8_t CmdId)
bool WaitForAllCamSlotsReady(int Timeout=0)
Waits until all CAM slots have become ready, or the given Timeout (seconds) has expired.
void ClrChecked(tChannelID ChannelID, int CamSlotNumber)
eModuleStatus lastModuleStatus
void SendCaPmts(cCiCaPmtList &CaPmtList)
Sends the given list of CA_PMTs to the CAM.
virtual eModuleStatus ModuleStatus(int Slot)
Returns the status of the CAM in the given Slot.
int SlotIndex(void)
Returns the index of this CAM slot within its CI adapter.
cCamSlot(cCiAdapter *CiAdapter, bool WantsTsData=false, cCamSlot *MasterSlot=NULL)
Creates a new CAM slot for the given CiAdapter.
virtual void AddPid(int ProgramNumber, int Pid, int StreamType)
Adds the given PID information to the list of PIDs.
cCiSession * GetNewCiSession(uint32_t ResourceId, uint16_t SessionId, cCiTransportConnection *Tc)
void SetResourceId(uint32_t Id)
If this is a class that has been derived from an existing cCiSession class, but implements a differen...
virtual void StartDecrypting(void)
Sends all CA_PMT entries to the CAM that have been modified since the last call to this function.
virtual bool EnterMenu(void)
Requests the CAM in this slot to start its menu.
void SetDecrypt(tChannelID ChannelID, int CamSlotNumber)
virtual cCiEnquiry * GetEnquiry(void)
Gets a pending enquiry, or NULL if there is no enquiry.
virtual ~cCiResourceHandler()
virtual const int * GetCaSystemIds(void)
virtual bool Assign(cDevice *Device, bool Query=false)
Assigns this adapter to the given Device, if this is possible.
void SetChecked(tChannelID ChannelID, int CamSlotNumber)
virtual void CancelActivation(void)
Cancels a previously started activation (if any).
virtual void Process(int Length=0, const uint8_t *Data=NULL)
cCiSession(uint16_t SessionId, uint32_t ResourceId, cCiTransportConnection *Tc)
void BuildCaPmts(uint8_t CmdId, cCiCaPmtList &CaPmtList, cMtdMapper *MtdMapper=NULL)
Generates all CA_PMTs with the given CmdId and stores them in the given CaPmtList.
void Del(cCiCaPmt *CaPmt)
virtual bool Reset(void)
Resets the CAM in this slot.
bool CamChecked(tChannelID ChannelID, int CamSlotNumber)
bool WantsTsData(void) const
Returns true if this CAM slot wants to receive the TS data through its Decrypt() function.
#define MAX_CAM_SLOTS_PER_ADAPTER
virtual void SetPid(int Pid, bool Active)
Sets the given Pid (which has previously been added through a call to AddPid()) to Active.
virtual bool Assign(cDevice *Device, bool Query=false)
Assigns this CAM slot to the given Device, if this is possible.
void Reply(const char *s)
cList< cCiCaProgramData > caProgramList
cCiTransportConnection * tc[MAX_CONNECTIONS_PER_CAM_SLOT+1]
virtual eModuleStatus ModuleStatus(void)
Returns the status of the CAM in this slot.
virtual const uint32_t * ResourceIds(void) const =0
Returns a pointer to an array of resource identifiers, where the last value is zero.
cCiResourceHandlers CiResourceHandlers
virtual ~cCiAdapter()
The derived class must call Cancel(3) in its destructor.
virtual void Write(const uint8_t *Buffer, int Length)
Writes Length bytes of the given Buffer.
const uint8_t * GetData(const uint8_t *Data, int &Length)
virtual bool IsActivating(void)
Returns true if this CAM slot is currently activating a smart card.
int MasterSlotNumber(void)
Returns the number of this CAM's master slot within the whole system.
bool IsMasterSlot(void)
Returns true if this CAM slot itself is a master slot (which means that it doesn't have a pointer to ...
virtual bool ProvidesCa(const int *CaSystemIds)
Returns true if the CAM in this slot provides one of the given CaSystemIds.
virtual void Action(void)
Handles the attached CAM slots in a separate thread.
virtual const char * GetCamName(void)
Returns the name of the CAM in this slot, or NULL if there is no ready CAM in this slot.
virtual bool HasUserIO(void)
Returns true if there is a pending user interaction, which shall be retrieved via GetMenu() or GetEnq...
virtual bool TsPostProcess(uchar *Data)
If there is a cCiSession that needs to do additional processing on TS packets (after the CAM has done...
virtual bool TsPostProcess(uint8_t *TsPacket)
If this cCiSession needs to do additional processing on TS packets (after the CAM has done the decryp...
void TriggerResendPmt(void)
Tells this CAM slot to resend the list of CA_PMTs to the CAM.
virtual bool RepliesToQuery(void)
Returns true if the CAM in this slot replies to queries and thus supports MCD ("Multi Channel Decrypt...
void Process(cTPDU *TPDU=NULL)
cCamSlot * MtdSpawn(void)
If this CAM slot can do MTD ("Multi Transponder Decryption"), a call to this function returns a cMtdC...
cVector< uint32_t > resourceIds
int NumReadyMasterSlots(void)
Returns the number of master CAM slots in the system that are ready to decrypt.
bool McdAvailable(void)
Returns true if this CAM supports MCD ("Multi Channel Decyption").
cCamSlot * ItCamSlot(int &Iter)
Iterates over all added CAM slots of this adapter.
cCamSlot * MasterSlot(void)
Returns this CAM slot's master slot, or a pointer to itself if it is a master slot.
virtual void AddChannel(const cChannel *Channel)
Adds all PIDs of the given Channel to the current list of PIDs.
cCiResourceHandlers(void)
Creates the default list of resourceIds.
void Reset(int CamSlotNumber)
virtual void StartActivation(void)
Puts the CAM in this slot into a mode where an inserted smart card can be activated.
virtual bool IsDecrypting(void)
Returns true if the CAM in this slot is currently used for decrypting.
void Register(cCiResourceHandler *ResourceHandler)
Adds the given ResourceHandler to the list of resource handlers and appends its ResourceIds to the gl...
cChannelCamRelation * GetEntry(tChannelID ChannelID)
cMtdMapper * MtdMapper(void)
virtual bool CanActivate(void)
Returns true if there is a CAM in this slot that can be put into activation mode.
void DeleteAllConnections(void)
void MtdEnable(void)
Enables MTD support for this CAM.
cVector< cCiCaPmt * > caPmts
bool CamResponsesLoad(const char *FileName, bool AllowComments=false, bool MustExist=false)
bool MtdAvailable(void)
Returns true if this CAM supports MTD ("Multi Transponder Decryption").
virtual bool CanDecrypt(const cChannel *Channel, cMtdMapper *MtdMapper=NULL)
Returns true if there is a CAM in this slot that is able to decrypt the given Channel (or at least cl...
void MtdActivate(bool On)
Activates (On == true) or deactivates (On == false) MTD.
virtual void InjectEit(int Sid)
Injects a generated EIT with a "present event" for the given Sid into the TS data stream sent to the ...
virtual bool HasUserIO(void)
cDevice * Device(void)
Returns the device this CAM slot is currently assigned to.
virtual bool Inject(uchar *Data, int Count)
Sends all Count bytes of the given Data to the CAM, and returns true if this was possible.
void SetTsPostProcessor(void)
If this cCiSession implements the TsPostProcess() function, it shall call SetTsPostProcessor() to reg...
int SlotNumber(void)
Returns the number of this CAM slot within the whole system.
virtual uchar * Decrypt(uchar *Data, int &Count)
If this is a CAM slot that can be freely assigned to any device, but will not be directly inserted in...
bool MtdActive(void)
Returns true if MTD is currently active.
cChannelCamRelations(void)
cCiSession * GetSessionByResourceId(uint32_t ResourceId)
void ClrDecrypt(tChannelID ChannelID, int CamSlotNumber)
cCiResourceHandler(void)
Creates a new resource handler, through which the available resources can be provides.
virtual int Read(uint8_t *Buffer, int MaxLength)
Reads one chunk of data into the given Buffer, up to MaxLength bytes.
cChannelCamRelation * AddEntry(tChannelID ChannelID)
int Priority(void)
Returns the priority of the device this slot is currently assigned to, or IDLEPRIORITY if it is not a...
virtual bool Ready(void)
Returns 'true' if the CAM in this slot is ready to decrypt.
#define MAX_CONNECTIONS_PER_CAM_SLOT
virtual void StopDecrypting(void)
Clears the list of CA_PMT entries and tells the CAM to stop decrypting.
const uint32_t * Ids(void)