521
521
// the following is a workaround for CAMs that don't quite follow the specs...
523
523
for (int i = 0; i < MAX_CONNECT_RETRIES; i++) {
524
524
dsyslog("CAM: retrying to establish connection");
525
525
if (RecvTPDU() == T_CTC_REPLY) {
1865
1865
int cHlCiHandler::CommHL(unsigned tag, unsigned function, struct ca_msg *msg)
1868
msg->msg[2] = tag & 0xff;
1869
msg->msg[1] = (tag & 0xff00) >> 8;
1870
msg->msg[0] = (tag & 0xff0000) >> 16;
1871
esyslog("Sending message=[%02x %02x %02x ]",
1872
msg->msg[0], msg->msg[1], msg->msg[2]);
1868
msg->msg[2] = tag & 0xff;
1869
msg->msg[1] = (tag & 0xff00) >> 8;
1870
msg->msg[0] = (tag & 0xff0000) >> 16;
1871
esyslog("Sending message=[%02x %02x %02x ]",
1872
msg->msg[0], msg->msg[1], msg->msg[2]);
1875
1875
return ioctl(fdCa, function, msg);
1892
1892
struct ca_msg msg;
1893
1893
switch(state) {
1895
// Get CA_system_ids
1897
if ((SendData(AOT_CA_INFO_ENQ, &msg)) < 0) {
1898
esyslog("HLCI communication failed");
1900
dbgprotocol("==> Ca Info Enquiry");
1902
if ((GetData(AOT_CA_INFO, &msg)) < 0) {
1903
esyslog("HLCI communication failed");
1906
for(int i = 0; i < 20; i++) {
1907
printf("%d ", msg.msg[i]);
1910
dbgprotocol("<== Ca Info");
1912
const uint8_t *d = &msg.msg[4];
1914
unsigned short id = ((unsigned short)(*d) << 8) | *(d + 1);
1915
dbgprotocol(" %04X", id);
1918
if (numCaSystemIds < MAXCASYSTEMIDS) {
1919
caSystemIds[numCaSystemIds++] = id;
1920
caSystemIds[numCaSystemIds] = 0;
1923
esyslog("ERROR: too many CA system IDs!");
1895
// Get CA_system_ids
1897
if ((SendData(AOT_CA_INFO_ENQ, &msg)) < 0) {
1898
esyslog("HLCI communication failed");
1900
dbgprotocol("==> Ca Info Enquiry");
1902
if ((GetData(AOT_CA_INFO, &msg)) < 0) {
1903
esyslog("HLCI communication failed");
1906
for(int i = 0; i < 20; i++) {
1907
printf("%d ", msg.msg[i]);
1910
dbgprotocol("<== Ca Info");
1912
const uint8_t *d = &msg.msg[4];
1914
unsigned short id = ((unsigned short)(*d) << 8) | *(d + 1);
1915
dbgprotocol(" %04X", id);
1918
if (numCaSystemIds < MAXCASYSTEMIDS) {
1919
caSystemIds[numCaSystemIds++] = id;
1920
caSystemIds[numCaSystemIds] = 0;
1923
esyslog("ERROR: too many CA system IDs!");
1932
1932
bool result = true;
1967
1967
if (CaPmt.length > (256 - 4))
1969
esyslog("CA message too long");
1969
esyslog("CA message too long");
1973
1973
memcpy(&msg.msg[4], CaPmt.capmt, CaPmt.length);
1975
1975
if ((SendData(AOT_CA_PMT, &msg)) < 0) {
1976
esyslog("HLCI communication failed");
1976
esyslog("HLCI communication failed");
1983
1983
bool cHlCiHandler::Reset(int)
1985
1985
if ((ioctl(fdCa, CA_RESET)) < 0) {
1986
esyslog("ioctl CA_RESET failed.");
1986
esyslog("ioctl CA_RESET failed.");