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);
92 virtual const uint32_t *ResourceIds(
void)
const = 0;
110 const uint32_t *
Ids(
void) {
return &resourceIds[0]; }
123 enum { MAX_CIMENU_ENTRIES = 64 };
130 char *entries[MAX_CIMENU_ENTRIES];
132 bool AddEntry(
char *s);
139 const char *
Entry(
int n) {
return n < numEntries ? entries[n] : NULL; }
142 void Select(
int Index);
145 bool HasUpdate(
void);
160 const char *
Text(
void) {
return text; }
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);
349 virtual bool Reset(
void);
374 virtual bool Ready(
void);
376 virtual bool HasMMI(
void);
390 virtual bool ProvidesCa(
const int *CaSystemIds);
397 virtual void AddPid(
int ProgramNumber,
int Pid,
int StreamType);
400 virtual void SetPid(
int Pid,
bool Active);
494 int NumReadyMasterSlots(
void);
497 bool WaitForAllCamSlotsReady(
int Timeout = 0);
519 void Reset(
int CamSlotNumber);
520 bool CamChecked(
tChannelID ChannelID,
int CamSlotNumber);
521 bool CamDecrypt(
tChannelID ChannelID,
int CamSlotNumber);
522 void SetChecked(
tChannelID ChannelID,
int CamSlotNumber);
523 void SetDecrypt(
tChannelID ChannelID,
int CamSlotNumber);
524 void ClrChecked(
tChannelID ChannelID,
int CamSlotNumber);
525 void ClrDecrypt(
tChannelID ChannelID,
int CamSlotNumber);
526 void Load(
const char *FileName);
532 bool CamResponsesLoad(
const char *FileName,
bool AllowComments =
false,
bool MustExist =
false);
cCamSlot * MtdSpawn(void)
If this CAM slot can do MTD ("Multi Transponder Decryption"), a call to this function returns a cMtdC...
bool Devices(cVector< int > &CardIndexes)
Adds the card indexes of any devices that currently use this CAM to the given CardIndexes.
cVector< cCiCaPmt * > caPmts
int MasterSlotNumber(void)
Returns the number of this CAM's master slot within the whole system.
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 ...
const uint32_t * Ids(void)
virtual void StartActivation(void)
Puts the CAM in this slot into a mode where an inserted smart card can be activated.
cCiSession(uint16_t SessionId, uint32_t ResourceId, cCiTransportConnection *Tc)
void TriggerResendPmt(void)
Tells this CAM slot to resend the list of CA_PMTs to the CAM.
virtual void AddPid(int ProgramNumber, int Pid, int StreamType)
Adds the given PID information to the list of PIDs.
virtual void Write(const uint8_t *Buffer, int Length)
Writes Length bytes of the given Buffer.
#define MAX_CONNECTIONS_PER_CAM_SLOT
virtual const int * GetCaSystemIds(void)
cChannelCamRelations ChannelCamRelations
void MtdActivate(bool On)
Activates (On == true) or deactivates (On == false) MTD.
#define MAX_CAM_SLOTS_PER_ADAPTER
bool MtdAvailable(void)
Returns true if this CAM supports MTD ("Multi Transponder Decryption").
cCiResourceHandlers CiResourceHandlers
void MtdEnable(void)
Enables MTD support for this CAM.
virtual bool CanActivate(void)
Returns true if there is a CAM in this slot that can be put into activation mode. ...
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.
int GetTag(int &Length, const uint8_t **Data)
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 eModuleStatus ModuleStatus(void)
Returns the status of the CAM in this slot.
int SlotIndex(void)
Returns the index of this CAM slot within its CI adapter.
void SetTsPostProcessor(void)
If this cCiSession implements the TsPostProcess() function, it shall call SetTsPostProcessor() to reg...
virtual bool HasUserIO(void)
bool WantsTsData(void) const
Returns true if this CAM slot wants to receive the TS data through its Decrypt() function.
virtual void AddChannel(const cChannel *Channel)
Adds all PIDs of the given Channel to the current list of PIDs.
uint32_t ResourceId(void)
bool McdAvailable(void)
Returns true if this CAM supports MCD ("Multi Channel Decyption").
virtual bool Reset(int Slot)
Resets the CAM in the given Slot.
cCaActivationReceiver * caActivationReceiver
virtual bool Ready(void)
Returns 'true' if the CAM in this slot is ready to decrypt.
virtual bool EnterMenu(void)
Requests the CAM in this slot to start its menu.
cCiTransportConnection * tc
cCiSession * GetSessionByResourceId(uint32_t ResourceId)
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...
void SendData(int Tag, int Length=0, const uint8_t *Data=NULL)
virtual void StartDecrypting(void)
Sends all CA_PMT entries to the CAM that have been modified since the last call to this function...
cList< cCiCaProgramData > caProgramList
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...
virtual bool ProvidesCa(const int *CaSystemIds)
Returns true if the CAM in this slot provides one of the given CaSystemIds.
cVector< uint32_t > resourceIds
virtual int Read(uint8_t *Buffer, int MaxLength)
Reads one chunk of data into the given Buffer, up to MaxLength bytes.
eModuleStatus lastModuleStatus
virtual bool Reset(void)
Resets the CAM in this slot.
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.
cCiTransportConnection * Tc(void)
virtual void StopDecrypting(void)
Clears the list of CA_PMT entries and tells the CAM to stop decrypting.
cCamSlot * MasterSlot(void)
Returns this CAM slot's master slot, or a pointer to itself if it is a master slot.
bool CamResponsesLoad(const char *FileName, bool AllowComments=false, bool MustExist=false)
virtual bool HasMMI(void)
Returns 'true' if the CAM in this slot has an active MMI.
void SendCaPmts(cCiCaPmtList &CaPmtList)
Sends the given list of CA_PMTs to the CAM.
virtual cCiMenu * GetMenu(void)
Gets a pending menu, or NULL if there is no menu.
virtual bool IsDecrypting(void)
Returns true if the CAM in this slot is currently used for decrypting.
virtual void SetPid(int Pid, bool Active)
Sets the given Pid (which has previously been added through a call to AddPid()) to Active...
virtual void Process(int Length=0, const uint8_t *Data=NULL)
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 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...
virtual cCiEnquiry * GetEnquiry(void)
Gets a pending enquiry, or NULL if there is no enquiry.
virtual eModuleStatus ModuleStatus(int Slot)
Returns the status of the CAM in the given Slot.
bool MtdActive(void)
Returns true if MTD is currently active.
cCaPidReceiver * caPidReceiver
virtual void CancelActivation(void)
Cancels a previously started activation (if any).
int Priority(void)
Returns the priority of the device this slot is currently assigned to, or IDLEPRIORITY if it is not a...
virtual bool TsPostProcess(uint8_t *TsPacket)
If this cCiSession needs to do additional processing on TS packets (after the CAM has done the decryp...
const uint8_t * GetData(const uint8_t *Data, int &Length)
cCamSlot(cCiAdapter *CiAdapter, bool WantsTsData=false, cCamSlot *MasterSlot=NULL)
Creates a new CAM slot for the given CiAdapter.
virtual bool Assign(cDevice *Device, bool Query=false)
Assigns this adapter to the given Device, if this is possible.
virtual bool Assign(cDevice *Device, bool Query=false)
Assigns this CAM slot to the given Device, if this is possible.
virtual bool IsActivating(void)
Returns true if this CAM slot is currently activating a smart card.
cMtdMapper * MtdMapper(void)
virtual void SendCaPmt(uint8_t CmdId)
void DeleteAllConnections(void)
void SetResourceId(uint32_t Id)
If this is a class that has been derived from an existing cCiSession class, but implements a differen...
int SlotNumber(void)
Returns the number of this CAM slot within the whole system.
cDevice * Device(void)
Returns the device this CAM slot is currently assigned to.
virtual bool RepliesToQuery(void)
Returns true if the CAM in this slot replies to queries and thus supports MCD ("Multi Channel Decrypt...