Skip to content

Commit 35a102f

Browse files
AeonAeon
Aeon
authored and
Aeon
committedSep 28, 2015
added ecmfmt "t"
t = used tier (videoguard) git-svn-id: http://streamboard.de.vu/svn/oscam/trunk@11008 4b0bc96b-bc66-0410-9d44-ebda105a78c1
1 parent 333735e commit 35a102f

6 files changed

+43
-14
lines changed
 

‎globals.h

+1
Original file line numberDiff line numberDiff line change
@@ -1055,6 +1055,7 @@ struct s_ecm_answer
10551055
char msglog[MSGLOGSIZE];
10561056
struct timeb time_request_sent; //using for evaluate ecm_time
10571057
int32_t ecm_time;
1058+
uint16_t tier; //only filled by local videoguard reader atm
10581059
#ifdef WITH_LB
10591060
int32_t value;
10601061
int32_t time;

‎module-cw-cycle-check.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ static int32_t checkcwcycle_int(ECM_REQUEST *er, char *er_ecmf , char *user, uch
242242
cs_hexdump(0, cwc->ecm_md5[cwc->cwc_hist_entry].md5, 16, cwc_md5, sizeof(cwc_md5));
243243
cs_hexdump(0, (void *)&cwc->ecm_md5[cwc->cwc_hist_entry].csp_hash, 4, cwc_csp, sizeof(cwc_csp));
244244
cs_hexdump(0, cwc->cw, 16, cwc_cw, sizeof(cwc_cw));
245-
ecmfmt(cwc_ecmf, ECM_FMT_LEN, cwc->caid, 0, cwc->provid, cwc->chid, 0, cwc->sid, cwc->ecmlen, cwc_md5, cwc_csp, cwc_cw, 0, 0, NULL);
245+
ecmfmt(cwc_ecmf, ECM_FMT_LEN, cwc->caid, 0, cwc->provid, cwc->chid, 0, cwc->sid, cwc->ecmlen, cwc_md5, cwc_csp, cwc_cw, 0, 0, NULL, NULL);
246246

247247
// Cycletime over Cacheex
248248
if (cfg.cwcycle_usecwcfromce)

‎module-dvbapi-chancache.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ struct s_channel_cache *dvbapi_find_channel_cache(int32_t demux_id, int32_t pidi
151151

152152
#ifdef WITH_DEBUG
153153
char buf[ECM_FMT_LEN];
154-
ecmfmt(buf, ECM_FMT_LEN, c->caid, 0, c->prid, c->chid, c->pid, c->srvid, 0, 0, 0, 0, 0, 0, NULL);
154+
ecmfmt(buf, ECM_FMT_LEN, c->caid, 0, c->prid, c->chid, c->pid, c->srvid, 0, 0, 0, 0, 0, 0, NULL, NULL);
155155
cs_log_dbg(D_DVBAPI, "Demuxer %d found in channel cache: %s", demux_id, buf);
156156
#endif
157157
return c;
@@ -200,7 +200,7 @@ int32_t dvbapi_edit_channel_cache(int32_t demux_id, int32_t pidindex, uint8_t ad
200200
ll_append(channel_cache, c);
201201
#ifdef WITH_DEBUG
202202
char buf[ECM_FMT_LEN];
203-
ecmfmt(buf, ECM_FMT_LEN, c->caid, 0, c->prid, c->chid, c->pid, c->srvid, 0, 0, 0, 0, 0, 0, NULL);
203+
ecmfmt(buf, ECM_FMT_LEN, c->caid, 0, c->prid, c->chid, c->pid, c->srvid, 0, 0, 0, 0, 0, 0, NULL, NULL);
204204
cs_log_dbg(D_DVBAPI, "Demuxer %d added to channel cache: %s", demux_id, buf);
205205
#endif
206206
count++;

‎oscam-ecm.c

+28-9
Original file line numberDiff line numberDiff line change
@@ -2437,7 +2437,7 @@ void get_cw(struct s_client *client, ECM_REQUEST *er)
24372437

24382438

24392439
int32_t ecmfmt(char *result, size_t size, uint16_t caid, uint16_t onid, uint32_t prid, uint16_t chid, uint16_t pid,
2440-
uint16_t srvid, uint16_t l, char *ecmd5hex, char *csphash, char *cw, uint16_t origin_peer, uint8_t distance, char *payload)
2440+
uint16_t srvid, uint16_t l, char *ecmd5hex, char *csphash, char *cw, uint16_t origin_peer, uint8_t distance, char *payload, char *tier)
24412441
{
24422442
if(!cfg.ecmfmt)
24432443
{
@@ -2476,6 +2476,10 @@ int32_t ecmfmt(char *result, size_t size, uint16_t caid, uint16_t onid, uint32_t
24762476

24772477
switch(*c)
24782478
{
2479+
case 't':
2480+
type = ECMFMT_STRING;
2481+
svalue = tier;
2482+
break;
24792483
case 'c':
24802484
type = ECMFMT_NUMBER;
24812485
ifmt = "%04X";
@@ -2614,15 +2618,30 @@ int32_t format_ecm(ECM_REQUEST *ecm, char *result, size_t size)
26142618
char csphash[(4*2)+1] = { 0 };
26152619
char cwhex[(16*2)+1];
26162620
char *payload = NULL;
2621+
char *tier = NULL;
26172622
#ifdef READER_VIDEOGUARD
26182623
char payload_string[(3*2)+1];
2624+
char tier_string[83];
26192625
static const uint8_t nullBytes[6] = { 0, 0, 0, 0, 0, 0};
2626+
struct s_ecm_answer *ea;
26202627

2621-
if(ecm->selected_reader
2622-
&& memcmp(ecm->selected_reader->VgLastPayload, nullBytes, 6))
2623-
{
2624-
cs_hexdump(0, ecm->selected_reader->VgLastPayload, 3, payload_string, sizeof(payload_string));
2625-
payload = payload_string;
2628+
if(ecm->selected_reader && caid_is_videoguard(ecm->selected_reader->caid))
2629+
{
2630+
for(ea = ecm->matching_rdr; ea; ea = ea->next)
2631+
{
2632+
if((ea->status & REQUEST_ANSWERED) && !is_network_reader(ea->reader))
2633+
{
2634+
get_tiername(ea->tier, ecm->selected_reader->caid, tier_string);
2635+
tier = tier_string;
2636+
break;
2637+
}
2638+
}
2639+
2640+
if(memcmp(ecm->selected_reader->VgLastPayload, nullBytes, 6))
2641+
{
2642+
cs_hexdump(0, ecm->selected_reader->VgLastPayload, 3, payload_string, sizeof(payload_string));
2643+
payload = payload_string;
2644+
}
26262645
}
26272646
#endif
26282647
cs_hexdump(0, ecm->ecmd5, 16, ecmd5hex, sizeof(ecmd5hex));
@@ -2633,11 +2652,11 @@ int32_t format_ecm(ECM_REQUEST *ecm, char *result, size_t size)
26332652
#ifdef MODULE_GBOX
26342653
struct gbox_ecm_request_ext *ere = ecm->src_data;
26352654
if(ere && check_client(ecm->client) && get_module(ecm->client)->num == R_GBOX && ere->gbox_hops)
2636-
{ return ecmfmt(result, size, ecm->caid, ecm->onid, ecm->prid, ecm->chid, ecm->pid, ecm->srvid, ecm->ecmlen, ecmd5hex, csphash, cwhex, ere->gbox_peer, ere->gbox_hops, payload); }
2655+
{ return ecmfmt(result, size, ecm->caid, ecm->onid, ecm->prid, ecm->chid, ecm->pid, ecm->srvid, ecm->ecmlen, ecmd5hex, csphash, cwhex, ere->gbox_peer, ere->gbox_hops, payload, tier); }
26372656
else if (ecm->selected_reader && ecm->selected_reader->typ == R_GBOX && ecm->gbox_ecm_id)
2638-
{ return ecmfmt(result, size, ecm->caid, ecm->onid, ecm->prid, ecm->chid, ecm->pid, ecm->srvid, ecm->ecmlen, ecmd5hex, csphash, cwhex, ecm->gbox_ecm_id, 0, payload); }
2657+
{ return ecmfmt(result, size, ecm->caid, ecm->onid, ecm->prid, ecm->chid, ecm->pid, ecm->srvid, ecm->ecmlen, ecmd5hex, csphash, cwhex, ecm->gbox_ecm_id, 0, payload, tier); }
26392658
else
26402659
#endif
2641-
return ecmfmt(result, size, ecm->caid, ecm->onid, ecm->prid, ecm->chid, ecm->pid, ecm->srvid, ecm->ecmlen, ecmd5hex, csphash, cwhex, 0, 0, payload);
2660+
return ecmfmt(result, size, ecm->caid, ecm->onid, ecm->prid, ecm->chid, ecm->pid, ecm->srvid, ecm->ecmlen, ecmd5hex, csphash, cwhex, 0, 0, payload, tier);
26422661
}
26432662

‎oscam-ecm.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ uint8_t checkCWpart(uchar *cw, int8_t part);
4343
} while(0)
4444

4545
int32_t ecmfmt(char *result, size_t size, uint16_t caid, uint16_t onid, uint32_t prid, uint16_t chid, uint16_t pid,
46-
uint16_t srvid, uint16_t l, char *ecmd5hex, char *csphash, char *cw, uint16_t origin_peer, uint8_t distance, char *payload);
46+
uint16_t srvid, uint16_t l, char *ecmd5hex, char *csphash, char *cw, uint16_t origin_peer, uint8_t distance, char *payload, char *tier);
4747

4848
int32_t format_ecm(ECM_REQUEST *ecm, char *result, size_t size);
4949

‎reader-videoguard2.c

+10-1
Original file line numberDiff line numberDiff line change
@@ -1167,6 +1167,11 @@ static int32_t videoguard2_do_ecm(struct s_reader *reader, const ECM_REQUEST *er
11671167
switch(tag)
11681168
{
11691169
case 0x0F: // Debug ecm info
1170+
if(t_len > 6)
1171+
{
1172+
t_len = 6;
1173+
}
1174+
11701175
memcpy(buff_0F, t_body, t_len);
11711176
break;
11721177
case 0x25: // CW2 tag
@@ -1183,7 +1188,11 @@ static int32_t videoguard2_do_ecm(struct s_reader *reader, const ECM_REQUEST *er
11831188
}
11841189
ind += t_len + 2;
11851190
}
1186-
1191+
1192+
if(12 < payloadLen)
1193+
{
1194+
ea->tier = b2i(2, &payload[10]);
1195+
}
11871196

11881197
memcpy(reader->VgLastPayload, buff_0F, 6);
11891198

0 commit comments

Comments
 (0)
Please sign in to comment.