mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-26 15:02:58 +02:00
rename tSlot -> eDVBCISlot
This commit is contained in:
@@ -7,11 +7,9 @@
|
||||
#include "dvbci_appmgr.h"
|
||||
|
||||
/* prevent possibly segfaults: read at end of this file */
|
||||
#define yy_debug 0
|
||||
#define yy_debug 0
|
||||
|
||||
static const char * FILENAME = "[dvbci_appmgr]";
|
||||
|
||||
eDVBCIApplicationManagerSession::eDVBCIApplicationManagerSession(tSlot *tslot)
|
||||
eDVBCIApplicationManagerSession::eDVBCIApplicationManagerSession(eDVBCISlot *tslot)
|
||||
{
|
||||
slot = tslot;
|
||||
slot->hasAppManager = true;
|
||||
@@ -26,7 +24,7 @@ eDVBCIApplicationManagerSession::~eDVBCIApplicationManagerSession()
|
||||
|
||||
int eDVBCIApplicationManagerSession::receivedAPDU(const unsigned char *tag, const void *data, int len)
|
||||
{
|
||||
printf("SESSION(%d)/APP %02x %02x %02x: ", session_nb, tag[0], tag[1], tag[2]);
|
||||
printf("[CI AM] SESSION(%d)/APP %02x %02x %02x: ", session_nb, tag[0], tag[1], tag[2]);
|
||||
for (int i = 0; i < len; i++)
|
||||
printf("%02x ", ((const unsigned char*)data)[i]);
|
||||
printf("\n");
|
||||
@@ -38,16 +36,16 @@ int eDVBCIApplicationManagerSession::receivedAPDU(const unsigned char *tag, cons
|
||||
case 0x21:
|
||||
{
|
||||
int dl;
|
||||
printf("application info:\n");
|
||||
printf(" len: %d\n", len);
|
||||
printf(" application_type: %d\n", ((unsigned char*)data)[0]);
|
||||
printf(" application_manufacturer: %02x %02x\n", ((unsigned char*)data)[2], ((unsigned char*)data)[1]);
|
||||
printf(" manufacturer_code: %02x %02x\n", ((unsigned char*)data)[4], ((unsigned char*)data)[3]);
|
||||
printf("[CI AM] application info:\n");
|
||||
printf("[CI AM] len: %d\n", len);
|
||||
printf("[CI AM] application_type: %d\n", ((unsigned char*)data)[0]);
|
||||
printf("[CI AM] application_manufacturer: %02x %02x\n", ((unsigned char*)data)[2], ((unsigned char*)data)[1]);
|
||||
printf("[CI AM] manufacturer_code: %02x %02x\n", ((unsigned char*)data)[4], ((unsigned char*)data)[3]);
|
||||
printf(" menu string: ");
|
||||
dl = ((unsigned char*)data)[5];
|
||||
if ((dl + 6) > len)
|
||||
{
|
||||
printf("warning, invalid length (%d vs %d)\n", dl + 6, len);
|
||||
printf("[CI AM] warning, invalid length (%d vs %d)\n", dl + 6, len);
|
||||
dl = len - 6;
|
||||
}
|
||||
char str[dl + 1];
|
||||
@@ -60,11 +58,11 @@ int eDVBCIApplicationManagerSession::receivedAPDU(const unsigned char *tag, cons
|
||||
strcpy(slot->name, str);
|
||||
if (!strcmp(slot->name, "AlphaCrypt"))
|
||||
slot->multi = true;
|
||||
printf("%s set cam name %s on slot(%d)\n", FILENAME, slot->name, slot->slot);
|
||||
printf("[CI AM] set cam name %s on slot(%d)\n", slot->name, slot->slot);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
printf("%s unknown APDU tag 9F 80 %02x\n", FILENAME, tag[2]);
|
||||
printf("[CI AM] unknown APDU tag 9F 80 %02x\n", tag[2]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -77,19 +75,19 @@ int eDVBCIApplicationManagerSession::doAction()
|
||||
{
|
||||
case stateStarted:
|
||||
{
|
||||
const unsigned char tag[3] = {0x9F, 0x80, 0x20};
|
||||
const unsigned char tag[3] = {0x9F, 0x80, 0x20}; // application manager info e sendAPDU(tag);
|
||||
sendAPDU(tag);
|
||||
state = stateFinal;
|
||||
checkBlist();
|
||||
return 1;
|
||||
}
|
||||
case stateFinal:
|
||||
printf("%s -> in final state\n", FILENAME);
|
||||
printf("[CI AM] in final state.");
|
||||
wantmenu = 0;
|
||||
if (wantmenu)
|
||||
{
|
||||
printf("%s wantmenu: sending Tenter_menu\n", FILENAME);
|
||||
const unsigned char tag[3] = {0x9F, 0x80, 0x22};
|
||||
printf("[CI AM] wantmenu: sending Tenter_menu");
|
||||
const unsigned char tag[3] = {0x9F, 0x80, 0x22}; // Tenter_menu
|
||||
sendAPDU(tag);
|
||||
wantmenu = 0;
|
||||
return 0;
|
||||
@@ -103,8 +101,8 @@ int eDVBCIApplicationManagerSession::doAction()
|
||||
|
||||
int eDVBCIApplicationManagerSession::startMMI()
|
||||
{
|
||||
printf("%s -> %s\n", FILENAME, __func__);
|
||||
const unsigned char tag[3] = {0x9F, 0x80, 0x22};
|
||||
printf("[CI AM] in appmanager -> startmmi()");
|
||||
const unsigned char tag[3] = {0x9F, 0x80, 0x22}; // Tenter_menu
|
||||
sendAPDU(tag);
|
||||
slot->mmiOpened = true;
|
||||
return 0;
|
||||
|
@@ -9,7 +9,7 @@ class eDVBCIApplicationManagerSession: public eDVBCISession
|
||||
stateFinal=statePrivate
|
||||
};
|
||||
|
||||
tSlot *slot;
|
||||
eDVBCISlot *slot;
|
||||
|
||||
int wantmenu;
|
||||
int receivedAPDU(const unsigned char *tag, const void *data, int len);
|
||||
@@ -17,7 +17,7 @@ class eDVBCIApplicationManagerSession: public eDVBCISession
|
||||
bool readBlist();
|
||||
int checkBlist();
|
||||
public:
|
||||
eDVBCIApplicationManagerSession(tSlot *tslot);
|
||||
eDVBCIApplicationManagerSession(eDVBCISlot *tslot);
|
||||
~eDVBCIApplicationManagerSession();
|
||||
int enterMenu();
|
||||
int startMMI();
|
||||
|
@@ -1,12 +1,11 @@
|
||||
/* DVB CI CA Manager */
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <algorithm>
|
||||
|
||||
#include "dvbci_camgr.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
eDVBCICAManagerSession::eDVBCICAManagerSession(tSlot *tslot)
|
||||
eDVBCICAManagerSession::eDVBCICAManagerSession(eDVBCISlot *tslot)
|
||||
{
|
||||
slot = tslot;
|
||||
}
|
||||
@@ -19,7 +18,7 @@ eDVBCICAManagerSession::~eDVBCICAManagerSession()
|
||||
|
||||
int eDVBCICAManagerSession::receivedAPDU(const unsigned char *tag, const void *data, int len)
|
||||
{
|
||||
printf("SESSION(%d)/CA %02x %02x %02x: ", session_nb, tag[0], tag[1], tag[2]);
|
||||
printf("[CI CA] SESSION(%d)/CA %02x %02x %02x: ", session_nb, tag[0], tag[1], tag[2]);
|
||||
for (int i = 0; i < len; i++)
|
||||
printf("%02x ", ((const unsigned char*)data)[i]);
|
||||
printf("\n");
|
||||
@@ -30,7 +29,7 @@ int eDVBCICAManagerSession::receivedAPDU(const unsigned char *tag, const void *d
|
||||
{
|
||||
case 0x31:
|
||||
{
|
||||
printf("ca info:\n");
|
||||
printf("[CI CA] ca info:\n");
|
||||
for (int i = 0; i < len; i += 2)
|
||||
{
|
||||
printf("%04x ", (((const unsigned char*)data)[i] << 8) | (((const unsigned char*)data)[i + 1]));
|
||||
@@ -51,7 +50,7 @@ int eDVBCICAManagerSession::receivedAPDU(const unsigned char *tag, const void *d
|
||||
}
|
||||
break;
|
||||
default:
|
||||
printf("unknown APDU tag 9F 80 %02x\n", tag[2]);
|
||||
printf("[CI CA] unknown APDU tag 9F 80 %02x\n", tag[2]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -70,7 +69,7 @@ int eDVBCICAManagerSession::doAction()
|
||||
return 0;
|
||||
}
|
||||
case stateFinal:
|
||||
printf("stateFinal und action! kann doch garnicht sein ;)\n");
|
||||
printf("[CI CA] stateFinal and action should not happen\n");
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
@@ -14,7 +14,7 @@ class eDVBCICAManagerSession: public eDVBCISession
|
||||
int receivedAPDU(const unsigned char *tag, const void *data, int len);
|
||||
int doAction();
|
||||
public:
|
||||
eDVBCICAManagerSession(tSlot *tslot);
|
||||
eDVBCICAManagerSession(eDVBCISlot *tslot);
|
||||
~eDVBCICAManagerSession();
|
||||
|
||||
const std::vector<uint16_t> &getCAIDs() const { return caids; }
|
||||
|
@@ -333,7 +333,7 @@ struct element {
|
||||
struct cc_ctrl_data {
|
||||
/* parent */
|
||||
//struct ci_session *session;
|
||||
tSlot *slot;
|
||||
eDVBCISlot *slot;
|
||||
|
||||
/* ci+ credentials */
|
||||
struct element elements[MAX_ELEMENTS];
|
||||
@@ -1039,7 +1039,7 @@ static int data_req_loop(struct cc_ctrl_data *cc_data, unsigned char *dest, cons
|
||||
return pos;
|
||||
}
|
||||
|
||||
bool eDVBCIContentControlManagerSession::data_initialize(tSlot *tslot)
|
||||
bool eDVBCIContentControlManagerSession::data_initialize(eDVBCISlot *tslot)
|
||||
{
|
||||
struct cc_ctrl_data *data;
|
||||
uint8_t buf[32], host_id[8];
|
||||
@@ -1093,7 +1093,7 @@ bool eDVBCIContentControlManagerSession::data_initialize(tSlot *tslot)
|
||||
return true;
|
||||
}
|
||||
|
||||
void eDVBCIContentControlManagerSession::ci_ccmgr_cc_open_cnf(tSlot *tslot)
|
||||
void eDVBCIContentControlManagerSession::ci_ccmgr_cc_open_cnf(eDVBCISlot *tslot)
|
||||
{
|
||||
const uint8_t tag[3] = { 0x9f, 0x90, 0x02 };
|
||||
const uint8_t bitmap = 0x01;
|
||||
@@ -1104,7 +1104,7 @@ void eDVBCIContentControlManagerSession::ci_ccmgr_cc_open_cnf(tSlot *tslot)
|
||||
sendAPDU(tag, &bitmap, 1);
|
||||
}
|
||||
|
||||
bool eDVBCIContentControlManagerSession::ci_ccmgr_cc_data_req(tSlot *tslot, const uint8_t *data, unsigned int len)
|
||||
bool eDVBCIContentControlManagerSession::ci_ccmgr_cc_data_req(eDVBCISlot *tslot, const uint8_t *data, unsigned int len)
|
||||
{
|
||||
struct cc_ctrl_data *cc_data = (struct cc_ctrl_data*)(tslot->private_data);
|
||||
uint8_t cc_data_cnf_tag[3] = { 0x9f, 0x90, 0x04 };
|
||||
@@ -1147,7 +1147,7 @@ bool eDVBCIContentControlManagerSession::ci_ccmgr_cc_data_req(tSlot *tslot, cons
|
||||
return true;
|
||||
}
|
||||
|
||||
void eDVBCIContentControlManagerSession::ci_ccmgr_cc_sac_sync_req(tSlot *tslot, const uint8_t *data, unsigned int
|
||||
void eDVBCIContentControlManagerSession::ci_ccmgr_cc_sac_sync_req(eDVBCISlot *tslot, const uint8_t *data, unsigned int
|
||||
#if y_debug
|
||||
len
|
||||
#endif
|
||||
@@ -1183,7 +1183,7 @@ void eDVBCIContentControlManagerSession::ci_ccmgr_cc_sync_req()
|
||||
sendAPDU(tag, &sync_req_status, 1);
|
||||
}
|
||||
|
||||
bool eDVBCIContentControlManagerSession::ci_ccmgr_cc_sac_send(tSlot *tslot, const uint8_t *tag, uint8_t *data, unsigned int pos)
|
||||
bool eDVBCIContentControlManagerSession::ci_ccmgr_cc_sac_send(eDVBCISlot *tslot, const uint8_t *tag, uint8_t *data, unsigned int pos)
|
||||
{
|
||||
struct cc_ctrl_data *cc_data = (struct cc_ctrl_data*)(tslot->private_data);
|
||||
printf("%s -> %s (%02X%02X%02X) \n", FILENAME, __FUNCTION__, tag[0], tag[1], tag[2]);
|
||||
@@ -1207,7 +1207,7 @@ bool eDVBCIContentControlManagerSession::ci_ccmgr_cc_sac_send(tSlot *tslot, cons
|
||||
return true;
|
||||
}
|
||||
|
||||
bool eDVBCIContentControlManagerSession::ci_ccmgr_cc_sac_data_req(tSlot *tslot, const uint8_t *data, unsigned int len)
|
||||
bool eDVBCIContentControlManagerSession::ci_ccmgr_cc_sac_data_req(eDVBCISlot *tslot, const uint8_t *data, unsigned int len)
|
||||
{
|
||||
struct cc_ctrl_data *cc_data = (struct cc_ctrl_data*)(tslot->private_data);
|
||||
const uint8_t data_cnf_tag[3] = { 0x9f, 0x90, 0x08 };
|
||||
@@ -1270,7 +1270,7 @@ bool eDVBCIContentControlManagerSession::ci_ccmgr_cc_sac_data_req(tSlot *tslot,
|
||||
return ci_ccmgr_cc_sac_send(tslot, data_cnf_tag, dest, pos);
|
||||
}
|
||||
|
||||
eDVBCIContentControlManagerSession::eDVBCIContentControlManagerSession(tSlot *tslot)
|
||||
eDVBCIContentControlManagerSession::eDVBCIContentControlManagerSession(eDVBCISlot *tslot)
|
||||
{
|
||||
slot = tslot;
|
||||
slot->hasCCManager = true;
|
||||
@@ -1284,7 +1284,7 @@ eDVBCIContentControlManagerSession::~eDVBCIContentControlManagerSession()
|
||||
slot->ccmgrSession = NULL;
|
||||
}
|
||||
|
||||
void eDVBCIContentControlManagerSession::ci_ccmgr_doClose(tSlot *tslot)
|
||||
void eDVBCIContentControlManagerSession::ci_ccmgr_doClose(eDVBCISlot *tslot)
|
||||
{
|
||||
struct cc_ctrl_data *data = (struct cc_ctrl_data*)(tslot->private_data);
|
||||
printf("%s -> %s\n", FILENAME, __FUNCTION__);
|
||||
@@ -1339,12 +1339,13 @@ int eDVBCIContentControlManagerSession::doAction()
|
||||
}
|
||||
}
|
||||
|
||||
void eDVBCIContentControlManagerSession::resendKey(tSlot *tslot)
|
||||
void eDVBCIContentControlManagerSession::resendKey(eDVBCISlot *tslot)
|
||||
{
|
||||
/* Fix me ! no ci* cam with multi decrypt is known
|
||||
* therefore for now it is OK to use element [0]
|
||||
* in bool arrays */
|
||||
|
||||
* in bool arrays
|
||||
*/
|
||||
|
||||
if (!tslot->SidBlackListed && (tslot->recordUse[0] || tslot->liveUse[0]))
|
||||
descrambler_set_key((int)tslot->source, tslot->lastParity, tslot->lastKey);
|
||||
}
|
||||
|
@@ -5,13 +5,13 @@
|
||||
|
||||
class eDVBCIContentControlManagerSession: public eDVBCISession
|
||||
{
|
||||
bool data_initialize(tSlot *tslot);
|
||||
bool ci_ccmgr_cc_data_req(tSlot *tslot, const uint8_t *data, unsigned int len);
|
||||
bool ci_ccmgr_cc_sac_data_req(tSlot *tslot, const uint8_t *data, unsigned int len);
|
||||
bool ci_ccmgr_cc_sac_send(tSlot *tslot, const uint8_t *tag, uint8_t *data, unsigned int pos);
|
||||
void ci_ccmgr_cc_sac_sync_req(tSlot *tslot, const uint8_t *data, unsigned int len);
|
||||
bool data_initialize(eDVBCISlot *tslot);
|
||||
bool ci_ccmgr_cc_data_req(eDVBCISlot *tslot, const uint8_t *data, unsigned int len);
|
||||
bool ci_ccmgr_cc_sac_data_req(eDVBCISlot *tslot, const uint8_t *data, unsigned int len);
|
||||
bool ci_ccmgr_cc_sac_send(eDVBCISlot *tslot, const uint8_t *tag, uint8_t *data, unsigned int pos);
|
||||
void ci_ccmgr_cc_sac_sync_req(eDVBCISlot *tslot, const uint8_t *data, unsigned int len);
|
||||
void ci_ccmgr_cc_sync_req();
|
||||
void ci_ccmgr_cc_open_cnf(tSlot *slot);
|
||||
void ci_ccmgr_cc_open_cnf(eDVBCISlot *slot);
|
||||
|
||||
enum {
|
||||
stateFinal=statePrivate
|
||||
@@ -19,9 +19,9 @@ class eDVBCIContentControlManagerSession: public eDVBCISession
|
||||
int receivedAPDU(const unsigned char *tag, const void *data, int len);
|
||||
int doAction();
|
||||
public:
|
||||
eDVBCIContentControlManagerSession(tSlot *tslot);
|
||||
eDVBCIContentControlManagerSession(eDVBCISlot *tslot);
|
||||
~eDVBCIContentControlManagerSession();
|
||||
void ci_ccmgr_doClose(tSlot *tslot);
|
||||
void resendKey(tSlot *tslot);
|
||||
void ci_ccmgr_doClose(eDVBCISlot *tslot);
|
||||
void resendKey(eDVBCISlot *tslot);
|
||||
};
|
||||
#endif
|
||||
|
@@ -6,9 +6,7 @@
|
||||
|
||||
#include "dvbci_datetimemgr.h"
|
||||
|
||||
static const char * FILENAME = "[dvbci_datetimemgr]";
|
||||
|
||||
eDVBCIDateTimeSession::eDVBCIDateTimeSession(tSlot *tslot)
|
||||
eDVBCIDateTimeSession::eDVBCIDateTimeSession(eDVBCISlot *tslot)
|
||||
{
|
||||
slot = tslot;
|
||||
slot->hasDateTime = true;
|
||||
@@ -22,7 +20,7 @@ eDVBCIDateTimeSession::~eDVBCIDateTimeSession()
|
||||
|
||||
int eDVBCIDateTimeSession::receivedAPDU(const unsigned char *tag, const void *data, int len)
|
||||
{
|
||||
printf("SESSION(%d)/DATETIME %02x %02x %02x: ", session_nb, tag[0], tag[1], tag[2]);
|
||||
printf("[CI DT] SESSION(%d)/DATETIME %02x %02x %02x: ", session_nb, tag[0], tag[1], tag[2]);
|
||||
for (int i = 0; i < len; i++)
|
||||
printf("%02x ", ((const unsigned char*)data)[i]);
|
||||
printf("\n");
|
||||
@@ -36,7 +34,7 @@ int eDVBCIDateTimeSession::receivedAPDU(const unsigned char *tag, const void *da
|
||||
return 1;
|
||||
break;
|
||||
default:
|
||||
printf("unknown APDU tag 9F 84 %02x\n", tag[2]);
|
||||
printf("[CI DT] unknown APDU tag 9F 84 %02x\n", tag[2]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -11,7 +11,7 @@ class eDVBCIDateTimeSession: public eDVBCISession
|
||||
int receivedAPDU(const unsigned char *tag, const void *data, int len);
|
||||
int doAction();
|
||||
public:
|
||||
eDVBCIDateTimeSession(tSlot *tslot);
|
||||
eDVBCIDateTimeSession(eDVBCISlot *tslot);
|
||||
~eDVBCIDateTimeSession();
|
||||
};
|
||||
|
||||
|
@@ -7,11 +7,8 @@
|
||||
#include "dvbci_mmi.h"
|
||||
#include <ca_cs.h>
|
||||
|
||||
static const char * FILENAME = "[dvbci_mmi]";
|
||||
|
||||
eDVBCIMMISession::eDVBCIMMISession(tSlot *tslot)
|
||||
eDVBCIMMISession::eDVBCIMMISession(eDVBCISlot *tslot)
|
||||
{
|
||||
printf("%s -> %s\n", FILENAME, __func__);
|
||||
slot = tslot;
|
||||
slot->hasMMIManager = true;
|
||||
slot->mmiSession = this;
|
||||
@@ -35,7 +32,7 @@ eDVBCIMMISession::~eDVBCIMMISession()
|
||||
|
||||
int eDVBCIMMISession::receivedAPDU(const unsigned char *tag, const void *data, int len)
|
||||
{
|
||||
printf("SESSION(%d)/MMI %02x %02x %02x: ", session_nb, tag[0], tag[1], tag[2]);
|
||||
printf("[CI MMI] SESSION(%d)/MMI %02x %02x %02x: ", session_nb, tag[0], tag[1], tag[2]);
|
||||
for (int i = 0; i < len; i++)
|
||||
printf("%02x ", ((const unsigned char*)data)[i]);
|
||||
printf("\n");
|
||||
@@ -235,7 +232,7 @@ int eDVBCIMMISession::doAction()
|
||||
|
||||
int eDVBCIMMISession::stopMMI()
|
||||
{
|
||||
printf("%s -> %s\n", FILENAME, __func__);
|
||||
printf("[CI MMI] eDVBCIMMISession::stopMMI()\n");
|
||||
|
||||
unsigned char tag[] = {0x9f, 0x88, 0x00};
|
||||
unsigned char data[] = {0x00};
|
||||
@@ -247,7 +244,7 @@ int eDVBCIMMISession::stopMMI()
|
||||
|
||||
int eDVBCIMMISession::answerText(int answer)
|
||||
{
|
||||
printf("%s -> %s(%d)\n", FILENAME, __func__, answer);
|
||||
printf("[CI MMI] eDVBCIMMISession::answerText(%d)\n",answer);
|
||||
|
||||
unsigned char tag[] = {0x9f, 0x88, 0x0B};
|
||||
unsigned char data[] = {0x00};
|
||||
@@ -257,9 +254,9 @@ int eDVBCIMMISession::answerText(int answer)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int eDVBCIMMISession::answerEnq(char * answer, int len)
|
||||
int eDVBCIMMISession::answerEnq(char *answer, int len)
|
||||
{
|
||||
printf("%s -> %s(%d bytes)\n", FILENAME, __func__, len);
|
||||
printf("[CI MMI] eDVBCIMMISession::answerEnq(%d bytes)\n", len);
|
||||
|
||||
unsigned char data[len + 1];
|
||||
data[0] = 0x01; // answer ok
|
||||
@@ -273,7 +270,7 @@ int eDVBCIMMISession::answerEnq(char * answer, int len)
|
||||
|
||||
int eDVBCIMMISession::cancelEnq()
|
||||
{
|
||||
printf("%s -> %s\n", FILENAME, __func__);
|
||||
printf("[CI MMI] eDVBCIMMISession::cancelEnq()\n");
|
||||
|
||||
unsigned char tag[] = {0x9f, 0x88, 0x08};
|
||||
unsigned char data[] = {0x00}; // canceled
|
||||
|
@@ -11,9 +11,9 @@ class eDVBCIMMISession: public eDVBCISession
|
||||
|
||||
int receivedAPDU(const unsigned char *tag, const void *data, int len);
|
||||
int doAction();
|
||||
tSlot *slot;
|
||||
eDVBCISlot *slot;
|
||||
public:
|
||||
eDVBCIMMISession(tSlot *tslot);
|
||||
eDVBCIMMISession(eDVBCISlot *tslot);
|
||||
~eDVBCIMMISession();
|
||||
int stopMMI();
|
||||
int answerText(int answer);
|
||||
|
@@ -1,12 +1,11 @@
|
||||
/* DVB CI Resource Manager */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "dvbci_resmgr.h"
|
||||
|
||||
static const char * FILENAME = "[dvbci_resmgr]";
|
||||
|
||||
int eDVBCIResourceManagerSession::receivedAPDU(const unsigned char *tag, const void *data, int len)
|
||||
{
|
||||
printf("SESSION(%d)RES %02x %02x %02x (len = %d): \n", session_nb, tag[0], tag[1], tag[2], len);
|
||||
printf("[CI RM] SESSION(%d)RES %02x %02x %02x (len = %d): \n", session_nb, tag[0], tag[1], tag[2], len);
|
||||
if (len)
|
||||
{
|
||||
for (int i = 0; i < len; i++)
|
||||
@@ -18,12 +17,12 @@ int eDVBCIResourceManagerSession::receivedAPDU(const unsigned char *tag, const v
|
||||
switch (tag[2])
|
||||
{
|
||||
case 0x10: // profile enquiry
|
||||
printf("%s -> cam asks what I'm able to\n", FILENAME);
|
||||
printf("[CI RM] cam profile inquiry\n");
|
||||
state = stateProfileEnquiry;
|
||||
return 1;
|
||||
break;
|
||||
case 0x11: // Tprofile
|
||||
printf("%s -> my cam can do: ", FILENAME);
|
||||
printf("[CI RM] -> my cam can do: ");
|
||||
if (!len)
|
||||
printf("nothing");
|
||||
else
|
||||
@@ -39,9 +38,10 @@ int eDVBCIResourceManagerSession::receivedAPDU(const unsigned char *tag, const v
|
||||
state = stateFinal;
|
||||
break;
|
||||
default:
|
||||
printf("%s %s unknown APDU tag 9F 80 %02x\n", FILENAME, __FUNCTION__, tag[2]);
|
||||
printf("[CI RM] unknown APDU tag 9F 80 %02x\n", tag[2]);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ int eDVBCIResourceManagerSession::doAction()
|
||||
}
|
||||
case stateProfileChange:
|
||||
{
|
||||
printf("bla kaputt\n");
|
||||
printf("[CI RM] cannot deal with statProfileChange\n");
|
||||
break;
|
||||
}
|
||||
case stateProfileEnquiry:
|
||||
@@ -108,7 +108,7 @@ int eDVBCIResourceManagerSession::doAction()
|
||||
return 0;
|
||||
}
|
||||
case stateFinal:
|
||||
printf("stateFinal und action! kann doch garnicht sein ;)\n");
|
||||
printf("[CI RM] Should not happen: action on stateFinal\n");
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
/* DVB CI Transport Connection */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
@@ -11,8 +12,6 @@
|
||||
#include "dvbci_mmi.h"
|
||||
#include "dvbci_ccmgr.h"
|
||||
|
||||
static const char * FILENAME = "[dvbci_session]";
|
||||
|
||||
eDVBCISession* eDVBCISession::sessions[SLMS];
|
||||
|
||||
int eDVBCISession::buildLengthField(unsigned char *pkt, int len)
|
||||
@@ -94,10 +93,11 @@ void eDVBCISession::sendSPDU(tSlot *slot, unsigned char tag, const void *data, i
|
||||
sendData(slot, pkt, ptr - pkt);
|
||||
}
|
||||
|
||||
void eDVBCISession::sendOpenSessionResponse(tSlot *slot, unsigned char session_status, const unsigned char *resource_identifier, unsigned short session_nb)
|
||||
void eDVBCISession::sendOpenSessionResponse(eDVBCISlot *slot, unsigned char session_status, const unsigned char *resource_identifier, unsigned short session_nb)
|
||||
{
|
||||
char pkt[6];
|
||||
pkt[0] = session_status;
|
||||
printf("[CI SESS] sendOpenSessionResponse");
|
||||
memcpy(pkt + 1, resource_identifier, 4);
|
||||
sendSPDU(slot, 0x92, pkt, 5, session_nb);
|
||||
}
|
||||
@@ -107,7 +107,7 @@ void eDVBCISession::recvCreateSessionResponse(const unsigned char *data)
|
||||
status = data[0];
|
||||
state = stateStarted;
|
||||
action = 1;
|
||||
printf("%s -> %s status(%x)\n", FILENAME, __func__, status);
|
||||
printf("[CI SESS] create Session Response, status %x\n", status);
|
||||
}
|
||||
|
||||
void eDVBCISession::recvCloseSessionRequest(const unsigned char *data)
|
||||
@@ -115,13 +115,11 @@ void eDVBCISession::recvCloseSessionRequest(const unsigned char *data)
|
||||
status = data[0];
|
||||
state = stateInDeletion;
|
||||
action = 1;
|
||||
printf("%s -> %s\n", FILENAME, __func__);
|
||||
printf("[CI SESS] close Session Request\n");
|
||||
}
|
||||
|
||||
void eDVBCISession::deleteSessions(const tSlot *slot)
|
||||
void eDVBCISession::deleteSessions(const eDVBCISlot *slot)
|
||||
{
|
||||
printf("%s -> %s\n", FILENAME, __func__);
|
||||
|
||||
for (unsigned short session_nb = 0; session_nb < SLMS; ++session_nb)
|
||||
{
|
||||
if (sessions[session_nb] && sessions[session_nb]->slot == slot)
|
||||
@@ -129,18 +127,16 @@ void eDVBCISession::deleteSessions(const tSlot *slot)
|
||||
}
|
||||
}
|
||||
|
||||
eDVBCISession* eDVBCISession::createSession(tSlot *slot, const unsigned char *resource_identifier, unsigned char &status)
|
||||
eDVBCISession* eDVBCISession::createSession(eDVBCISlot *slot, const unsigned char *resource_identifier, unsigned char &status)
|
||||
{
|
||||
unsigned long tag;
|
||||
unsigned short session_nb;
|
||||
|
||||
printf("%s -> %s\n", FILENAME, __func__);
|
||||
|
||||
for (session_nb = 1; session_nb < SLMS; ++session_nb)
|
||||
if (!sessions[session_nb - 1])
|
||||
break;
|
||||
|
||||
printf("%s -> use session_nb = %d\n", FILENAME, session_nb);
|
||||
printf("[CI SESS] -> use session_nb = %d\n", session_nb);
|
||||
if (session_nb == SLMS)
|
||||
{
|
||||
status = 0xF3;
|
||||
@@ -152,56 +148,56 @@ eDVBCISession* eDVBCISession::createSession(tSlot *slot, const unsigned char *re
|
||||
tag |= resource_identifier[2] << 8;
|
||||
tag |= resource_identifier[3];
|
||||
|
||||
printf("Tag: %08lx > ", tag);
|
||||
printf("[CI SESS] Tag: %08lx > ", tag);
|
||||
|
||||
switch (tag)
|
||||
{
|
||||
case 0x00010041:
|
||||
sessions[session_nb - 1] = new eDVBCIResourceManagerSession;
|
||||
printf("RESOURCE MANAGER\n");
|
||||
printf("[CI SESS] RESOURCE MANAGER\n");
|
||||
break;
|
||||
case 0x00020041:
|
||||
case 0x00020043:
|
||||
sessions[session_nb - 1] = new eDVBCIApplicationManagerSession(slot);
|
||||
printf("APPLICATION MANAGER\n");
|
||||
printf("[CI SESS] APPLICATION MANAGER\n");
|
||||
break;
|
||||
case 0x00030041:
|
||||
sessions[session_nb - 1] = new eDVBCICAManagerSession(slot);
|
||||
printf("CA MANAGER\n");
|
||||
printf("[CI SESS] CA MANAGER\n");
|
||||
break;
|
||||
case 0x00240041:
|
||||
sessions[session_nb - 1] = new eDVBCIDateTimeSession(slot);
|
||||
printf("DATE-TIME\n");
|
||||
printf("[CI SESS] DATE-TIME\n");
|
||||
break;
|
||||
case 0x00400041:
|
||||
printf("MMI\n");
|
||||
sessions[session_nb - 1] = new eDVBCIMMISession(slot);
|
||||
printf("[CI SESS] MMI - create session\n");
|
||||
break;
|
||||
if (cCA::GetInstance()->CheckCerts())
|
||||
{
|
||||
case 0x008c1001:
|
||||
printf("CC MANAGER\n");
|
||||
printf("[CI SESS] CC MANAGER\n");
|
||||
sessions[session_nb - 1] = new eDVBCIContentControlManagerSession(slot);
|
||||
break;
|
||||
}
|
||||
case 0x00100041:
|
||||
// session=new eDVBCIAuthSession;
|
||||
printf("AuthSession\n");
|
||||
printf("[CI SESS] AuthSession\n");
|
||||
// break;
|
||||
case 0x00200041:
|
||||
default:
|
||||
printf("unknown resource type %02x %02x %02x %02x\n", resource_identifier[0], resource_identifier[1], resource_identifier[2], resource_identifier[3]);
|
||||
printf("[CI SESS] unknown resource type %02x %02x %02x %02x\n", resource_identifier[0], resource_identifier[1], resource_identifier[2], resource_identifier[3]);
|
||||
sessions[session_nb - 1] = 0;
|
||||
status = 0xF0;
|
||||
}
|
||||
|
||||
if (!sessions[session_nb - 1])
|
||||
{
|
||||
printf("unknown session.. expect crash\n");
|
||||
printf("[CI SESS] unknown session.. expect crash\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
printf("%s -> new session nb %d %p\n", FILENAME, session_nb, sessions[session_nb - 1]);
|
||||
printf("[CI SESS] new session nb %d %p\n", session_nb, sessions[session_nb - 1]);
|
||||
sessions[session_nb - 1]->session_nb = session_nb;
|
||||
|
||||
if (sessions[session_nb - 1])
|
||||
@@ -215,7 +211,7 @@ eDVBCISession* eDVBCISession::createSession(tSlot *slot, const unsigned char *re
|
||||
|
||||
void eDVBCISession::handleClose()
|
||||
{
|
||||
printf("%s %s\n", FILENAME, __FUNCTION__);
|
||||
printf("%s\n", __FUNCTION__);
|
||||
|
||||
unsigned char data[1] = {0x00};
|
||||
sendSPDU(0x96, data, 1, 0, 0);
|
||||
@@ -228,6 +224,7 @@ int eDVBCISession::pollAll()
|
||||
if (sessions[session_nb - 1])
|
||||
{
|
||||
int r;
|
||||
|
||||
if (sessions[session_nb - 1]->state == stateInDeletion)
|
||||
{
|
||||
sessions[session_nb - 1]->handleClose();
|
||||
@@ -246,22 +243,23 @@ int eDVBCISession::pollAll()
|
||||
return 0;
|
||||
}
|
||||
|
||||
void eDVBCISession::receiveData(tSlot *slot, const unsigned char *ptr, size_t len)
|
||||
void eDVBCISession::receiveData(eDVBCISlot *slot, const unsigned char *ptr, size_t len)
|
||||
{
|
||||
printf("%s -> %s\n",FILENAME, __FUNCTION__);
|
||||
#if 0
|
||||
for(unsigned int i = 0; i < len; i++)
|
||||
printf("%02x ", ptr[i]);
|
||||
printf("\n");
|
||||
#endif
|
||||
if ((ptr[0] == 0x90 || ptr[0] == 0x95) && (ptr[3] == 0 ))
|
||||
{
|
||||
printf("****Mist: %02x %02x %02x %02x\n", ptr[0], ptr[1], ptr[2], ptr[3]);
|
||||
printf("[CI SESS] ****Mist: %02x %02x %02x %02x\n", ptr[0], ptr[1], ptr[2], ptr[3]);
|
||||
}
|
||||
const unsigned char *pkt = (const unsigned char*)ptr;
|
||||
unsigned char tag = *pkt++;
|
||||
int llen, hlen;
|
||||
|
||||
printf("[CI SESS] slot: %p",slot);
|
||||
|
||||
#if 0
|
||||
for(unsigned int i = 0; i < len; i++)
|
||||
printf("%02x ", ptr[i]);
|
||||
printf("\n");
|
||||
#endif
|
||||
|
||||
llen = parseLengthField(pkt, hlen);
|
||||
pkt += llen;
|
||||
@@ -290,14 +288,14 @@ void eDVBCISession::receiveData(tSlot *slot, const unsigned char *ptr, size_t le
|
||||
|
||||
if ((!session_nb) || (session_nb >= SLMS))
|
||||
{
|
||||
printf("PROTOCOL: illegal session number %x\n", session_nb);
|
||||
printf("[CI SESS] PROTOCOL: illegal session number %x\n", session_nb);
|
||||
return;
|
||||
}
|
||||
|
||||
session = sessions[session_nb - 1];
|
||||
if (!session)
|
||||
{
|
||||
printf("PROTOCOL: data on closed session %x\n", session_nb);
|
||||
printf("[CI SESS] PROTOCOL: data on closed session %x\n", session_nb);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -309,10 +307,11 @@ void eDVBCISession::receiveData(tSlot *slot, const unsigned char *ptr, size_t le
|
||||
session->recvCreateSessionResponse(pkt);
|
||||
break;
|
||||
case 0x95:
|
||||
printf("[CI SESS] recvCloseSessionRequest");
|
||||
session->recvCloseSessionRequest(pkt);
|
||||
break;
|
||||
default:
|
||||
printf("INTERNAL: nyi, tag %02x.\n", tag);
|
||||
printf("[CI SESS] INTERNAL: nyi, tag %02x.\n", tag);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -324,7 +323,6 @@ void eDVBCISession::receiveData(tSlot *slot, const unsigned char *ptr, size_t le
|
||||
|
||||
if (session)
|
||||
{
|
||||
//printf("len %d\n", len);
|
||||
while (len > 0)
|
||||
{
|
||||
int alen;
|
||||
@@ -339,7 +337,7 @@ void eDVBCISession::receiveData(tSlot *slot, const unsigned char *ptr, size_t le
|
||||
|
||||
if (((len - alen) > 0) && ((len - alen) < 3))
|
||||
{
|
||||
printf("WORKAROUND: applying work around MagicAPDULength\n");
|
||||
printf("[CI SESS] WORKAROUND: applying work around MagicAPDULength\n");
|
||||
alen = len;
|
||||
}
|
||||
|
||||
@@ -352,7 +350,7 @@ void eDVBCISession::receiveData(tSlot *slot, const unsigned char *ptr, size_t le
|
||||
}
|
||||
}
|
||||
if (len)
|
||||
printf("PROTOCOL: warning, TL-Data has invalid length\n");
|
||||
printf("[CI SESS] PROTOCOL: warning, TL-Data has invalid length\n");
|
||||
}
|
||||
|
||||
eDVBCISession::~eDVBCISession()
|
||||
|
@@ -12,16 +12,16 @@
|
||||
class eDVBCISession
|
||||
{
|
||||
static eDVBCISession* sessions[SLMS];
|
||||
static eDVBCISession* createSession(tSlot *slot, const unsigned char *resource_identifier, unsigned char &status);
|
||||
static void sendSPDU(tSlot *slot, unsigned char tag,const void *data, int len, unsigned short session_nb, const void *apdu = 0, int alen = 0);
|
||||
static void sendOpenSessionResponse(tSlot *slot,unsigned char session_status, const unsigned char *resource_identifier, unsigned short session_nb);
|
||||
static eDVBCISession* createSession(eDVBCISlot *slot, const unsigned char *resource_identifier, unsigned char &status);
|
||||
static void sendSPDU(eDVBCISlot *slot, unsigned char tag,const void *data, int len, unsigned short session_nb, const void *apdu = 0, int alen = 0);
|
||||
static void sendOpenSessionResponse(eDVBCISlot *slot,unsigned char session_status, const unsigned char *resource_identifier, unsigned short session_nb);
|
||||
void recvCreateSessionResponse(const unsigned char *data);
|
||||
void recvCloseSessionRequest(const unsigned char *data);
|
||||
protected:
|
||||
int state;
|
||||
int status;
|
||||
int action;
|
||||
tSlot *slot;
|
||||
eDVBCISlot *slot;
|
||||
unsigned short session_nb;
|
||||
virtual int receivedAPDU(const unsigned char *tag, const void *data, int len) = 0;
|
||||
void sendAPDU(const unsigned char *tag, const void *data=0,int len=0);
|
||||
@@ -30,7 +30,7 @@ protected:
|
||||
public:
|
||||
virtual ~eDVBCISession();
|
||||
|
||||
static void deleteSessions(const tSlot *slot);
|
||||
static void deleteSessions(const eDVBCISlot *slot);
|
||||
void sendSPDU(unsigned char tag, const void *data, int len, const void *apdu = 0, int alen = 0);
|
||||
|
||||
int poll() { if (action) { action=doAction(); return 1; } return 0; }
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
static int parseLengthField(const unsigned char *pkt, int &len);
|
||||
static int buildLengthField(unsigned char *pkt, int len);
|
||||
|
||||
static void receiveData(tSlot *slot, const unsigned char *ptr, size_t len);
|
||||
static void receiveData(eDVBCISlot *slot, const unsigned char *ptr, size_t len);
|
||||
|
||||
int getState() { return state; }
|
||||
int getStatus() { return status; }
|
||||
|
Reference in New Issue
Block a user