vdr 2.7.3
|
#include "ci.h"
#include <ctype.h>
#include <linux/dvb/ca.h>
#include <malloc.h>
#include <netinet/in.h>
#include <poll.h>
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
#include <time.h>
#include <unistd.h>
#include "device.h"
#include "mtd.h"
#include "pat.h"
#include "receiver.h"
#include "remux.h"
#include "libsi/si.h"
#include "skins.h"
#include "tools.h"
Go to the source code of this file.
Classes | |
class | cCaPidReceiver |
class | cCaActivationReceiver |
class | cCamResponse |
class | cCamResponses |
class | cTPDU |
class | cCiTransportConnection |
class | cCiResourceManager |
class | cCiCaPmt |
class | cCiConditionalAccessSupport |
class | cCiHostControl |
class | cCiDateTime |
class | cCiMMI |
class | cCiDefaultResourceHandler |
class | cCiCaPidData |
class | cCiCaProgramData |
class | cChannelCamRelation |
Functions | |
static const uint8_t * | GetLength (const uint8_t *Data, int &Length) |
static uint8_t * | SetLength (uint8_t *Data, int Length) |
static char * | CopyString (int Length, const uint8_t *Data) |
static char * | GetString (int &Length, const uint8_t **Data) |
bool | CamResponsesLoad (const char *FileName, bool AllowComments, bool MustExist) |
static int | MtdMapCaDescriptor (uchar *p, cMtdMapper *MtdMapper) |
static int | MtdMapCaDescriptors (uchar *p, cMtdMapper *MtdMapper) |
static int | MtdMapStream (uchar *p, cMtdMapper *MtdMapper) |
static int | MtdMapStreams (uchar *p, cMtdMapper *MtdMapper, int Length) |
Variables | |
static bool | DumpTPDUDataTransfer = false |
static bool | DebugProtocol = false |
static bool | DumpPolls = false |
static bool | DumpDateTime = false |
cCamResponses | CamResponses |
cCiResourceHandlers | CiResourceHandlers |
cCamSlots | CamSlots |
cChannelCamRelations | ChannelCamRelations |
#define AI_ANSWER 0x01 |
Definition at line 1403 of file ci.c.
Referenced by cCiMMI::SendAnswer().
#define AI_CANCEL 0x00 |
Definition at line 1402 of file ci.c.
Referenced by cCiMMI::SendAnswer().
#define AOT_ANSW 0x9F8808 |
Definition at line 703 of file ci.c.
Referenced by cCiMMI::SendAnswer().
#define AOT_APPLICATION_INFO 0x9F8021 |
Definition at line 683 of file ci.c.
Referenced by cCiApplicationInformation::Process().
#define AOT_APPLICATION_INFO_ENQ 0x9F8020 |
Definition at line 682 of file ci.c.
Referenced by cCiApplicationInformation::Process().
#define AOT_CA_INFO 0x9F8031 |
Definition at line 686 of file ci.c.
Referenced by cCiConditionalAccessSupport::Process().
#define AOT_CA_INFO_ENQ 0x9F8030 |
Definition at line 685 of file ci.c.
Referenced by cCiConditionalAccessSupport::Process().
#define AOT_CA_PMT 0x9F8032 |
Definition at line 687 of file ci.c.
Referenced by cCiConditionalAccessSupport::SendPMT().
#define AOT_CA_PMT_REPLY 0x9F8033 |
Definition at line 688 of file ci.c.
Referenced by cCiConditionalAccessSupport::Process().
#define AOT_CLEAR_REPLACE 0x9F8402 |
Definition at line 691 of file ci.c.
Referenced by cCiHostControl::Process().
#define AOT_CLOSE_MMI 0x9F8800 |
Definition at line 695 of file ci.c.
Referenced by cCiMMI::Process(), and cCiMMI::SendCloseMMI().
#define AOT_DATE_TIME 0x9F8441 |
Definition at line 694 of file ci.c.
Referenced by cCiDateTime::SendDateTime().
#define AOT_DATE_TIME_ENQ 0x9F8440 |
Definition at line 693 of file ci.c.
Referenced by cCiDateTime::Process().
#define AOT_DISPLAY_CONTROL 0x9F8801 |
Definition at line 696 of file ci.c.
Referenced by cCiMMI::Process().
#define AOT_DISPLAY_REPLY 0x9F8802 |
Definition at line 697 of file ci.c.
Referenced by cCiMMI::Process().
#define AOT_ENQ 0x9F8807 |
Definition at line 702 of file ci.c.
Referenced by cCiMMI::Process().
#define AOT_ENTER_MENU 0x9F8022 |
Definition at line 684 of file ci.c.
Referenced by cCiApplicationInformation::EnterMenu().
#define AOT_LIST_LAST 0x9F880C |
Definition at line 707 of file ci.c.
Referenced by cCiMMI::Process().
#define AOT_MENU_ANSW 0x9F880B |
Definition at line 706 of file ci.c.
Referenced by cCiMMI::SendMenuAnswer().
#define AOT_MENU_LAST 0x9F8809 |
Definition at line 704 of file ci.c.
Referenced by cCiMMI::Process().
#define AOT_NONE 0x000000 |
Definition at line 678 of file ci.c.
Referenced by cCiSession::GetTag().
#define AOT_PROFILE 0x9F8011 |
Definition at line 680 of file ci.c.
Referenced by cCiResourceManager::Process().
#define AOT_PROFILE_CHANGE 0x9F8012 |
Definition at line 681 of file ci.c.
Referenced by cCiResourceManager::Process().
#define AOT_PROFILE_ENQ 0x9F8010 |
Definition at line 679 of file ci.c.
Referenced by cCiResourceManager::Process().
#define AOT_REPLACE 0x9F8401 |
Definition at line 690 of file ci.c.
Referenced by cCiHostControl::Process().
#define AOT_TEXT_LAST 0x9F8803 |
Definition at line 698 of file ci.c.
Referenced by cCiMMI::GetText().
#define AOT_TUNE 0x9F8400 |
Definition at line 689 of file ci.c.
Referenced by cCiHostControl::Process().
#define CA_ENABLE | ( | x | ) |
Definition at line 1104 of file ci.c.
Referenced by cCiConditionalAccessSupport::Process().
#define CAEI_POSSIBLE 0x01 |
Definition at line 1096 of file ci.c.
Referenced by cCiConditionalAccessSupport::Process().
#define CAM_CHECKED_TIMEOUT 15 |
Definition at line 2871 of file ci.c.
Referenced by cChannelCamRelation::CamChecked(), and cChannelCamRelation::TimedOut().
#define CHANNEL_CAM_RELATIONS_CLEANUP_INTERVAL 3600 |
Definition at line 2945 of file ci.c.
Referenced by cChannelCamRelations::Cleanup().
#define CPCI_NOT_SELECTED 0x04 |
Definition at line 933 of file ci.c.
Referenced by cCamSlot::BuildCaPmts(), and cCamSlot::StopDecrypting().
#define CPCI_OK_DESCRAMBLING 0x01 |
Definition at line 930 of file ci.c.
Referenced by cCamSlot::StartDecrypting().
#define CPCI_QUERY 0x03 |
Definition at line 932 of file ci.c.
Referenced by cCiCaPmt::AddCaDescriptors(), cCamSlot::CanDecrypt(), and cCiConditionalAccessSupport::Process().
#define CPLM_ADD 0x04 |
Definition at line 925 of file ci.c.
Referenced by cCamSlot::BuildCaPmts(), and cCamSlot::CanDecrypt().
#define CPLM_ONLY 0x03 |
Definition at line 924 of file ci.c.
Referenced by cCiCaPmt::cCiCaPmt().
#define CPLM_UPDATE 0x05 |
Definition at line 926 of file ci.c.
Referenced by cCamSlot::BuildCaPmts().
#define CRA_CONFIRM -2 |
Definition at line 361 of file ci.c.
Referenced by cCamResponse::Parse(), and cCiMMI::Process().
#define CRA_DISCARD -1 |
Definition at line 360 of file ci.c.
Referenced by cCamResponse::Parse(), and cCiMMI::Process().
#define CRA_NONE 0 |
Definition at line 359 of file ci.c.
Referenced by cCamResponse::cCamResponse(), cCamResponses::GetMatch(), cCamResponse::Matches(), and cCiMMI::Process().
#define CRA_SELECT -3 |
Definition at line 362 of file ci.c.
Referenced by cCamResponse::Parse(), and cCiMMI::Process().
#define DATA_INDICATOR 0x80 |
Definition at line 491 of file ci.c.
Referenced by cCiTransportConnection::Process().
#define dbgprotocol | ( | a... | ) |
Definition at line 36 of file ci.c.
Referenced by cCiApplicationInformation::cCiApplicationInformation(), cCiConditionalAccessSupport::cCiConditionalAccessSupport(), cCiDateTime::cCiDateTime(), cCiHostControl::cCiHostControl(), cCiMMI::cCiMMI(), cCiResourceManager::cCiResourceManager(), cCiTransportConnection::cCiTransportConnection(), cCiTransportConnection::CloseSession(), cCiApplicationInformation::EnterMenu(), cCiMMI::GetText(), cCiTransportConnection::OpenSession(), cCiTransportConnection::Poll(), cCamSlot::Process(), cCiApplicationInformation::Process(), cCiConditionalAccessSupport::Process(), cCiDateTime::Process(), cCiHostControl::Process(), cCiMMI::Process(), cCiResourceManager::Process(), cCiTransportConnection::Process(), cCamSlot::Reset(), cCiMMI::SendAnswer(), cCiMMI::SendCloseMMI(), cCiDateTime::SendDateTime(), cCiMMI::SendMenuAnswer(), and cCiConditionalAccessSupport::SendPMT().
#define DCC_SET_MMI_MODE 0x01 |
Definition at line 1373 of file ci.c.
Referenced by cCiMMI::Process().
#define DEC2BCD | ( | d | ) |
Referenced by cCiDateTime::SendDateTime().
#define DRI_MMI_MODE_ACK 0x01 |
Definition at line 1387 of file ci.c.
Referenced by cCiMMI::Process().
#define EF_BLIND 0x01 |
Definition at line 1398 of file ci.c.
Referenced by cCiMMI::Process().
#define MAX_CAM_NUMBER 32 |
Definition at line 2944 of file ci.c.
Referenced by cChannelCamRelations::Load(), and cChannelCamRelations::Save().
#define MAX_DUMP 256 |
Referenced by cTPDU::Dump().
#define MAX_SESSIONS_PER_TC 16 |
Definition at line 609 of file ci.c.
Referenced by cCiTransportConnection::cCiTransportConnection(), cCiTransportConnection::GetSessionByResourceId(), cCiTransportConnection::GetSessionBySessionId(), cCiTransportConnection::OpenSession(), cCiTransportConnection::Process(), and cCiTransportConnection::~cCiTransportConnection().
#define MAX_TPDU_DATA (MAX_TPDU_SIZE - 4) |
Definition at line 489 of file ci.c.
Referenced by cTPDU::cTPDU().
#define MAX_TPDU_SIZE 4096 |
Definition at line 488 of file ci.c.
Referenced by cCiSession::SendData().
#define MAXCASYSTEMIDS 64 |
Definition at line 917 of file ci.c.
Referenced by cCiConditionalAccessSupport::Process().
#define MM_HIGH_LEVEL 0x01 |
Definition at line 1381 of file ci.c.
Referenced by cCiMMI::Process().
#define MODULE_CHECK_INTERVAL 500 |
Definition at line 2175 of file ci.c.
Referenced by cCamSlot::Process().
#define MODULE_RESET_TIMEOUT 2 |
Definition at line 2176 of file ci.c.
Referenced by cCamSlot::ModuleStatus().
#define QUERY_REPLY_TIMEOUT 2000 |
Definition at line 1107 of file ci.c.
Referenced by cCamSlot::CanDecrypt().
#define QUERY_REPLY_WAIT 100 |
Definition at line 2738 of file ci.c.
Referenced by cCamSlot::CanDecrypt().
#define QUERY_RETRIES 6 |
Definition at line 1108 of file ci.c.
Referenced by cCiConditionalAccessSupport::Process().
#define QUERY_WAIT_TIME 500 |
Definition at line 1106 of file ci.c.
Referenced by cCiConditionalAccessSupport::Process().
#define RESOURCE_CLASS_MASK 0xFFFF0000 |
Definition at line 727 of file ci.c.
Referenced by cCiTransportConnection::GetSessionByResourceId().
#define RI_APPLICATION_INFORMATION 0x00020041 |
Definition at line 670 of file ci.c.
Referenced by cCiApplicationInformation::cCiApplicationInformation(), cCamSlot::EnterMenu(), cCiTransportConnection::GetCamName(), cCiDefaultResourceHandler::GetNewCiSession(), and cCiDefaultResourceHandler::ResourceIds().
#define RI_CONDITIONAL_ACCESS_SUPPORT 0x00030041 |
Definition at line 671 of file ci.c.
Referenced by cCamSlot::CanDecrypt(), cCiConditionalAccessSupport::cCiConditionalAccessSupport(), cCamSlot::GetCaSystemIds(), cCiDefaultResourceHandler::GetNewCiSession(), cCamSlot::ProvidesCa(), cCiTransportConnection::Ready(), cCamSlot::RepliesToQuery(), cCiDefaultResourceHandler::ResourceIds(), and cCamSlot::SendCaPmts().
#define RI_DATE_TIME 0x00240041 |
Definition at line 673 of file ci.c.
Referenced by cCiDateTime::cCiDateTime(), cCiDefaultResourceHandler::GetNewCiSession(), and cCiDefaultResourceHandler::ResourceIds().
#define RI_HOST_CONTROL 0x00200041 |
Definition at line 672 of file ci.c.
Referenced by cCiHostControl::cCiHostControl(), cCiDefaultResourceHandler::GetNewCiSession(), and cCiDefaultResourceHandler::ResourceIds().
#define RI_MMI 0x00400041 |
Definition at line 674 of file ci.c.
Referenced by cCiMMI::cCiMMI(), cCamSlot::GetEnquiry(), cCamSlot::GetMenu(), cCiDefaultResourceHandler::GetNewCiSession(), cCamSlot::HasMMI(), and cCiDefaultResourceHandler::ResourceIds().
#define RI_RESOURCE_MANAGER 0x00010041 |
Definition at line 669 of file ci.c.
Referenced by cCiResourceManager::cCiResourceManager(), cCiDefaultResourceHandler::GetNewCiSession(), and cCiDefaultResourceHandler::ResourceIds().
#define SIZE_INDICATOR 0x80 |
Definition at line 40 of file ci.c.
Referenced by GetLength(), and SetLength().
#define SS_NOT_ALLOCATED 0xF0 |
Definition at line 665 of file ci.c.
Referenced by cCiTransportConnection::CloseSession().
#define SS_OK 0x00 |
Definition at line 664 of file ci.c.
Referenced by cCiTransportConnection::CloseSession(), and cCiTransportConnection::OpenSession().
#define ST_CLOSE_SESSION_REQUEST 0x95 |
Definition at line 659 of file ci.c.
Referenced by cCiTransportConnection::HandleSessions().
#define ST_CLOSE_SESSION_RESPONSE 0x96 |
Definition at line 660 of file ci.c.
Referenced by cCiTransportConnection::CloseSession(), and cCiTransportConnection::HandleSessions().
#define ST_CREATE_SESSION_RESPONSE 0x94 |
Definition at line 658 of file ci.c.
Referenced by cCiTransportConnection::HandleSessions().
#define ST_OPEN_SESSION_REQUEST 0x91 |
Definition at line 655 of file ci.c.
Referenced by cCiTransportConnection::HandleSessions().
#define ST_OPEN_SESSION_RESPONSE 0x92 |
Definition at line 656 of file ci.c.
Referenced by cCiTransportConnection::OpenSession().
#define ST_SESSION_NUMBER 0x90 |
Definition at line 654 of file ci.c.
Referenced by cCiTransportConnection::HandleSessions(), and cCiSession::SendData().
#define STREAM_TYPE_AUDIO 0x04 |
Definition at line 2717 of file ci.c.
Referenced by cCamSlot::AddChannel(), and cCamSlot::CanDecrypt().
#define STREAM_TYPE_PRIVATE 0x06 |
Definition at line 2718 of file ci.c.
Referenced by cCamSlot::AddChannel(), and cCamSlot::CanDecrypt().
#define STREAM_TYPE_VIDEO 0x02 |
Definition at line 2716 of file ci.c.
Referenced by cCamSlot::AddChannel(), and cCamSlot::CanDecrypt().
#define T_CREATE_TC 0x82 |
Definition at line 495 of file ci.c.
Referenced by cTPDU::cTPDU(), and cCiTransportConnection::Process().
#define T_CTC_REPLY 0x83 |
Definition at line 496 of file ci.c.
Referenced by cTPDU::cTPDU(), and cCiTransportConnection::Process().
#define T_DATA_LAST 0xA0 |
Definition at line 502 of file ci.c.
Referenced by cTPDU::cTPDU(), cCiTransportConnection::Poll(), cCiTransportConnection::Process(), and cCiTransportConnection::SendData().
#define T_DATA_MORE 0xA1 |
Definition at line 503 of file ci.c.
Referenced by cTPDU::cTPDU(), and cCiTransportConnection::Process().
#define T_DELETE_TC 0x84 |
Definition at line 497 of file ci.c.
Referenced by cTPDU::cTPDU(), and cCiTransportConnection::Process().
#define T_DTC_REPLY 0x85 |
Definition at line 498 of file ci.c.
Referenced by cTPDU::cTPDU(), and cCiTransportConnection::Process().
#define T_NEW_TC 0x87 |
Definition at line 500 of file ci.c.
Referenced by cTPDU::cTPDU(), and cCiTransportConnection::Process().
#define T_RCV 0x81 |
Definition at line 494 of file ci.c.
Referenced by cTPDU::cTPDU(), and cCiTransportConnection::Process().
#define T_REQUEST_TC 0x86 |
Definition at line 499 of file ci.c.
Referenced by cTPDU::cTPDU(), and cCiTransportConnection::Process().
#define T_SB 0x80 |
Definition at line 493 of file ci.c.
Referenced by cTPDU::Dump(), cCiTransportConnection::Process(), and cTPDU::Status().
#define T_TC_ERROR 0x88 |
Definition at line 501 of file ci.c.
Referenced by cTPDU::cTPDU(), and cCiTransportConnection::Process().
#define TC_ALIVE_TIMEOUT 2000 |
Definition at line 1809 of file ci.c.
Referenced by cCiTransportConnection::cCiTransportConnection(), and cCiTransportConnection::Process().
#define TC_POLL_TIMEOUT 300 |
Definition at line 1808 of file ci.c.
Referenced by cCiTransportConnection::SendTPDU().
#define TS_PACKET_FACTOR 1024 |
Definition at line 309 of file ci.c.
Referenced by cCaActivationReceiver::Receive().
#define UNSCRAMBLE_TIME 5 |
Definition at line 308 of file ci.c.
Referenced by cCaActivationReceiver::Receive().
bool CamResponsesLoad | ( | const char * | FileName, |
bool | AllowComments, | ||
bool | MustExist ) |
|
static |
Data | Copies the string at Data. Returns a pointer to a newly allocated string. |
Definition at line 77 of file ci.c.
References MALLOC.
Referenced by GetString(), and cCiMMI::Process().
|
static |
Length | Gets the length field from the beginning of Data. Returns a pointer to the first byte after the length and stores the length value in Length. |
Definition at line 42 of file ci.c.
References SIZE_INDICATOR.
Referenced by cCiSession::GetData(), cTPDU::GetData(), and GetString().
|
static |
Data | Gets the string at Data. Returns a pointer to a newly allocated string, or NULL in case of error. Upon return Length and Data represent the remaining data after the string has been skipped. |
Definition at line 96 of file ci.c.
References CopyString(), and GetLength().
Referenced by cCiMMI::GetText(), and cCiApplicationInformation::Process().
|
static |
Definition at line 1014 of file ci.c.
References SI::CaDescriptorTag, esyslog, and MtdMapPid().
Referenced by MtdMapCaDescriptors().
|
static |
Definition at line 1031 of file ci.c.
References MtdMapCaDescriptor().
Referenced by cCiCaPmt::MtdMapPids(), and MtdMapStream().
|
static |
Definition at line 1048 of file ci.c.
References MtdMapCaDescriptors(), and MtdMapPid().
Referenced by MtdMapStreams().
|
static |
Definition at line 1058 of file ci.c.
References MtdMapStream().
Referenced by cCiCaPmt::MtdMapPids().
|
static |
Length | Sets the length field at the beginning of Data. Returns a pointer to the first byte after the length. |
Definition at line 57 of file ci.c.
References SIZE_INDICATOR.
Referenced by cTPDU::cTPDU(), and cCiSession::SendData().
cCamResponses CamResponses |
Definition at line 479 of file ci.c.
Referenced by CamResponsesLoad(), and cCiMMI::Process().
cCamSlots CamSlots |
Definition at line 2838 of file ci.c.
Referenced by cDevice::AttachReceiver(), CamControl(), cCamSlot::cCamSlot(), cMenuSetupCAMItem::Changed(), cMenuSetupCAM::cMenuSetupCAM(), cDevice::GetDevice(), main(), cCamSlots::NumReadyMasterSlots(), cCamSlots::WaitForAllCamSlotsReady(), and cCamSlot::~cCamSlot().
cChannelCamRelations ChannelCamRelations |
Definition at line 2947 of file ci.c.
Referenced by cDevice::Action(), cDevice::AttachReceiver(), cDevice::GetDevice(), main(), cCamSlot::Reset(), cDvbHdFfDevice::SetChannelDevice(), and cDvbSdFfDevice::SetChannelDevice().
cCiResourceHandlers CiResourceHandlers |
Definition at line 1777 of file ci.c.
Referenced by main(), cCiTransportConnection::OpenSession(), and cCiResourceManager::Process().
|
static |
Definition at line 34 of file ci.c.
Referenced by cCiDateTime::SendDateTime().
|
static |
Definition at line 33 of file ci.c.
Referenced by cTPDU::Dump(), and cCiTransportConnection::Poll().
|
static |
Definition at line 31 of file ci.c.
Referenced by cTPDU::Dump(), cCiTransportConnection::Poll(), and cCiDateTime::SendDateTime().