vdr 2.8.3
cCamSlot Class Reference

#include <ci.h>

Public Member Functions

bool McdAvailable (void)
bool MtdAvailable (void)
bool MtdActive (void)
 cCamSlot (cCiAdapter *CiAdapter, bool WantsTsData=false, cCamSlot *MasterSlot=NULL)
virtual ~cCamSlot () override
bool IsMasterSlot (void)
cCamSlot * MasterSlot (void)
cCamSlot * MtdSpawn (void)
void TriggerResendPmt (void)
virtual bool Assign (cDevice *Device, bool Query=false)
cDevice * Device (void)
bool Devices (cVector< int > &DeviceNumbers)
bool WantsTsData (void) const
int SlotIndex (void)
int SlotNumber (void)
int MasterSlotNumber (void)
virtual bool Reset (void)
virtual bool CanActivate (void)
virtual void StartActivation (void)
virtual void CancelActivation (void)
virtual bool IsActivating (void)
virtual eModuleStatus ModuleStatus (void)
virtual const char * GetCamName (void)
virtual bool Ready (void)
virtual bool HasMMI (void)
virtual bool HasUserIO (void)
virtual bool EnterMenu (void)
virtual cCiMenu * GetMenu (void)
virtual cCiEnquiry * GetEnquiry (void)
int Priority (void)
virtual bool ProvidesCa (const int *CaSystemIds)
virtual void AddPid (int ProgramNumber, int Pid, int StreamType)
virtual void SetPid (int Pid, bool Active)
virtual void AddChannel (const cChannel *Channel)
virtual bool CanDecrypt (const cChannel *Channel, cMtdMapper *MtdMapper=NULL)
virtual void StartDecrypting (void)
virtual void StopDecrypting (void)
virtual bool IsDecrypting (void)
virtual uchar * Decrypt (uchar *Data, int &Count)
virtual bool TsPostProcess (uchar *Data)
virtual bool Inject (uchar *Data, int Count)
virtual void InjectEit (int Sid)
Public Member Functions inherited from cListObject
 cListObject (void)
virtual ~cListObject ()
virtual int Compare (const cListObject &ListObject) const
void Append (cListObject *Object)
void Insert (cListObject *Object)
void Unlink (void)
int Index (void) const
cListObject * Prev (void) const
cListObject * Next (void) const

Protected Member Functions

virtual const int * GetCaSystemIds (void)
virtual void SendCaPmt (uint8_t CmdId)
virtual bool RepliesToQuery (void)
void BuildCaPmts (uint8_t CmdId, cCiCaPmtList &CaPmtList, cMtdMapper *MtdMapper=NULL)
void SendCaPmts (cCiCaPmtList &CaPmtList)
void MtdEnable (void)
int MtdPutData (uchar *Data, int Count)

Private Member Functions

void KeepSharedCaPids (int ProgramNumber, const int *CaSystemIds, int *CaPids)
void NewConnection (void)
void DeleteAllConnections (void)
void Process (cTPDU *TPDU=NULL)
void Write (cTPDU *TPDU)
cCiSession * GetSessionByResourceId (uint32_t ResourceId)
void MtdActivate (bool On)

Private Attributes

cMutex mutex
cMutex assignMutex
cCondVar processed
cCiAdapter * ciAdapter
cCamSlot * masterSlot
std::atomic< cDevice * > assignedDevice
cCaPidReceiver * caPidReceiver
cCaActivationReceiver * caActivationReceiver
int slotIndex
int slotNumber
cCiTransportConnection * tc [MAX_CONNECTIONS_PER_CAM_SLOT+1]
eModuleStatus lastModuleStatus
time_t resetTime
cTimeMs moduleCheckTimer
bool resendPmt
int source
int transponder
cList< cCiCaProgramData > caProgramList
bool mtdAvailable
cMtdHandler * mtdHandler

Friends

class cCiAdapter
class cCiTransportConnection
class cCiConditionalAccessSupport
class cMtdCamSlot

Detailed Description

Definition at line 233 of file ci.h.

Constructor & Destructor Documentation

◆ cCamSlot()

cCamSlot::cCamSlot ( cCiAdapter * CiAdapter,
bool WantsTsData = false,
cCamSlot * MasterSlot = NULL )

Creates a new CAM slot for the given CiAdapter.

