added application manager
[enigma2.git] / lib / dvb_ci / dvbci_appmgr.cpp
1 /* DVB CI Application Manager */
2
3 #include <lib/dvb_ci/dvbci_appmgr.h>
4
5 int eDVBCIApplicationManagerSession::receivedAPDU(const unsigned char *tag,const void *data, int len)
6 {
7         printf("SESSION(%d)/APP %02x %02x %02x: ", session_nb, tag[0], tag[1], tag[2]);
8         for (int i=0; i<len; i++)
9                 printf("%02x ", ((const unsigned char*)data)[i]);
10         printf("\n");
11
12         if ((tag[0]==0x9f) && (tag[1]==0x80))
13         {
14                 switch (tag[2])
15                 {
16                 case 0x21:
17                 {
18                         int dl;
19                         printf("application info:\n");
20                         printf("  len: %d\n", len);
21                         printf("  application_type: %d\n", ((unsigned char*)data)[0]);
22                         printf("  application_manufacturer: %02x %02x\n", ((unsigned char*)data)[2], ((unsigned char*)data)[1]);
23                         printf("  manufacturer_code: %02x %02x\n", ((unsigned char*)data)[4],((unsigned char*)data)[3]);
24                         printf("  menu string: ");
25                         dl=((unsigned char*)data)[5];
26                         if ((dl + 6) > len)
27                         {
28                                 printf("warning, invalid length (%d vs %d)\n", dl+6, len);
29                                 dl=len-6;
30                         }
31                         for (int i = 0; i < dl; ++i)
32                                 printf("%c", ((unsigned char*)data)[i+6]);
33                         printf("\n");
34                         break;
35                 }
36                 default:
37                         printf("unknown APDU tag 9F 80 %02x\n", tag[2]);
38                         break;
39                 }
40         }
41         return 0;
42 }