cCiHandler Class Reference

#include <ci.h>

Collaboration diagram for cCiHandler:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 ~cCiHandler ()
int NumSlots (void)
 Returns the number of CAM slots provided by this CA device.
int NumCams (void)
 Returns the number of actual CAMs inserted into this CA device.
bool Ready (void)
 Returns true if all CAMs in this CA device are ready.
bool Process (int Slot=-1)
bool HasUserIO (void)
bool EnterMenu (int Slot)
 Requests the CAM in the given Slot to start its menu.
cCiMenuGetMenu (void)
 Gets a pending menu, or NULL if there is no menu.
cCiEnquiryGetEnquiry (void)
 Gets a pending enquiry, or NULL if there is no enquiry.
const char * GetCamName (int Slot)
bool ProvidesCa (const unsigned short *CaSystemIds)
void SetSource (int Source, int Transponder)
void AddPid (int ProgramNumber, int Pid, int StreamType)
void SetPid (int Pid, bool Active)
bool CanDecrypt (int ProgramNumber)
void StartDecrypting (void)
bool Reset (int Slot)

Static Public Member Functions

static cCiHandlerCreateCiHandler (const char *FileName)
 Creates a new cCiHandler for the given CA device.

Private Member Functions

uint32_t ResourceIdToInt (const uint8_t *Data)
bool Send (uint8_t Tag, uint16_t SessionId, uint32_t ResourceId=0, int Status=-1)
const unsigned short * GetCaSystemIds (int Slot)
cCiSessionGetSessionBySessionId (uint16_t SessionId)
cCiSessionGetSessionByResourceId (uint32_t ResourceId, int Slot)
cCiSessionCreateSession (uint32_t ResourceId)
bool OpenSession (int Length, const uint8_t *Data)
bool CloseSession (uint16_t SessionId)
int CloseAllSessions (int Slot)
 cCiHandler (int Fd, int NumSlots)
void SendCaPmt (void)

Private Attributes

cMutex mutex
int fd
int numSlots
bool newCaSupport
bool hasUserIO
bool moduleReady [MAX_CI_SLOT]
cCiSessionsessions [MAX_CI_SESSION]
cCiTransportLayertpl
cCiTransportConnectiontc
int source
int transponder
cList< cCiCaProgramDatacaProgramList


Detailed Description

Definition at line 99 of file ci.h.


Constructor & Destructor Documentation

cCiHandler::cCiHandler ( int  Fd,
int  NumSlots 
) [private]

Definition at line 1482 of file ci.c.

References fd, hasUserIO, MAX_CI_SESSION, MAX_CI_SLOT, moduleReady, newCaSupport, numSlots, sessions, source, tc, tpl, and transponder.

Referenced by CreateCiHandler().

cCiHandler::~cCiHandler (  ) 

Definition at line 1497 of file ci.c.

References fd, MAX_CI_SESSION, sessions, and tpl.


Member Function Documentation

uint32_t cCiHandler::ResourceIdToInt ( const uint8_t *  Data  )  [private]

Definition at line 1529 of file ci.c.

References get_unaligned().

Referenced by OpenSession().

Here is the call graph for this function:

bool cCiHandler::Send ( uint8_t  Tag,
uint16_t  SessionId,
uint32_t  ResourceId = 0,
int  Status = -1 
) [private]

Definition at line 1534 of file ci.c.

References OK, put_unaligned(), cCiTransportConnection::SendData(), and tc.

Referenced by CloseSession(), and OpenSession().

Here is the call graph for this function:

const unsigned short * cCiHandler::GetCaSystemIds ( int  Slot  )  [private]

Definition at line 1804 of file ci.c.

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

Referenced by CanDecrypt(), and SendCaPmt().

Here is the call graph for this function:

cCiSession * cCiHandler::GetSessionBySessionId ( uint16_t  SessionId  )  [private]

Definition at line 1552 of file ci.c.

References MAX_CI_SESSION, and sessions.