The CiAdapter will take care of deleting the CAM slot, so the caller must not delete it! If WantsTsData is true, the device this CAM slot is assigned to will call the Decrypt() function of this CAM slot, presenting it the complete TS data stream of the encrypted programme, including the CA pids. If this CAM slot is basically the same as an other one, MasterSlot can be given to indicate this. This can be used for instance for CAM slots that can do MTD ("Multi Transponder Decryption"), where the first cCamSlot is created without giving a MasterSlot, and all others are given the first one as their MasterSlot. This can speed up the search for a suitable CAM when tuning to an encrypted channel, and it also makes the Setup/CAM menu clearer because only the master CAM slots will be shown there.

Definition at line 2178 of file ci.c.

References cListBase::Add(), cCiAdapter::AddCamSlot(), assignedDevice, caActivationReceiver, CamSlots, caPidReceiver, cCamSlot(), cCiAdapter, ciAdapter, cListObject::Index(), lastModuleStatus, MasterSlot(), masterSlot, MAX_CONNECTIONS_PER_CAM_SLOT, msReset, mtdAvailable, mtdHandler, resendPmt, Reset(), resetTime, slotIndex, SlotNumber(), slotNumber, tc, and WantsTsData().

Referenced by cCamSlot(), cDvbCiAdapter::cDvbCiAdapter(), cMtdCamSlot::cMtdCamSlot(), MasterSlot(), MtdSpawn(), and cMtdCamSlot::Spawn().

◆ ~cCamSlot()

cCamSlot::~cCamSlot ( )
overridevirtual

Member Function Documentation

◆ AddChannel()

void cCamSlot::AddChannel ( const cChannel * Channel)
virtual

Adds all PIDs of the given Channel to the current list of PIDs.

If the source or transponder of the channel are different than what was given in a previous call to AddChannel(), any previously added PIDs will be cleared.

Definition at line 2733 of file ci.c.

References AddPid(), cChannel::Apids(), cChannel::Ca(), CA_ENCRYPTED_MIN, cChannel::Dpids(), mutex, cChannel::Sid(), cChannel::Source(), source, cChannel::Spids(), StopDecrypting(), STREAM_TYPE_AUDIO, STREAM_TYPE_PRIVATE, STREAM_TYPE_VIDEO, cChannel::Transponder(), transponder, and cChannel::Vpid().

◆ AddPid()

void cCamSlot::AddPid ( int ProgramNumber,
int Pid,
int StreamType )
virtual

Adds the given PID information to the list of PIDs.

A later call to SetPid() will (de)activate one of these entries.

Definition at line 2692 of file ci.c.

References cListBase::Add(), caProgramList, cCiCaPidData::cCiCaPidData(), cCiCaProgramData::cCiCaProgramData(), cList< T >::First(), mutex, cList< T >::Next(), cListObject::Next(), and cCiCaProgramData::pidList.

Referenced by AddChannel().

◆ Assign()

bool cCamSlot::Assign ( cDevice * Device,
bool Query = false )
virtual

Assigns this CAM slot to the given Device, if this is possible.

If Query is 'true', the CI adapter of this slot only checks whether it can be assigned to the Device, but doesn't actually assign itself to it. Returns true if this slot can be assigned to the Device. If Device is NULL, the slot will be unassigned from any device it was previously assigned to. The value of Query is ignored in that case, and this function always returns 'true'. If a derived class reimplements this function, it can return 'false' if this CAM can't be assigned to the given Device. If the CAM can be assigned to the Device, or if Device is NULL, it must call the base class function.

Definition at line 2221 of file ci.c.

References cCiAdapter::Assign(), assignedDevice, assignMutex, cDevice::AttachReceiver(), CancelActivation(), caPidReceiver, ciAdapter, cDevice::Detach(), Device(), cDevice::DeviceNumber(), dsyslog, MasterSlotNumber(), mutex, cCaPidReceiver::Reset(), cDevice::SetCamSlot(), and StopDecrypting().

Referenced by cMenuSetupCAM::Activate(), cDevice::GetDevice(), Process(), ~cCamSlot(), and cMtdCamSlot::~cMtdCamSlot().

◆ BuildCaPmts()

void cCamSlot::BuildCaPmts ( uint8_t CmdId,
cCiCaPmtList & CaPmtList,
cMtdMapper * MtdMapper = NULL )
protected

◆ CanActivate()

bool cCamSlot::CanActivate ( void )
virtual

Returns true if there is a CAM in this slot that can be put into activation mode.

