vdr
2.4.0
|
#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 1367 of file ci.c.
Referenced by cCiMMI::SendAnswer().
#define AI_CANCEL 0x00 |
Definition at line 1366 of file ci.c.
Referenced by cCiMMI::SendAnswer().
#define AOT_ANSW 0x9F8808 |
Definition at line 668 of file ci.c.
Referenced by cCiMMI::SendAnswer().
#define AOT_APPLICATION_INFO 0x9F8021 |
Definition at line 648 of file ci.c.
Referenced by cCiApplicationInformation::Process().
#define AOT_APPLICATION_INFO_ENQ 0x9F8020 |
Definition at line 647 of file ci.c.
Referenced by cCiApplicationInformation::Process().
#define AOT_CA_INFO 0x9F8031 |
Definition at line 651 of file ci.c.
Referenced by cCiConditionalAccessSupport::Process().
#define AOT_CA_INFO_ENQ 0x9F8030 |
Definition at line 650 of file ci.c.
Referenced by cCiConditionalAccessSupport::Process().
#define AOT_CA_PMT 0x9F8032 |
Definition at line 652 of file ci.c.
Referenced by cCiConditionalAccessSupport::SendPMT().
#define AOT_CA_PMT_REPLY 0x9F8033 |
Definition at line 653 of file ci.c.
Referenced by cCiConditionalAccessSupport::Process().
#define AOT_CLEAR_REPLACE 0x9F8402 |
Definition at line 656 of file ci.c.
Referenced by cCiHostControl::Process().
#define AOT_CLOSE_MMI 0x9F8800 |
Definition at line 660 of file ci.c.
Referenced by cCiMMI::Process(), and cCiMMI::SendCloseMMI().
#define AOT_DATE_TIME 0x9F8441 |
Definition at line 659 of file ci.c.
Referenced by cCiDateTime::SendDateTime().
#define AOT_DATE_TIME_ENQ 0x9F8440 |
Definition at line 658 of file ci.c.
Referenced by cCiDateTime::Process().
#define AOT_DISPLAY_CONTROL 0x9F8801 |
Definition at line 661 of file ci.c.
Referenced by cCiMMI::Process().
#define AOT_DISPLAY_REPLY 0x9F8802 |
Definition at line 662 of file ci.c.
Referenced by cCiMMI::Process().
#define AOT_ENQ 0x9F8807 |
Definition at line 667 of file ci.c.
Referenced by cCiMMI::Process().
#define AOT_ENTER_MENU 0x9F8022 |
Definition at line 649 of file ci.c.
Referenced by cCiApplicationInformation::EnterMenu().
#define AOT_LIST_LAST 0x9F880C |
Definition at line 672 of file ci.c.
Referenced by cCiMMI::Process().
#define AOT_MENU_ANSW 0x9F880B |
Definition at line 671 of file ci.c.
Referenced by cCiMMI::SendMenuAnswer().
#define AOT_MENU_LAST 0x9F8809 |
Definition at line 669 of file ci.c.
Referenced by cCiMMI::Process().
#define AOT_NONE 0x000000 |
Definition at line 643 of file ci.c.
Referenced by cCiSession::GetTag().
#define AOT_PROFILE 0x9F8011 |
Definition at line 645 of file ci.c.
Referenced by cCiResourceManager::Process().
#define AOT_PROFILE_CHANGE 0x9F8012 |
Definition at line 646 of file ci.c.
Referenced by cCiResourceManager::Process().
#define AOT_PROFILE_ENQ 0x9F8010 |
Definition at line 644 of file ci.c.
Referenced by cCiResourceManager::Process().
#define AOT_REPLACE 0x9F8401 |
Definition at line 655 of file ci.c.
Referenced by cCiHostControl::Process().
#define AOT_TEXT_LAST 0x9F8803 |
Definition at line 663 of file ci.c.
Referenced by cCiMMI::GetText().
#define AOT_TUNE 0x9F8400 |
Definition at line 654 of file ci.c.
Referenced by cCiHostControl::Process().
#define CA_ENABLE | ( | x | ) | (((x) & CA_ENABLE_FLAG) ? (x) & ~CA_ENABLE_FLAG : 0) |
Definition at line 1069 of file ci.c.
Referenced by cCiConditionalAccessSupport::Process().
#define CAEI_POSSIBLE 0x01 |
Definition at line 1061 of file ci.c.
Referenced by cCiConditionalAccessSupport::Process().
#define CAM_CHECKED_TIMEOUT 15 |
Definition at line 2788 of file ci.c.
Referenced by cChannelCamRelation::CamChecked(), and cChannelCamRelation::TimedOut().
#define CHANNEL_CAM_RELATIONS_CLEANUP_INTERVAL 3600 |
Definition at line 2862 of file ci.c.
Referenced by cChannelCamRelations::Cleanup().
#define CPCI_NOT_SELECTED 0x04 |
Definition at line 898 of file ci.c.
Referenced by cCamSlot::BuildCaPmts(), and cCamSlot::StopDecrypting().
#define CPCI_OK_DESCRAMBLING 0x01 |
Definition at line 895 of file ci.c.
Referenced by cCamSlot::StartDecrypting().
#define CPCI_QUERY 0x03 |
Definition at line 897 of file ci.c.
Referenced by cCiCaPmt::AddCaDescriptors(), cCamSlot::CanDecrypt(), and cCiConditionalAccessSupport::Process().
#define CPLM_ADD 0x04 |
Definition at line 890 of file ci.c.
Referenced by cCamSlot::BuildCaPmts(), and cCamSlot::CanDecrypt().
#define CPLM_ONLY 0x03 |
Definition at line 889 of file ci.c.
Referenced by cCiCaPmt::cCiCaPmt().
#define CPLM_UPDATE 0x05 |
Definition at line 891 of file ci.c.
Referenced by cCamSlot::BuildCaPmts().
#define CRA_CONFIRM -2 |
Definition at line 327 of file ci.c.
Referenced by cCamResponse::Parse(), and cCiMMI::Process().
#define CRA_DISCARD -1 |
Definition at line 326 of file ci.c.
Referenced by cCamResponse::Parse(), and cCiMMI::Process().
#define CRA_NONE 0 |
Definition at line 325 of file ci.c.
Referenced by cCamResponse::cCamResponse(), cCamResponses::GetMatch(), cCamResponse::Matches(), and cCiMMI::Process().
#define CRA_SELECT -3 |
Definition at line 328 of file ci.c.
Referenced by cCamResponse::Parse(), and cCiMMI::Process().
#define DATA_INDICATOR 0x80 |
Definition at line 457 of file ci.c.
Referenced by cCiTransportConnection::Process().
#define dbgprotocol | ( | a... | ) | do { if (DebugProtocol) fprintf(stderr, a); } while (0) |
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(), cCiApplicationInformation::Process(), cCamSlot::Process(), cCiTransportConnection::Process(), cCiResourceManager::Process(), cCiConditionalAccessSupport::Process(), cCiHostControl::Process(), cCiDateTime::Process(), cCiMMI::Process(), cCamSlot::Reset(), cCiMMI::SendAnswer(), cCiMMI::SendCloseMMI(), cCiDateTime::SendDateTime(), cCiMMI::SendMenuAnswer(), and cCiConditionalAccessSupport::SendPMT().
#define DCC_SET_MMI_MODE 0x01 |
Definition at line 1337 of file ci.c.
Referenced by cCiMMI::Process().
#define DEC2BCD | ( | d | ) | uint8_t(((d / 10) << 4) + (d % 10)) |
Referenced by cCiDateTime::SendDateTime().
#define DRI_MMI_MODE_ACK 0x01 |
Definition at line 1351 of file ci.c.
Referenced by cCiMMI::Process().
#define EF_BLIND 0x01 |
Definition at line 1362 of file ci.c.
Referenced by cCiMMI::Process().
#define MAX_CAM_NUMBER 32 |
Definition at line 2861 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 575 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 455 of file ci.c.
Referenced by cTPDU::cTPDU().
#define MAX_TPDU_SIZE 4096 |
Definition at line 454 of file ci.c.
Referenced by cCiSession::SendData().
#define MAXCASYSTEMIDS 64 |
Definition at line 882 of file ci.c.
Referenced by cCiConditionalAccessSupport::Process().
#define MM_HIGH_LEVEL 0x01 |
Definition at line 1345 of file ci.c.
Referenced by cCiMMI::Process().
#define MODULE_CHECK_INTERVAL 500 |
Definition at line 2135 of file ci.c.
Referenced by cCamSlot::Process().
#define MODULE_RESET_TIMEOUT 2 |
Definition at line 2136 of file ci.c.
Referenced by cCamSlot::ModuleStatus().
#define QUERY_REPLY_TIMEOUT 2000 |
Definition at line 1072 of file ci.c.
Referenced by cCamSlot::CanDecrypt().
#define QUERY_REPLY_WAIT 100 |
Definition at line 2659 of file ci.c.
Referenced by cCamSlot::CanDecrypt().
#define QUERY_RETRIES 6 |
Definition at line 1073 of file ci.c.
Referenced by cCiConditionalAccessSupport::Process().
#define QUERY_WAIT_TIME 500 |
Definition at line 1071 of file ci.c.
Referenced by cCiConditionalAccessSupport::Process().
#define RESOURCE_CLASS_MASK 0xFFFF0000 |
Definition at line 692 of file ci.c.
Referenced by cCiTransportConnection::GetSessionByResourceId().
#define RI_APPLICATION_INFORMATION 0x00020041 |
Definition at line 635 of file ci.c.
Referenced by cCamSlot::EnterMenu(), cCiTransportConnection::GetCamName(), cCiDefaultResourceHandler::GetNewCiSession(), and cCiDefaultResourceHandler::ResourceIds().
#define RI_CONDITIONAL_ACCESS_SUPPORT 0x00030041 |
Definition at line 636 of file ci.c.
Referenced by cCamSlot::CanDecrypt(), cCamSlot::GetCaSystemIds(), cCiDefaultResourceHandler::GetNewCiSession(), cCamSlot::ProvidesCa(), cCiTransportConnection::Ready(), cCamSlot::RepliesToQuery(), cCiDefaultResourceHandler::ResourceIds(), and cCamSlot::SendCaPmts().
#define RI_DATE_TIME 0x00240041 |
Definition at line 638 of file ci.c.
Referenced by cCiDefaultResourceHandler::GetNewCiSession(), and cCiDefaultResourceHandler::ResourceIds().
#define RI_HOST_CONTROL 0x00200041 |
Definition at line 637 of file ci.c.
Referenced by cCiDefaultResourceHandler::GetNewCiSession(), and cCiDefaultResourceHandler::ResourceIds().
#define RI_MMI 0x00400041 |
Definition at line 639 of file ci.c.
Referenced by cCamSlot::GetEnquiry(), cCamSlot::GetMenu(), cCiDefaultResourceHandler::GetNewCiSession(), cCamSlot::HasMMI(), and cCiDefaultResourceHandler::ResourceIds().
#define RI_RESOURCE_MANAGER 0x00010041 |
Definition at line 634 of file ci.c.
Referenced by 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 630 of file ci.c.
Referenced by cCiTransportConnection::CloseSession().
#define SS_OK 0x00 |
Definition at line 629 of file ci.c.
Referenced by cCiTransportConnection::CloseSession(), and cCiTransportConnection::OpenSession().
#define ST_CLOSE_SESSION_REQUEST 0x95 |
Definition at line 624 of file ci.c.
Referenced by cCiTransportConnection::HandleSessions().
#define ST_CLOSE_SESSION_RESPONSE 0x96 |
Definition at line 625 of file ci.c.
Referenced by cCiTransportConnection::CloseSession(), and cCiTransportConnection::HandleSessions().
#define ST_CREATE_SESSION_RESPONSE 0x94 |
Definition at line 623 of file ci.c.
Referenced by cCiTransportConnection::HandleSessions().
#define ST_OPEN_SESSION_REQUEST 0x91 |
Definition at line 620 of file ci.c.
Referenced by cCiTransportConnection::HandleSessions().
#define ST_OPEN_SESSION_RESPONSE 0x92 |
Definition at line 621 of file ci.c.
Referenced by cCiTransportConnection::OpenSession().
#define ST_SESSION_NUMBER 0x90 |
Definition at line 619 of file ci.c.
Referenced by cCiTransportConnection::HandleSessions(), and cCiSession::SendData().
#define STREAM_TYPE_AUDIO 0x04 |
Definition at line 2638 of file ci.c.
Referenced by cCamSlot::AddChannel(), and cCamSlot::CanDecrypt().
#define STREAM_TYPE_PRIVATE 0x06 |
Definition at line 2639 of file ci.c.
Referenced by cCamSlot::AddChannel(), and cCamSlot::CanDecrypt().
#define STREAM_TYPE_VIDEO 0x02 |
Definition at line 2637 of file ci.c.
Referenced by cCamSlot::AddChannel(), and cCamSlot::CanDecrypt().
#define T_CREATE_TC 0x82 |
Definition at line 461 of file ci.c.
Referenced by cTPDU::cTPDU(), and cCiTransportConnection::Process().
#define T_CTC_REPLY 0x83 |
Definition at line 462 of file ci.c.
Referenced by cTPDU::cTPDU(), and cCiTransportConnection::Process().
#define T_DATA_LAST 0xA0 |
Definition at line 468 of file ci.c.
Referenced by cTPDU::cTPDU(), cCiTransportConnection::Poll(), cCiTransportConnection::Process(), and cCiTransportConnection::SendData().
#define T_DATA_MORE 0xA1 |
Definition at line 469 of file ci.c.
Referenced by cTPDU::cTPDU(), and cCiTransportConnection::Process().
#define T_DELETE_TC 0x84 |
Definition at line 463 of file ci.c.
Referenced by cTPDU::cTPDU(), and cCiTransportConnection::Process().
#define T_DTC_REPLY 0x85 |
Definition at line 464 of file ci.c.
Referenced by cTPDU::cTPDU(), and cCiTransportConnection::Process().
#define T_NEW_TC 0x87 |
Definition at line 466 of file ci.c.
Referenced by cTPDU::cTPDU(), and cCiTransportConnection::Process().
#define T_RCV 0x81 |
Definition at line 460 of file ci.c.
Referenced by cTPDU::cTPDU(), and cCiTransportConnection::Process().
#define T_REQUEST_TC 0x86 |
Definition at line 465 of file ci.c.
Referenced by cTPDU::cTPDU(), and cCiTransportConnection::Process().
#define T_SB 0x80 |
Definition at line 459 of file ci.c.
Referenced by cTPDU::Dump(), cCiTransportConnection::Process(), and cTPDU::Status().
#define T_TC_ERROR 0x88 |
Definition at line 467 of file ci.c.
Referenced by cTPDU::cTPDU(), and cCiTransportConnection::Process().
#define TC_ALIVE_TIMEOUT 2000 |
Definition at line 1770 of file ci.c.
Referenced by cCiTransportConnection::cCiTransportConnection(), and cCiTransportConnection::Process().
#define TC_POLL_TIMEOUT 300 |
Definition at line 1769 of file ci.c.
Referenced by cCiTransportConnection::SendTPDU().
#define TS_PACKET_FACTOR 1024 |
Definition at line 275 of file ci.c.
Referenced by cCaActivationReceiver::Receive().
#define UNSCRAMBLE_TIME 5 |
Definition at line 274 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 979 of file ci.c.
References SI::CaDescriptorTag, esyslog, and MtdMapPid().
Referenced by MtdMapCaDescriptors().
|
static |
Definition at line 996 of file ci.c.
References MtdMapCaDescriptor().
Referenced by cCiCaPmt::MtdMapPids(), and MtdMapStream().
|
static |
Definition at line 1013 of file ci.c.
References MtdMapCaDescriptors(), and MtdMapPid().
Referenced by MtdMapStreams().
|
static |
Definition at line 1023 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 |
cCamSlots CamSlots |
Definition at line 2755 of file ci.c.
Referenced by cDevice::AttachReceiver(), CamControl(), cCamSlot::cCamSlot(), cMenuSetupCAMItem::Changed(), cMenuSetupCAM::cMenuSetupCAM(), cDevice::GetDevice(), main(), and cCamSlot::~cCamSlot().
cChannelCamRelations ChannelCamRelations |
Definition at line 2864 of file ci.c.
Referenced by cDevice::Action(), cDevice::AttachReceiver(), cDevice::GetDevice(), main(), and cCamSlot::Reset().
cCiResourceHandlers CiResourceHandlers |
Definition at line 1738 of file ci.c.
Referenced by main(), 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().