Referenced by CloseSession(), and Process().

cCiSession * cCiHandler::GetSessionByResourceId ( uint32_t  ResourceId,
int  Slot 
) [private]

Definition at line 1561 of file ci.c.

References MAX_CI_SESSION, and sessions.

Referenced by CanDecrypt(), CreateSession(), EnterMenu(), GetCamName(), GetCaSystemIds(), GetEnquiry(), GetMenu(), ProvidesCa(), Ready(), and SendCaPmt().

cCiSession * cCiHandler::CreateSession ( uint32_t  ResourceId  )  [private]

Definition at line 1570 of file ci.c.

References GetSessionByResourceId(), MAX_CI_SESSION, newCaSupport, RI_APPLICATION_INFORMATION, RI_CONDITIONAL_ACCESS_SUPPORT, RI_DATE_TIME, RI_HOST_CONTROL, RI_MMI, RI_RESOURCE_MANAGER, sessions, cCiTransportConnection::Slot(), and tc.

Referenced by OpenSession().

Here is the call graph for this function:

bool cCiHandler::OpenSession ( int  Length,
const uint8_t *  Data 
) [private]

Definition at line 1590 of file ci.c.

References CreateSession(), dbgprotocol, esyslog, cCiSession::ResourceId(), ResourceIdToInt(), RI_APPLICATION_INFORMATION, RI_CONDITIONAL_ACCESS_SUPPORT, RI_DATE_TIME, RI_HOST_CONTROL, RI_MMI, RI_RESOURCE_MANAGER, Send(), cCiSession::SessionId(), SS_OK, and ST_OPEN_SESSION_RESPONSE.

Referenced by Process().

Here is the call graph for this function:

bool cCiHandler::CloseSession ( uint16_t  SessionId  )  [private]

Definition at line 1617 of file ci.c.

References dbgprotocol, esyslog, GetSessionBySessionId(), Send(), sessions, SS_NOT_ALLOCATED, SS_OK, and ST_CLOSE_SESSION_RESPONSE.

Referenced by CloseAllSessions(), and Process().

Here is the call graph for this function:

int cCiHandler::CloseAllSessions ( int  Slot  )  [private]

Definition at line 1634 of file ci.c.

References CloseSession(), MAX_CI_SESSION, and sessions.

Referenced by Process(), and Reset().

Here is the call graph for this function:

void cCiHandler::SendCaPmt ( void   )  [private]

Definition at line 1721 of file ci.c.

References cListBase::Add(), cCiCaPmt::AddPid(), caProgramList, cListBase::Count(), CPCI_OK_DESCRAMBLING, CPLM_FIRST, CPLM_LAST, CPLM_MORE, CPLM_ONLY, cList< T >::First(), GetCaSystemIds(), GetSessionByResourceId(), mutex, newCaSupport, cList< T >::Next(), numSlots, RI_CONDITIONAL_ACCESS_SUPPORT, cCiConditionalAccessSupport::SendPMT(), source, transponder, and cCiCaPmt::Valid().

Referenced by Process(), and StartDecrypting().

Here is the call graph for this function:

cCiHandler * cCiHandler::CreateCiHandler ( const char *  FileName  )  [static]

Creates a new cCiHandler for the given CA device.

Definition at line 1505 of file ci.c.

References cCiHandler(), esyslog, isyslog, LOG_ERROR_STR, and NumSlots().

Referenced by cDvbDevice::cDvbDevice().

Here is the call graph for this function:

int cCiHandler::NumSlots ( void   )  [inline]

Returns the number of CAM slots provided by this CA device.

Definition at line 128 of file ci.h.

References numSlots.

Referenced by cMenuSetupCICAM::cMenuSetupCICAM(), and CreateCiHandler().

int cCiHandler::NumCams ( void   ) 

Returns the number of actual CAMs inserted into this CA device.

Definition at line 1646 of file ci.c.

References MAX_CI_SLOT, and moduleReady.

