コード例 #1
0
static void show_class(struct s_reader * reader, const char *p, const uchar *b, int32_t l)
{
	int32_t i, j;

	// b -> via date (4 bytes)
	b+=4;
	l-=4;

	j=l-1;
	for (; j>=0; j--)
		for (i=0; i<8; i++)
			if (b[j] & (1 << (i&7)))
			{
				uchar cls;
				struct via_date vd;
				parse_via_date(b-4, &vd, 1);
				cls=(l-(j+1))*8+i;
				if (p)
					cs_log("%sclass: %02X, expiry date: %04d/%02d/%02d - %04d/%02d/%02d", p, cls,
					vd.year_s+1980, vd.month_s, vd.day_s,
					vd.year_e+1980, vd.month_e, vd.day_e);
				else
					cs_ri_log(reader, "class: %02X, expiry date: %04d/%02d/%02d - %04d/%02d/%02d", cls,
					vd.year_s+1980, vd.month_s, vd.day_s,
					vd.year_e+1980, vd.month_e, vd.day_e);
			}
}
コード例 #2
0
static void get_via_data(const uchar *b, int32_t l, time_t *start_t, time_t *end_t, uchar *cls)
{
	int32_t i, j;
	struct via_date vd;
	struct tm tm;
	memset(&vd, 0, sizeof(struct via_date));

	// b -> via date (4 bytes)
	b+=4;
	l-=4;

	j=l-1;
	for (; j>=0; j--)
		for (i=0; i<8; i++)
			if (b[j] & (1 << (i&7)))
			{
				parse_via_date(b-4, &vd, 1);
				*cls=(l-(j+1))*8+i;
			}

	memset(&tm, 0, sizeof(struct tm));
	tm.tm_year = vd.year_s + 80;	//via year starts in 1980, tm_year starts in 1900
	tm.tm_mon = vd.month_s - 1;	// january is 0 in tm_mon
	tm.tm_mday = vd.day_s;
	*start_t = mktime(&tm);

	tm.tm_year = vd.year_e + 80;
	tm.tm_mon = vd.month_e - 1;
	tm.tm_mday = vd.day_e;
	*end_t = mktime(&tm);

}
コード例 #3
0
ファイル: reader-viaccess.c プロジェクト: bowman-gh/oscam
static void show_subs(struct s_reader * reader, const uchar *emm)
{
	// emm -> A9, A6, B6

	switch( emm[0] )
	{
	case 0xA9:
		show_class(reader, "nano A9: ", 0, emm+2, emm[1]);
		break;
		/*
		{
		int32_t i, j, byts;
		const uchar *oemm;

		oemm = emm;
		byts = emm[1]-4;
		emm+=6;

		j=byts-1;
		for( ; j>=0; j-- )
		for( i=0; i<8; i++ )
		if( emm[j] & (1 << (i&7)) )
		{
		uchar cls;
		struct via_date vd;
		parse_via_date(emm-4, &vd, 1);
		cls=(byts-(j+1))*8+i;
		rdr_log(reader, "%sclass %02X: expiry date: %02d/%02d/%04d - %02d/%02d/%04d",
		fnano?"nano A9: ":"", cls,
		vd.day_s, vd.month_s, vd.year_s+1980,
		vd.day_e, vd.month_e, vd.year_e+1980);
		}
		break;
		}
		*/
	case 0xA6:
		{
			char szGeo[256];

			memset(szGeo, 0, 256);
			strncpy(szGeo, (char *)emm+2, emm[1]);
			rdr_log(reader, "nano A6: geo %s", szGeo);
			break;
		}
	case 0xB6:
		{
			uchar m; // modexp
			struct via_date vd;

			m=emm[emm[1]+1];
			parse_via_date(emm+2, &vd, 0);
			rdr_log(reader, "nano B6: modexp %d%d%d%d%d%d: %02d/%02d/%04d", (m&0x20)?1:0,
				(m&0x10)?1:0,(m&0x08)?1:0,(m&0x04)?1:0,(m&0x02)?1:0,(m&0x01)?1:0,
				vd.day_s, vd.month_s, vd.year_s+1980);
			break;
		}
	}
}
コード例 #4
0
ファイル: reader-viaccess.c プロジェクト: bowman-gh/oscam
static void show_class(struct s_reader *reader, const char *p, uint32_t provid, const uchar *b, int32_t l)
{
	int32_t i, j;

	// b -> via date (4 bytes)
	b+=4;
	l-=4;

	j=l-1;
	for (; j>=0; j--)
		for (i=0; i<8; i++)
			if (b[j] & (1 << (i&7)))
			{
				uchar cls;
				struct via_date vd;
				parse_via_date(b-4, &vd, 1);
				cls=(l-(j+1))*8+i;
				if (p)
					rdr_log(reader, "%sclass: %02X, expiry date: %04d/%02d/%02d - %04d/%02d/%02d", p, cls,
					vd.year_s+1980, vd.month_s, vd.day_s,
					vd.year_e+1980, vd.month_e, vd.day_e);
				else {
					rdr_log(reader, "class: %02X, expiry date: %04d/%02d/%02d - %04d/%02d/%02d", cls,
					vd.year_s+1980, vd.month_s, vd.day_s,
					vd.year_e+1980, vd.month_e, vd.day_e);

					time_t start_t, end_t;
					struct tm tm;
					//convert time:
					memset(&tm, 0, sizeof(tm));
					tm.tm_year = vd.year_s+80; //via year starts in 1980, tm_year starts in 1900
					tm.tm_mon = vd.month_s-1;  // january is 0 in tm_mon
					tm.tm_mday = vd.day_s;
					start_t = cs_timegm(&tm);

					tm.tm_year = vd.year_e+80; //via year starts in 1980, tm_year starts in 1900
					tm.tm_mon = vd.month_e-1;  // january is 0 in tm_mon
					tm.tm_mday = vd.day_e;
					end_t = cs_timegm(&tm);

					cs_add_entitlement(reader, reader->caid, provid, cls, cls, start_t, end_t, 5);
				}
			}
}