Project

General

Profile

Feature #139 ยป seca-emm.patch

proposed patch - sbi -, 2010-03-21 12:20

View differences:

src/cwc.c (working copy)
55 55
typedef enum {
56 56
  CARD_IRDETO,
57 57
  CARD_CONAX,
58
  CARD_SECA,
58 59
  CARD_UNKNOWN
59 60
} card_type_t;
60 61

  
......
236 237
static void cwc_detect_card_type(cwc_t *cwc);
237 238
void cwc_emm_conax(cwc_t *cwc, uint8_t *data, int len);
238 239
void cwc_emm_irdeto(cwc_t *cwc, uint8_t *data, int len);
240
void cwc_emm_seca(cwc_t *cwc, uint8_t *data, int len);
239 241

  
240 242
/**
241 243
 *
......
612 614
    tvhlog(LOG_INFO, "cwc", "%s: conax card",
613 615
	   cwc->cwc_hostname);
614 616
    break;
617
  case 0x01:
618
    cwc->cwc_card_type = CARD_SECA;
619
    tvhlog(LOG_INFO, "cwc", "%s: seca card",
620
	   cwc->cwc_hostname);
621
    break;
615 622
  default:
616 623
    cwc->cwc_card_type = CARD_UNKNOWN;
617 624
    tvhlog(LOG_INFO, "cwc", "%s: unknown card",
......
1093 1100
      case CARD_IRDETO:
1094 1101
	cwc_emm_irdeto(cwc, data, len);
1095 1102
	break;
1103
      case CARD_SECA:
1104
	cwc_emm_seca(cwc, data, len);
1105
	break;
1096 1106
      case CARD_UNKNOWN:
1097 1107
	break;
1098 1108
      }
......
1153 1163

  
1154 1164

  
1155 1165
/**
1166
 * seca emm handler
1167
 * inspired by opensasc-ng, https://opensvn.csie.org/traccgi/opensascng/
1168
 */
1169
void
1170
cwc_emm_seca(cwc_t *cwc, uint8_t *data, int len)
1171
{
1172
  int match = 0;
1173

  
1174
  if (data[0] == 0x82) {
1175
    if (memcmp(&data[3], &cwc->cwc_ua[2], 6) == 0) {
1176
      match = 1;
1177
    }
1178
  } 
1179
  else if (data[0] == 0x84) {
1180
    /* XXX this part is untested but should do no harm */
1181
    int i;
1182
    for (i=0; i < cwc->cwc_num_providers; i++) {
1183
      if (memcmp(&data[5], &cwc->cwc_providers[i].sa[5], 3) == 0) {
1184
        match = 1;
1185
        break;
1186
      }
1187
    }
1188
  }
1189

  
1190
  if (match)
1191
    cwc_send_msg(cwc, data, len, 0, 1);
1192
}
1193

  
1194

  
1195
/**
1156 1196
 *
1157 1197
 */
1158 1198
static void
    (1-1/1)