Referenced by cDvbDevice::ProvidesCa().

bool cCiHandler::Ready ( void   ) 

Returns true if all CAMs in this CA device are ready.

Definition at line 1655 of file ci.c.

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

Referenced by cDvbDevice::Ready().

Here is the call graph for this function:

bool cCiHandler::Process ( int  Slot = -1  ) 

Processes the given Slot. If Slot is -1, all slots are processed. Returns false in case of an error.

Definition at line 1668 of file ci.c.

References CloseAllSessions(), CloseSession(), cCiTransportConnection::Data(), dbgprotocol, esyslog, get_unaligned(), GetSessionBySessionId(), hasUserIO, cCiSession::HasUserIO(), MAX_CI_SESSION, moduleReady, cCiTransportLayer::ModuleReady(), mutex, cCiTransportLayer::NewConnection(), numSlots, OpenSession(), cCiSession::Process(), cCiTransportLayer::Process(), cCiTransportLayer::ResetSlot(), SendCaPmt(), sessions, ST_CLOSE_SESSION_REQUEST, ST_CLOSE_SESSION_RESPONSE, ST_CREATE_SESSION_RESPONSE, ST_OPEN_SESSION_REQUEST, ST_SESSION_NUMBER, tc, and tpl.

Referenced by cDvbTuner::Action(), CanDecrypt(), cMenuSetupCICAM::Menu(), and cDvbDevice::Ready().

Here is the call graph for this function:

bool cCiHandler::HasUserIO ( void   )  [inline]

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

Definition at line 137 of file ci.h.

References hasUserIO.

Referenced by CamControl().

bool cCiHandler::EnterMenu ( int  Slot  ) 

Requests the CAM in the given Slot to start its menu.

Definition at line 1760 of file ci.c.

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

Referenced by cMenuSetupCICAM::Menu().

Here is the call graph for this function:

cCiMenu * cCiHandler::GetMenu ( void   ) 

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

Definition at line 1767 of file ci.c.

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

Referenced by CamControl().

Here is the call graph for this function:

cCiEnquiry * cCiHandler::GetEnquiry ( void   ) 

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

Definition at line 1782 of file ci.c.

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

Referenced by CamControl().

Here is the call graph for this function:

const char * cCiHandler::GetCamName ( int  Slot  ) 

Returns the name of the CAM in the given Slot, or NULL if there is no CAM in that slot.

Definition at line 1797 of file ci.c.

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

Referenced by cMenuSetupCICAMItem::cMenuSetupCICAMItem().

Here is the call graph for this function:

bool cCiHandler::ProvidesCa ( const unsigned short *  CaSystemIds  ) 

Definition at line 1811 of file ci.c.

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

Referenced by cDvbDevice::ProvidesCa().

Here is the call graph for this function:

void cCiHandler::SetSource ( int  Source,
int  Transponder 
)

< Returns true if any of the CAMs can provide 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. Sets the Source and Transponder of the device this cCiHandler is currently tuned to. If Source or Transponder are different than what was given in a previous call to SetSource(), any previously added PIDs will be cleared.

Definition at line 1828 of file ci.c.

References caProgramList, cListBase::Clear(), mutex, source, and transponder.

Referenced by cDevice::SetChannel().

Here is the call graph for this function:

void cCiHandler::AddPid ( int  ProgramNumber,
int  Pid,
int  StreamType 
)

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 1839 of file ci.c.

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

Referenced by cDevice::SetChannel().

Here is the call graph for this function:

void cCiHandler::SetPid ( int  Pid,
bool  Active 
)

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 1857 of file ci.c.

References caProgramList, cList< T >::First(), mutex, and cList< T >::Next().

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

Here is the call graph for this function:

bool cCiHandler::CanDecrypt ( int  ProgramNumber  ) 

XXX Returns true if there is a CAM in this CA device that is able to decrypt the programme with the given ProgramNumber. The PIDs for this ProgramNumber must have been set through previous calls to SetPid().