Definition at line 2406 of file ci.c.

References ModuleStatus(), and msReady.

Referenced by cMenuSetupCAM::Activate(), and cMenuSetupCAM::SetHelpKeys().

◆ CancelActivation()

void cCamSlot::CancelActivation ( void )
virtual

Cancels a previously started activation (if any).

Definition at line 2426 of file ci.c.

References caActivationReceiver, cMtdHandler::CancelActivation(), mtdHandler, and mutex.

Referenced by cMenuSetupCAM::Activate(), Assign(), and Process().

◆ CanDecrypt()

bool cCamSlot::CanDecrypt ( const cChannel * Channel,
cMtdMapper * MtdMapper = NULL )
virtual

Returns true if there is a CAM in this slot that is able to decrypt the given Channel (or at least claims to be able to do so).

Since the QUERY/REPLY mechanism for CAMs is pretty unreliable (some CAMs don't reply to queries at all), we always return true if the CAM is currently not decrypting anything. If there is already a channel being decrypted, a call to CanDecrypt() checks whether the CAM can also decrypt the given channel. Only CAMs that have replied to the initial QUERY will perform this check at all. CAMs that never replied to the initial QUERY are assumed not to be able to handle more than one channel at a time. If MtdMapper is given, all SIDs and PIDs will be mapped accordingly.

Reimplemented in cMtdCamSlot.

Definition at line 2753 of file ci.c.

References cCiCaPmt::AddPid(), cChannel::Apids(), cChannel::Ca(), CA_ENCRYPTED_MIN, cCiConditionalAccessSupport::CanDecrypt(), cCiConditionalAccessSupport, CPCI_QUERY, CPLM_ADD, cChannel::Dpids(), dsyslog, GetCaSystemIds(), GetSessionByResourceId(), IsDecrypting(), cCiCaPmt::MtdMapPids(), mutex, processed, QUERY_REPLY_TIMEOUT, QUERY_REPLY_WAIT, cCiConditionalAccessSupport::ReceivedReply(), cCiConditionalAccessSupport::RepliesToQuery(), RI_CONDITIONAL_ACCESS_SUPPORT, cCiConditionalAccessSupport::SendPMT(), cCiCaPmt::SetListManagement(), cChannel::Sid(), SlotNumber(), cChannel::Source(), cChannel::Spids(), STREAM_TYPE_AUDIO, STREAM_TYPE_PRIVATE, STREAM_TYPE_VIDEO, cTimeMs::TimedOut(), cCondVar::TimedWait(), cChannel::Transponder(), and cChannel::Vpid().

Referenced by cMtdCamSlot::CanDecrypt().

◆ Decrypt()

uchar * cCamSlot::Decrypt ( uchar * Data,
int & Count )
virtual

If this is a CAM slot that can be freely assigned to any device, but will not be directly inserted into the full TS data stream in hardware, it can implement this function to be given access to the data in the device's TS buffer.

Data points to a buffer of Count bytes of TS data. The first byte in Data is guaranteed to be a TS_SYNC_BYTE, and Count is at least TS_SIZE. Note that Decrypt() may be called with Data == NULL! This is necessary to allow CAMs that copy the incoming data into a separate buffer to return previously received and decrypted TS packets. If Data is NULL, Count is 0 and must not be modified, and the return value shall point to the next available decrypted TS packet (if any). There are three possible ways a CAM can handle decryption:

  1. If the full TS data is physically routed through the CAM in hardware, there is no need to reimplement this function. The default implementation simply sets Count to TS_SIZE and returns Data.
  2. If the CAM works directly on Data and decrypts the TS "in place" it shall decrypt at least the very first TS packet in Data, set Count to TS_SIZE and return Data. It may decrypt as many TS packets in Data as it wants, but it must decrypt at least the very first TS packet (if at all possible - if, for whatever reasons, it can't decrypt the very first packet, it must return it regardless). Only this very first TS packet will be further processed after the call to this function. The next call will be done with Data pointing to the TS packet immediately following the previous one.
  3. If the CAM needs to copy the data into a buffer of its own, and/or send the data to some file handle for processing and later retrieval, it shall set Count to the number of bytes it has read from Data and return a pointer to the next available decrypted TS packet (which will not be in the memory area pointed to by Data, but rather in some buffer that is under the CAM's control). If no decrypted TS packet is currently available, NULL shall be returned. If no data from Data can currently be processed, Count shall be set to 0 and the same Data pointer will be offered in the next call to Decrypt(). See mtd.h for further requirements if this CAM can do MTD ("Multi Transponder Decryption"). A derived class that implements this function will also need to set the WantsTsData parameter in the call to the base class constructor to true in order to receive the TS data.

Reimplemented in cMtdCamSlot.

Definition at line 2826 of file ci.c.

References TS_SIZE.

Referenced by cMtdCamSlot::Decrypt(), and cMtdCamSlot::PutCat().

◆ DeleteAllConnections()

void cCamSlot::DeleteAllConnections ( void )
private

Definition at line 2298 of file ci.c.

References MAX_CONNECTIONS_PER_CAM_SLOT, mutex, and tc.

Referenced by Process(), Reset(), and ~cCamSlot().

◆ Device()

cDevice * cCamSlot::Device ( void )
inline

Returns the device this CAM slot is currently assigned to.

Definition at line 334 of file ci.h.

References assignedDevice.

Referenced by Assign(), cDevice::GetDevice(), Priority(), cMenuSetupCAM::Reset(), and StartActivation().

◆ Devices()

bool cCamSlot::Devices ( cVector< int > & DeviceNumbers)

Adds the numbers of any devices that currently use this CAM to the given DeviceNumbers.

This can be more than one in case of MTD. Returns true if the array is not empty.

Definition at line 2275 of file ci.c.

References cVector< T >::Append(), assignedDevice, cMtdHandler::Devices(), mtdHandler, mutex, and cVector< T >::Size().

Referenced by cMenuSetupCAMItem::Changed().

◆ EnterMenu()

bool cCamSlot::EnterMenu ( void )
virtual

Requests the CAM in this slot to start its menu.

Reimplemented in cMtdCamSlot.

Definition at line 2481 of file ci.c.

References cCiApplicationInformation::EnterMenu(), GetSessionByResourceId(), mutex, and RI_APPLICATION_INFORMATION.

Referenced by cMenuSetupCAM::Menu().

◆ GetCamName()

const char * cCamSlot::GetCamName ( void )
virtual

Returns the name of the CAM in this slot, or NULL if there is no ready CAM in this slot.

Reimplemented in cMtdCamSlot.

Definition at line 2458 of file ci.c.

References cCiTransportConnection::GetCamName(), mutex, and tc.

Referenced by cMenuSetupCAMItem::Changed(), and cMenuCam::GenerateTitle().

◆ GetCaSystemIds()

const int * cCamSlot::GetCaSystemIds ( void )
protectedvirtual

◆ GetEnquiry()

cCiEnquiry * cCamSlot::GetEnquiry ( void )
virtual

Gets a pending enquiry, or NULL if there is no enquiry.

Reimplemented in cMtdCamSlot.

Definition at line 2501 of file ci.c.

References cCiMMI::Enquiry(), GetSessionByResourceId(), mutex, cCiEnquiry::mutex, and RI_MMI.

Referenced by cMenuCam::QueryCam().

◆ GetMenu()

cCiMenu * cCamSlot::GetMenu ( void )
virtual

Gets a pending menu, or NULL if there is no menu.

Reimplemented in cMtdCamSlot.

Definition at line 2488 of file ci.c.

References GetSessionByResourceId(), cCiMMI::Menu(), mutex, cCiMenu::mutex, and RI_MMI.

Referenced by cMenuCam::QueryCam().

◆ GetSessionByResourceId()

cCiSession * cCamSlot::GetSessionByResourceId ( uint32_t ResourceId)
private

◆ HasMMI()

bool cCamSlot::HasMMI ( void )
virtual

Returns 'true' if the CAM in this slot has an active MMI.

Reimplemented in cMtdCamSlot.

Definition at line 2470 of file ci.c.

References GetSessionByResourceId(), and RI_MMI.

Referenced by cMenuCam::ProcessKey().

◆ HasUserIO()

bool cCamSlot::HasUserIO ( void )
virtual

Returns true if there is a pending user interaction, which shall be retrieved via GetMenu() or GetEnquiry().

Reimplemented in cMtdCamSlot.

Definition at line 2475 of file ci.c.

References cCiTransportConnection::HasUserIO(), mutex, and tc.

Referenced by cMenuSetupCAM::Menu(), and cMenuCam::QueryCam().

◆ Inject()

bool cCamSlot::Inject ( uchar * Data,
int Count )
virtual

Sends all Count bytes of the given Data to the CAM, and returns true if this was possible.

If the data can't be sent to the CAM completely, nothing shall be sent and the return value shall be false. No decrypted packet is returned by this function. Data is guaranteed to point to one or more complete TS packets.

Definition at line 2838 of file ci.c.

Referenced by InjectEit().

◆ InjectEit()

void cCamSlot::InjectEit ( int Sid)
virtual

Injects a generated EIT with a "present event" for the given Sid into the TS data stream sent to the CAM.

This only applies to CAM slots that have WantsTsData set to true in their constructor. The default implementation sends an EIT with the minimum event necessary to disable the CAMs parental rating prompt.

Reimplemented in cMtdCamSlot.

Definition at line 2843 of file ci.c.

References cEitGenerator::Data(), Inject(), and cEitGenerator::Length().

Referenced by cDevice::Action(), and cMtdCamSlot::InjectEit().

◆ IsActivating()

bool cCamSlot::IsActivating ( void )
virtual

Returns true if this CAM slot is currently activating a smart card.

Definition at line 2437 of file ci.c.

References caActivationReceiver, cMtdHandler::IsActivating(), and mtdHandler.

Referenced by cDevice::Action(), cMenuSetupCAM::Activate(), cMenuSetupCAMItem::Changed(), and cMenuSetupCAM::SetHelpKeys().

◆ IsDecrypting()

bool cCamSlot::IsDecrypting ( void )
virtual

Returns true if the CAM in this slot is currently used for decrypting.

Definition at line 2808 of file ci.c.

References caProgramList, cListBase::Count(), cList< T >::First(), cMtdHandler::IsDecrypting(), mtdHandler, mutex, cList< T >::Next(), and cListObject::Next().

Referenced by CanDecrypt(), cDevice::GetDevice(), and StopDecrypting().

◆ IsMasterSlot()

bool cCamSlot::IsMasterSlot ( void )
inline

Returns true if this CAM slot itself is a master slot (which means that it doesn't have a pointer to another CAM slot that's its master).

Definition at line 308 of file ci.h.

References masterSlot.

◆ KeepSharedCaPids()

void cCamSlot::KeepSharedCaPids ( int ProgramNumber,
const int * CaSystemIds,
int * CaPids )
private

◆ MasterSlot()

◆ MasterSlotNumber()

int cCamSlot::MasterSlotNumber ( void )
inline

Returns the number of this CAM's master slot within the whole system.

The first slot has the number 1.

Definition at line 349 of file ci.h.

References masterSlot, SlotNumber(), and slotNumber.

Referenced by cDevice::Action(), Assign(), cDevice::AttachReceiver(), DrawDeviceData(), cDevice::GetDevice(), and cCaActivationReceiver::Receive().

◆ McdAvailable()

bool cCamSlot::McdAvailable ( void )
inline

Returns true if this CAM supports MCD ("Multi Channel Decyption").

Definition at line 286 of file ci.h.

References RepliesToQuery().

Referenced by MtdActivate().

◆ ModuleStatus()

eModuleStatus cCamSlot::ModuleStatus ( void )
virtual

Returns the status of the CAM in this slot.

Reimplemented in cMtdCamSlot.

Definition at line 2444 of file ci.c.

References ciAdapter, MODULE_RESET_TIMEOUT, cCiAdapter::ModuleStatus(), msNone, msReset, mutex, resetTime, and slotIndex.

Referenced by CanActivate(), cMenuSetupCAMItem::Changed(), cDevice::GetDevice(), Process(), and Ready().

◆ MtdActivate()

void cCamSlot::MtdActivate ( bool On)
private

Activates (On == true) or deactivates (On == false) MTD.

Definition at line 2640 of file ci.c.

References dsyslog, McdAvailable(), MtdAvailable(), mtdHandler, and SlotNumber().

Referenced by cCiConditionalAccessSupport::Process().

◆ MtdActive()

bool cCamSlot::MtdActive ( void )
inline

Returns true if MTD is currently active.

Definition at line 290 of file ci.h.

References mtdHandler.

Referenced by cDevice::GetDevice().

◆ MtdAvailable()

bool cCamSlot::MtdAvailable ( void )
inline

Returns true if this CAM supports MTD ("Multi Transponder Decryption").

Definition at line 288 of file ci.h.

References mtdAvailable.

Referenced by MtdActivate().

◆ MtdEnable()

void cCamSlot::MtdEnable ( void )
protected

Enables MTD support for this CAM.

Note that actual MTD operation also requires a CAM that supports MCD ("Multi Channel Decryption").

Definition at line 2635 of file ci.c.

References mtdAvailable.

◆ MtdPutData()

int cCamSlot::MtdPutData ( uchar * Data,
int Count )
protected

Sends at most Count bytes of the given Data to the individual MTD CAM slots that are using this CAM.

Data must point to the beginning of a TS packet. Returns the number of bytes actually processed.

Definition at line 2657 of file ci.c.

References mtdHandler, and cMtdHandler::Put().

◆ MtdSpawn()

cCamSlot * cCamSlot::MtdSpawn ( void )

If this CAM slot can do MTD ("Multi Transponder Decryption"), a call to this function returns a cMtdCamSlot with this CAM slot as its master.

Otherwise a pointer to this object is returned, which means that MTD is not supported.

Definition at line 2213 of file ci.c.

References cCamSlot(), cMtdHandler::GetMtdCamSlot(), mtdHandler, and mutex.

Referenced by cMenuSetupCAM::Activate(), and cDevice::GetDevice().

◆ NewConnection()

void cCamSlot::NewConnection ( void )
private

◆ Priority()

int cCamSlot::Priority ( void )

Returns the priority of the device this slot is currently assigned to, or IDLEPRIORITY if it is not assigned to any device.

Definition at line 2669 of file ci.c.

References Device(), IDLEPRIORITY, mtdHandler, cDevice::Priority(), and cMtdHandler::Priority().

Referenced by cMenuSetupCAM::Activate(), and cDevice::GetDevice().

◆ Process()

◆ ProvidesCa()

bool cCamSlot::ProvidesCa ( const int * CaSystemIds)
virtual

Returns true if the CAM in this slot provides one of the given CaSystemIds.

This doesn't necessarily mean that it will be possible to actually decrypt such a programme, since CAMs usually advertise several CA system ids, while the actual decryption is controlled by the smart card inserted into the CAM.

Reimplemented in cMtdCamSlot.

Definition at line 2677 of file ci.c.

References cCiConditionalAccessSupport, cCiConditionalAccessSupport::GetCaSystemIds(), GetSessionByResourceId(), mutex, and RI_CONDITIONAL_ACCESS_SUPPORT.

Referenced by cDevice::GetDevice(), and cMtdCamSlot::ProvidesCa().

◆ Ready()

bool cCamSlot::Ready ( void )
virtual

Returns 'true' if the CAM in this slot is ready to decrypt.

Reimplemented in cMtdCamSlot.

Definition at line 2464 of file ci.c.

References ModuleStatus(), msNone, mutex, cCiTransportConnection::Ready(), and tc.

Referenced by Process().

◆ RepliesToQuery()

bool cCamSlot::RepliesToQuery ( void )
protectedvirtual

Returns true if the CAM in this slot replies to queries and thus supports MCD ("Multi Channel Decryption").

Reimplemented in cMtdCamSlot.

Definition at line 2533 of file ci.c.

References cCiConditionalAccessSupport, GetSessionByResourceId(), mutex, cCiConditionalAccessSupport::RepliesToQuery(), and RI_CONDITIONAL_ACCESS_SUPPORT.

Referenced by BuildCaPmts(), McdAvailable(), and cMtdCamSlot::RepliesToQuery().

◆ Reset()

bool cCamSlot::Reset ( void )
virtual

Resets the CAM in this slot.

Returns true if the operation was successful.

Reimplemented in cMtdCamSlot.

Definition at line 2388 of file ci.c.

References ChannelCamRelations, ciAdapter, dbgprotocol, DeleteAllConnections(), lastModuleStatus, msReset, mutex, cChannelCamRelations::Reset(), cCiAdapter::Reset(), resetTime, slotIndex, and slotNumber.

Referenced by cCamSlot(), Process(), and cMenuSetupCAM::Reset().

◆ SendCaPmt()

void cCamSlot::SendCaPmt ( uint8_t CmdId)
protectedvirtual

Reimplemented in cMtdCamSlot.

Definition at line 2627 of file ci.c.

References BuildCaPmts(), mutex, and SendCaPmts().

Referenced by StartDecrypting(), and StopDecrypting().

◆ SendCaPmts()

void cCamSlot::SendCaPmts ( cCiCaPmtList & CaPmtList)
protected

◆ SetPid()

void cCamSlot::SetPid ( int Pid,
bool Active )
virtual

Sets the given Pid (which has previously been added through a call to AddPid()) to Active.

A later call to StartDecrypting() will send the full list of currently active CA_PMT entries to the CAM.

Definition at line 2710 of file ci.c.

References caPidReceiver, caProgramList, cList< T >::First(), cCaPidReceiver::HandlingPid(), mutex, cList< T >::Next(), and cListObject::Next().

Referenced by cDevice::AddPid(), and cDevice::DelPid().

◆ SlotIndex()

int cCamSlot::SlotIndex ( void )
inline

Returns the index of this CAM slot within its CI adapter.

The first slot has an index of 0.

Definition at line 343 of file ci.h.

References slotIndex.

Referenced by cCiTransportConnection::cCiTransportConnection(), cCiTransportConnection::CloseSession(), cCiTransportConnection::HandleSessions(), cCiTransportConnection::OpenSession(), cCiTransportConnection::Process(), and cCiTransportConnection::SendTPDU().

◆ SlotNumber()

◆ StartActivation()

void cCamSlot::StartActivation ( void )
virtual

Puts the CAM in this slot into a mode where an inserted smart card can be activated.

The default action is to make IsActivating() return true, which causes the device this CAM slot is attached to to never automatically detach any receivers with negative priority if the PIDs they want to receive are not decrypted by the CAM. StartActivation() must be called after the CAM slot has been assigned to a device. The CAM slot will stay in activation mode until the CAM begins to decrypt, a call to CancelActivation() is made, or the device is needed for a recording.

Definition at line 2411 of file ci.c.

References caActivationReceiver, cCaActivationReceiver::cCaActivationReceiver(), cDevice::CurrentChannel(), Device(), dsyslog, LOCK_CHANNELS_READ, mutex, and SlotNumber().

Referenced by cMenuSetupCAM::Activate().

◆ StartDecrypting()

void cCamSlot::StartDecrypting ( void )
virtual

Sends all CA_PMT entries to the CAM that have been modified since the last call to this function.

This includes CA_PMTs that have been added or activated, as well as ones that have been deactivated. StartDecrypting() will be called whenever a PID is activated or deactivated.

Reimplemented in cMtdCamSlot.

Definition at line 2789 of file ci.c.

References CPCI_OK_DESCRAMBLING, and SendCaPmt().

Referenced by cDevice::AttachReceiver(), Process(), and cMtdCamSlot::StartDecrypting().

◆ StopDecrypting()

void cCamSlot::StopDecrypting ( void )
virtual

Clears the list of CA_PMT entries and tells the CAM to stop decrypting.

Note that this function is only called when there are no more PIDs for the CAM to decrypt. There is no symmetry between StartDecrypting() and StopDecrypting().

Reimplemented in cMtdCamSlot.

Definition at line 2794 of file ci.c.

References caProgramList, cListBase::Clear(), cMtdCamSlot, cListBase::Count(), CPCI_NOT_SELECTED, IsDecrypting(), MasterSlot(), mtdHandler, mutex, SendCaPmt(), and cMtdHandler::StopDecrypting().

Referenced by AddChannel(), Assign(), Process(), and cMtdCamSlot::StopDecrypting().

◆ TriggerResendPmt()

void cCamSlot::TriggerResendPmt ( void )
inline

Tells this CAM slot to resend the list of CA_PMTs to the CAM.

Definition at line 319 of file ci.h.

References resendPmt.

◆ TsPostProcess()

bool cCamSlot::TsPostProcess ( uchar * Data)
virtual

If there is a cCiSession that needs to do additional processing on TS packets (after the CAM has done the decryption), this function will call its TsPostProcess() function to have it do whatever operations are necessary on the given TsPacket.

Returns true if the TsPacket was in any way modified.

Reimplemented in cMtdCamSlot.

Definition at line 2833 of file ci.c.

References tc, and cCiTransportConnection::TsPostProcess().

Referenced by cDevice::Action(), and cMtdCamSlot::TsPostProcess().

◆ WantsTsData()

bool cCamSlot::WantsTsData ( void ) const
inline

Returns true if this CAM slot wants to receive the TS data through its Decrypt() function.

Definition at line 340 of file ci.h.

References caPidReceiver.

Referenced by cDevice::AttachReceiver(), cCamSlot(), and cDevice::SetChannel().

◆ Write()

void cCamSlot::Write ( cTPDU * TPDU)
private

◆ cCiAdapter

friend class cCiAdapter
friend

Definition at line 234 of file ci.h.

References cCiAdapter.

Referenced by cCamSlot(), and cCiAdapter.

◆ cCiConditionalAccessSupport

◆ cCiTransportConnection

friend class cCiTransportConnection
friend

Definition at line 235 of file ci.h.

References cCiTransportConnection.

Referenced by cCiTransportConnection.

◆ cMtdCamSlot

friend class cMtdCamSlot
friend

Definition at line 237 of file ci.h.

References cMtdCamSlot.

Referenced by cMtdCamSlot, cMtdHandler::GetMtdCamSlot(), and StopDecrypting().

Member Data Documentation

◆ assignedDevice

std::atomic<cDevice *> cCamSlot::assignedDevice
private

Definition at line 244 of file ci.h.

Referenced by Assign(), cCamSlot(), Device(), and Devices().

◆ assignMutex

cMutex cCamSlot::assignMutex
private

Definition at line 240 of file ci.h.

Referenced by Assign().

◆ caActivationReceiver

cCaActivationReceiver* cCamSlot::caActivationReceiver
private

Definition at line 246 of file ci.h.

Referenced by CancelActivation(), cCamSlot(), IsActivating(), StartActivation(), and ~cCamSlot().

◆ caPidReceiver

cCaPidReceiver* cCamSlot::caPidReceiver
private

Definition at line 245 of file ci.h.

Referenced by Assign(), BuildCaPmts(), cCamSlot(), SetPid(), WantsTsData(), and ~cCamSlot().

◆ caProgramList

cList<cCiCaProgramData> cCamSlot::caProgramList
private

Definition at line 256 of file ci.h.

Referenced by AddPid(), BuildCaPmts(), IsDecrypting(), KeepSharedCaPids(), Process(), SetPid(), and StopDecrypting().

◆ ciAdapter

cCiAdapter* cCamSlot::ciAdapter
private

Definition at line 242 of file ci.h.

Referenced by Assign(), cCamSlot(), cMtdCamSlot::cMtdCamSlot(), ModuleStatus(), Reset(), and Write().

◆ lastModuleStatus

eModuleStatus cCamSlot::lastModuleStatus
private

Definition at line 250 of file ci.h.

Referenced by cCamSlot(), Process(), and Reset().

◆ masterSlot

cCamSlot* cCamSlot::masterSlot
private

Definition at line 243 of file ci.h.

Referenced by cCamSlot(), IsMasterSlot(), MasterSlot(), and MasterSlotNumber().

◆ moduleCheckTimer

cTimeMs cCamSlot::moduleCheckTimer
private

Definition at line 252 of file ci.h.

Referenced by Process().

◆ mtdAvailable

bool cCamSlot::mtdAvailable
private

Definition at line 257 of file ci.h.

Referenced by cCamSlot(), MtdAvailable(), and MtdEnable().

◆ mtdHandler

◆ mutex

◆ processed

cCondVar cCamSlot::processed
private

Definition at line 241 of file ci.h.

Referenced by CanDecrypt(), and Process().

◆ resendPmt

bool cCamSlot::resendPmt
private

Definition at line 253 of file ci.h.

Referenced by BuildCaPmts(), cCamSlot(), Process(), SendCaPmts(), and TriggerResendPmt().

◆ resetTime

time_t cCamSlot::resetTime
private

Definition at line 251 of file ci.h.

Referenced by cCamSlot(), ModuleStatus(), and Reset().

◆ slotIndex

int cCamSlot::slotIndex
private

Definition at line 247 of file ci.h.

Referenced by cCiAdapter::AddCamSlot(), cCamSlot(), ModuleStatus(), Reset(), and SlotIndex().

◆ slotNumber

int cCamSlot::slotNumber
private

Definition at line 248 of file ci.h.

Referenced by cCamSlot(), MasterSlotNumber(), NewConnection(), Process(), Reset(), and SlotNumber().

◆ source

int cCamSlot::source
private

Definition at line 254 of file ci.h.

Referenced by AddChannel(), BuildCaPmts(), and KeepSharedCaPids().

◆ tc

◆ transponder

int cCamSlot::transponder
private

Definition at line 255 of file ci.h.

Referenced by AddChannel(), BuildCaPmts(), and KeepSharedCaPids().


The documentation for this class was generated from the following files: