add return to non-void function
[enigma2.git] / lib / dvb_ci / dvbci_camgr.cpp
1 /* DVB CI CA Manager */
2
3 #include <lib/dvb_ci/dvbci_camgr.h>
4
5 eDVBCICAManagerSession::eDVBCICAManagerSession(eDVBCISlot *tslot)
6 {
7         slot = tslot;
8         slot->ca_manager = this;
9 }
10
11 eDVBCICAManagerSession::~eDVBCICAManagerSession()
12 {
13         slot->ca_manager = 0;
14 }
15
16 int eDVBCICAManagerSession::receivedAPDU(const unsigned char *tag, const void *data, int len)
17 {
18         printf("SESSION(%d)/CA %02x %02x %02x: ", session_nb, tag[0], tag[1],tag[2]);
19         for (int i=0; i<len; i++)
20                 printf("%02x ", ((const unsigned char*)data)[i]);
21         printf("\n");
22
23         if ((tag[0]==0x9f) && (tag[1]==0x80))
24         {
25                 switch (tag[2])
26                 {
27                 case 0x31:
28                         printf("ca info:\n");
29                         for (int i=0; i<len; i+=2)
30                         {
31                                 printf("%04x ", (((const unsigned char*)data)[i]<<8)|(((const unsigned char*)data)[i+1]));
32                                 caids.push_back((((const unsigned char*)data)[i]<<8)|(((const unsigned char*)data)[i+1]));
33                         }
34                         printf("\n");
35                         break;
36                 default:
37                         printf("unknown APDU tag 9F 80 %02x\n", tag[2]);
38                         break;
39                 }
40         }
41         return 0;
42 }
43
44 int eDVBCICAManagerSession::doAction()
45 {
46         switch (state)
47         {
48         case stateStarted:
49         {
50                 const unsigned char tag[3]={0x9F, 0x80, 0x30}; // ca info enq
51                 sendAPDU(tag);
52                 state=stateFinal;
53                 return 0;
54         }
55         case stateFinal:
56                 printf("stateFinal und action! kann doch garnicht sein ;)\n");
57         default:
58                 return 0;
59         }
60 }
61
62 int eDVBCICAManagerSession::sendCAPMT(unsigned char *data, int len)
63 {
64         const unsigned char tag[3]={0x9F, 0x80, 0x32}; // ca_pmt
65
66   sendAPDU(tag, data, len);
67         
68         return 0;
69 }
70