Definition at line 1870 of file ci.c.

References cCiCaPmt::AddPid(), caProgramList, CPCI_QUERY, cList< T >::First(), GetCaSystemIds(), GetSessionByResourceId(), mutex, cList< T >::Next(), numSlots, Process(), cCiConditionalAccessSupport::ReceivedReply(), RI_CONDITIONAL_ACCESS_SUPPORT, cCiConditionalAccessSupport::SendPMT(), source, transponder, and cCiCaPmt::Valid().

Referenced by cDevice::SetChannel().

Here is the call graph for this function:

void cCiHandler::StartDecrypting ( void   ) 

Triggers sending all currently active CA_PMT entries to the CAM, so that it will start decrypting.

Definition at line 1906 of file ci.c.

References mutex, newCaSupport, and SendCaPmt().

Referenced by cDevice::AttachReceiver(), cDevice::Detach(), cDvbDevice::SetAudioTrackDevice(), and cDevice::SetChannel().

Here is the call graph for this function:

bool cCiHandler::Reset ( int  Slot  ) 

Definition at line 1913 of file ci.c.

References CloseAllSessions(), mutex, cCiTransportLayer::ResetSlot(), and tpl.

Referenced by cMenuSetupCICAM::Reset().

Here is the call graph for this function:


Member Data Documentation

cMutex cCiHandler::mutex [private]

Definition at line 101 of file ci.h.

Referenced by AddPid(), CanDecrypt(), EnterMenu(), GetCamName(), GetCaSystemIds(), GetEnquiry(), GetMenu(), Process(), ProvidesCa(), Ready(), Reset(), SendCaPmt(), SetPid(), SetSource(), and StartDecrypting().

int cCiHandler::fd [private]

Definition at line 102 of file ci.h.

Referenced by cCiHandler(), and ~cCiHandler().

int cCiHandler::numSlots [private]

Definition at line 103 of file ci.h.

Referenced by CanDecrypt(), cCiHandler(), GetEnquiry(), GetMenu(), NumSlots(), Process(), ProvidesCa(), Ready(), and SendCaPmt().

bool cCiHandler::newCaSupport [private]

Definition at line 104 of file ci.h.

Referenced by cCiHandler(), CreateSession(), SendCaPmt(), and StartDecrypting().

bool cCiHandler::hasUserIO [private]

Definition at line 105 of file ci.h.

Referenced by cCiHandler(), HasUserIO(), and Process().

bool cCiHandler::moduleReady[MAX_CI_SLOT] [private]

Definition at line 106 of file ci.h.

Referenced by cCiHandler(), NumCams(), Process(), and Ready().

cCiSession* cCiHandler::sessions[MAX_CI_SESSION] [private]

Definition at line 107 of file ci.h.

Referenced by cCiHandler(), CloseAllSessions(), CloseSession(), CreateSession(), GetSessionByResourceId(), GetSessionBySessionId(), Process(), and ~cCiHandler().

cCiTransportLayer* cCiHandler::tpl [private]

Definition at line 108 of file ci.h.

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

cCiTransportConnection* cCiHandler::tc [private]

Definition at line 109 of file ci.h.

Referenced by cCiHandler(), CreateSession(), Process(), and Send().

int cCiHandler::source [private]

Definition at line 110 of file ci.h.

Referenced by CanDecrypt(), cCiHandler(), SendCaPmt(), and SetSource().

int cCiHandler::transponder [private]

Definition at line 111 of file ci.h.

Referenced by CanDecrypt(), cCiHandler(), SendCaPmt(), and SetSource().

cList<cCiCaProgramData> cCiHandler::caProgramList [private]

Definition at line 112 of file ci.h.

Referenced by AddPid(), CanDecrypt(), SendCaPmt(), SetPid(), and SetSource().


The documentation for this class was generated from the following files:
Generated on Tue Nov 6 20:06:03 2007 for VDR by  doxygen 1.5.3-20071008