vdr
2.2.0
|
#include <ci.h>
Public Member Functions | |
cCamSlot (cCiAdapter *CiAdapter, bool WantsTsData=false) | |
virtual | ~cCamSlot () |
bool | Assign (cDevice *Device, bool Query=false) |
cDevice * | Device (void) |
bool | WantsTsData (void) const |
int | SlotIndex (void) |
int | SlotNumber (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) |
virtual void | StartDecrypting (void) |
virtual void | StopDecrypting (void) |
virtual bool | IsDecrypting (void) |
virtual uchar * | Decrypt (uchar *Data, int &Count) |
![]() | |
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 |
Private Member Functions | |
const int * | GetCaSystemIds (void) |
void | SendCaPmt (uint8_t CmdId) |
void | NewConnection (void) |
void | DeleteAllConnections (void) |
void | Process (cTPDU *TPDU=NULL) |
void | Write (cTPDU *TPDU) |
cCiSession * | GetSessionByResourceId (uint32_t ResourceId) |
Private Attributes | |
cMutex | mutex |
cCondVar | processed |
cCiAdapter * | ciAdapter |
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 |
Friends | |
class | cCiAdapter |
class | cCiTransportConnection |
cCamSlot::cCamSlot | ( | cCiAdapter * | CiAdapter, |
bool | WantsTsData = false |
||
) |
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.
Definition at line 1742 of file ci.c.
References cListBase::Add(), cCiAdapter::AddCamSlot(), assignedDevice, caActivationReceiver, CamSlots, caPidReceiver, ciAdapter, cListObject::Index(), lastModuleStatus, MAX_CONNECTIONS_PER_CAM_SLOT, msReset, resendPmt, Reset(), resetTime, slotIndex, slotNumber, source, tc, and transponder.
|
virtual |
Definition at line 1762 of file ci.c.
References assignedDevice, caActivationReceiver, CamSlots, caPidReceiver, cListBase::Del(), DeleteAllConnections(), and cDevice::SetCamSlot().
|
virtual |
Adds all PIDs if 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 2143 of file ci.c.
References AddPid(), cChannel::Apids(), cChannel::Ca(), CA_ENCRYPTED_MIN, cChannel::Dpids(), mutex, cChannel::Sid(), source, cChannel::Source(), cChannel::Spids(), StopDecrypting(), STREAM_TYPE_AUDIO, STREAM_TYPE_PRIVATE, STREAM_TYPE_VIDEO, transponder, cChannel::Transponder(), and cChannel::Vpid().
Referenced by cDevice::SetChannel().
|
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 2104 of file ci.c.
References cListBase::Add(), caProgramList, cList< T >::First(), mutex, cListObject::Next(), cList< T >::Next(), and cCiCaProgramData::pidList.
Referenced by AddChannel().
bool cCamSlot::Assign | ( | cDevice * | Device, |
bool | Query = false |
||
) |
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'.
Definition at line 1772 of file ci.c.
References cCiAdapter::Assign(), assignedDevice, CancelActivation(), ciAdapter, Device(), cDevice::DeviceNumber(), dsyslog, mutex, cDevice::SetCamSlot(), slotNumber, source, StopDecrypting(), and transponder.
Referenced by cMenuSetupCAM::Activate(), cDevice::Detach(), and cDevice::GetDevice().
|
virtual |
Returns true if there is a CAM in this slot that can be put into activation mode.
Definition at line 1914 of file ci.c.
References ModuleStatus(), and msReady.
Referenced by cMenuSetupCAM::Activate(), and cMenuSetupCAM::SetHelpKeys().
|
virtual |
Cancels a previously started activation (if any).
Definition at line 1933 of file ci.c.
References caActivationReceiver, and mutex.
Referenced by cMenuSetupCAM::Activate(), Assign(), and Process().
|
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.
Definition at line 2163 of file ci.c.
References cChannel::Apids(), cChannel::Ca(), CA_ENCRYPTED_MIN, cCiConditionalAccessSupport::CanDecrypt(), CPCI_QUERY, CPLM_ADD, cChannel::Dpids(), dsyslog, GetCaSystemIds(), GetSessionByResourceId(), IsDecrypting(), 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 cDvbDevice::ProvidesChannel().
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. There are three possible ways a CAM can handle decryption:
Definition at line 2227 of file ci.c.
References TS_SIZE.
|
private |
Definition at line 1815 of file ci.c.
References MAX_CONNECTIONS_PER_CAM_SLOT, mutex, and tc.
Referenced by Process(), Reset(), and ~cCamSlot().
|
inline |
Returns the device this CAM slot is currently assigned to.
Definition at line 175 of file ci.h.
References assignedDevice.
Referenced by Assign(), cDevice::GetDevice(), Priority(), cMenuSetupCAM::Reset(), SendCaPmt(), and StartActivation().
|
virtual |
Requests the CAM in this slot to start its menu.
Definition at line 1982 of file ci.c.
References cCiApplicationInformation::EnterMenu(), GetSessionByResourceId(), mutex, and RI_APPLICATION_INFORMATION.
Referenced by cMenuSetupCAM::Menu().
|
virtual |
Returns the name of the CAM in this slot, or NULL if there is no ready CAM in this slot.
Definition at line 1959 of file ci.c.
References cCiTransportConnection::GetCamName(), mutex, and tc.
Referenced by cMenuSetupCAMItem::Changed(), and cMenuCam::GenerateTitle().
|
private |
Definition at line 2076 of file ci.c.
References cCiConditionalAccessSupport::GetCaSystemIds(), GetSessionByResourceId(), mutex, and RI_CONDITIONAL_ACCESS_SUPPORT.
Referenced by CanDecrypt().
|
virtual |
Gets a pending enquiry, or NULL if there is no enquiry.
Definition at line 2002 of file ci.c.
References cCiMMI::Enquiry(), GetSessionByResourceId(), cCiEnquiry::mutex, mutex, and RI_MMI.
Referenced by cMenuCam::QueryCam().
|
virtual |
Gets a pending menu, or NULL if there is no menu.
Definition at line 1989 of file ci.c.
References GetSessionByResourceId(), cCiMMI::Menu(), cCiMenu::mutex, mutex, and RI_MMI.
Referenced by cMenuCam::QueryCam().
|
private |
Definition at line 1881 of file ci.c.
References cCiTransportConnection::GetSessionByResourceId(), mutex, and tc.
Referenced by CanDecrypt(), EnterMenu(), GetCaSystemIds(), GetEnquiry(), GetMenu(), HasMMI(), ProvidesCa(), and SendCaPmt().
|
virtual |
Returns 'true' if the CAM in this slot has an active MMI.
Definition at line 1971 of file ci.c.
References GetSessionByResourceId(), and RI_MMI.
Referenced by cMenuCam::ProcessKey().
|
virtual |
Returns true if there is a pending user interaction, which shall be retrieved via GetMenu() or GetEnquiry().
Definition at line 1976 of file ci.c.
References cCiTransportConnection::HasUserIO(), mutex, and tc.
Referenced by cMenuSetupCAM::Menu(), and cMenuCam::QueryCam().
|
virtual |
Returns true if this CAM slot is currently activating a smart card.
Definition at line 1940 of file ci.c.
References caActivationReceiver.
Referenced by cDevice::Action(), cMenuSetupCAM::Activate(), cMenuSetupCAMItem::Changed(), cDevice::Detach(), and cMenuSetupCAM::SetHelpKeys().
|
virtual |
Returns true if the CAM in this slot is currently used for decrypting.
Definition at line 2211 of file ci.c.
References caProgramList, cListBase::Count(), cList< T >::First(), mutex, cListObject::Next(), and cList< T >::Next().
Referenced by CanDecrypt(), cDevice::Detach(), and cDevice::GetDevice().
|
virtual |
Returns the status of the CAM in this slot.
Definition at line 1945 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().
|
private |
Definition at line 1802 of file ci.c.
References cCiTransportConnection, cCiTransportConnection::CreateConnection(), esyslog, MAX_CONNECTIONS_PER_CAM_SLOT, mutex, slotNumber, and tc.
Referenced by Process().
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 2083 of file ci.c.
References Device(), IDLEPRIORITY, and cDevice::Priority().
Referenced by cMenuSetupCAM::Activate(), and cDevice::GetDevice().
|
private |
Definition at line 1824 of file ci.c.
References cCondVar::Broadcast(), caActivationReceiver, CancelActivation(), caProgramList, cListBase::Count(), CPCI_OK_DESCRAMBLING, dbgprotocol, DeleteAllConnections(), esyslog, cReceiver::IsAttached(), isyslog, lastModuleStatus, MAX_CONNECTIONS_PER_CAM_SLOT, MODULE_CHECK_INTERVAL, moduleCheckTimer, ModuleStatus(), msNone, msPresent, msReady, msReset, mutex, NewConnection(), cCiTransportConnection::Process(), processed, resendPmt, Reset(), SendCaPmt(), cTimeMs::Set(), slotNumber, tc, cTPDU::Tcid(), and cTimeMs::TimedOut().
Referenced by cCiAdapter::Action().
|
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.
Definition at line 2089 of file ci.c.
References cCiConditionalAccessSupport::GetCaSystemIds(), GetSessionByResourceId(), mutex, and RI_CONDITIONAL_ACCESS_SUPPORT.
Referenced by cDevice::GetDevice().
|
virtual |
Returns 'true' if the CAM in this slot is ready to decrypt.
Definition at line 1965 of file ci.c.
References ModuleStatus(), msNone, mutex, cCiTransportConnection::Ready(), and tc.
|
virtual |
Resets the CAM in this slot.
Returns true if the operation was successful.
Definition at line 1896 of file ci.c.
References ChannelCamRelations, ciAdapter, dbgprotocol, DeleteAllConnections(), lastModuleStatus, msReset, mutex, cCiAdapter::Reset(), cChannelCamRelations::Reset(), resetTime, slotIndex, and slotNumber.
Referenced by cCamSlot(), Process(), and cMenuSetupCAM::Reset().
|
private |
Definition at line 2015 of file ci.c.
References cCiCaPmt::AddPid(), cReceiver::AddPids(), caPidReceiver, caProgramList, cListBase::Count(), CPLM_ADD, CPLM_UPDATE, cReceiver::DelPids(), Device(), cList< T >::First(), GetCaPids(), cCiConditionalAccessSupport::GetCaSystemIds(), GetSessionByResourceId(), cCaPidReceiver::HasCaPids(), MAXRECEIVEPIDS, mutex, cListObject::Next(), cList< T >::Next(), cCiConditionalAccessSupport::RepliesToQuery(), resendPmt, cCaPidReceiver::Reset(), RI_CONDITIONAL_ACCESS_SUPPORT, cCiConditionalAccessSupport::SendPMT(), cCiCaPmt::SetListManagement(), source, and transponder.
Referenced by Process(), StartDecrypting(), and StopDecrypting().
|
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 2122 of file ci.c.
References caProgramList, cList< T >::First(), mutex, cListObject::Next(), and cList< T >::Next().
Referenced by cDevice::AddPid(), cDevice::DelPid(), cDvbHdFfDevice::SetAudioTrackDevice(), and cDvbSdFfDevice::SetAudioTrackDevice().
|
inline |
Returns the index of this CAM slot within its CI adapter.
The first slot has an index of 0.
Definition at line 180 of file ci.h.
References slotIndex.
Referenced by cCiTransportConnection::cCiTransportConnection(), cCiTransportConnection::CloseSession(), cCiTransportConnection::HandleSessions(), cCiTransportConnection::OpenSession(), cCiTransportConnection::Process(), and cCiTransportConnection::SendTPDU().
|
inline |
Returns the number of this CAM slot within the whole system.
The first slot has the number 1.
Definition at line 183 of file ci.h.
References slotNumber.
Referenced by cCiAdapter::Action(), cDevice::Action(), CanDecrypt(), cCiApplicationInformation::cCiApplicationInformation(), cCiConditionalAccessSupport::cCiConditionalAccessSupport(), cCiDateTime::cCiDateTime(), cCiMMI::cCiMMI(), cCiResourceManager::cCiResourceManager(), cCiTransportConnection::cCiTransportConnection(), cMenuSetupCAMItem::Changed(), cCiTransportConnection::CloseSession(), DrawDeviceData(), cMenuCam::GenerateTitle(), cDevice::GetDevice(), cCiTransportConnection::HandleSessions(), cMenuSetupCAM::Menu(), cCiTransportConnection::OpenSession(), cCiTransportConnection::Poll(), cCiTransportConnection::Process(), cCaActivationReceiver::Receive(), cMenuCam::Select(), cMenuCam::Set(), cDvbHdFfDevice::SetChannelDevice(), cDvbSdFfDevice::SetChannelDevice(), StartActivation(), and Write().
|
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 1919 of file ci.c.
References caActivationReceiver, Channels, cDevice::CurrentChannel(), Device(), dsyslog, cChannels::GetByNumber(), mutex, and SlotNumber().
Referenced by cMenuSetupCAM::Activate().
|
virtual |
Triggers sending all currently active CA_PMT entries to the CAM, so that it will start decrypting.
Definition at line 2197 of file ci.c.
References CPCI_OK_DESCRAMBLING, and SendCaPmt().
Referenced by cDevice::AttachReceiver(), cDevice::Detach(), cDvbHdFfDevice::SetAudioTrackDevice(), cDvbSdFfDevice::SetAudioTrackDevice(), and cDevice::SetChannel().
|
virtual |
Clears the list of CA_PMT entries and tells the CAM to stop decrypting.
Definition at line 2202 of file ci.c.
References caProgramList, cListBase::Clear(), cListBase::Count(), CPCI_NOT_SELECTED, mutex, and SendCaPmt().
Referenced by AddChannel(), and Assign().
|
inline |
|
private |
Definition at line 1887 of file ci.c.
References cTPDU::Buffer(), ciAdapter, cTPDU::Dump(), mutex, cTPDU::Size(), SlotNumber(), and cCiAdapter::Write().
Referenced by cCiTransportConnection::SendTPDU().
|
friend |
|
friend |
Definition at line 132 of file ci.h.
Referenced by NewConnection().
|
private |
Definition at line 137 of file ci.h.
Referenced by Assign(), cCamSlot(), Device(), and ~cCamSlot().
|
private |
Definition at line 139 of file ci.h.
Referenced by CancelActivation(), cCamSlot(), IsActivating(), Process(), StartActivation(), and ~cCamSlot().
|
private |
Definition at line 138 of file ci.h.
Referenced by cCamSlot(), SendCaPmt(), and ~cCamSlot().
|
private |
Definition at line 149 of file ci.h.
Referenced by AddPid(), IsDecrypting(), Process(), SendCaPmt(), SetPid(), and StopDecrypting().
|
private |
Definition at line 136 of file ci.h.
Referenced by Assign(), cCamSlot(), ModuleStatus(), Reset(), and Write().
|
private |
Definition at line 143 of file ci.h.
Referenced by cCamSlot(), Process(), and Reset().
|
private |
|
private |
Definition at line 134 of file ci.h.
Referenced by AddChannel(), AddPid(), Assign(), CancelActivation(), CanDecrypt(), DeleteAllConnections(), EnterMenu(), GetCamName(), GetCaSystemIds(), GetEnquiry(), GetMenu(), GetSessionByResourceId(), HasUserIO(), IsDecrypting(), ModuleStatus(), NewConnection(), Process(), ProvidesCa(), Ready(), Reset(), SendCaPmt(), SetPid(), StartActivation(), StopDecrypting(), and Write().
|
private |
Definition at line 135 of file ci.h.
Referenced by CanDecrypt(), and Process().
|
private |
Definition at line 146 of file ci.h.
Referenced by cCamSlot(), Process(), and SendCaPmt().
|
private |
Definition at line 144 of file ci.h.
Referenced by cCamSlot(), ModuleStatus(), and Reset().
|
private |
Definition at line 140 of file ci.h.
Referenced by cCiAdapter::AddCamSlot(), cCamSlot(), ModuleStatus(), Reset(), and SlotIndex().
|
private |
Definition at line 141 of file ci.h.
Referenced by Assign(), cCamSlot(), NewConnection(), Process(), Reset(), and SlotNumber().
|
private |
Definition at line 147 of file ci.h.
Referenced by AddChannel(), Assign(), cCamSlot(), and SendCaPmt().
|
private |
Definition at line 142 of file ci.h.
Referenced by cCamSlot(), DeleteAllConnections(), GetCamName(), GetSessionByResourceId(), HasUserIO(), NewConnection(), Process(), and Ready().
|
private |
Definition at line 148 of file ci.h.
Referenced by AddChannel(), Assign(), cCamSlot(), and SendCaPmt().