aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRonny Strutz <ronny.strutz@multimedia-labs.de>2005-08-12 19:39:08 +0000
committerRonny Strutz <ronny.strutz@multimedia-labs.de>2005-08-12 19:39:08 +0000
commite31f64ef6fbe42305c93efdc24ae08a35303a90b (patch)
tree0b1588c5a6f04d5dd6acc8f6909a52d593b6514e /lib
parentc4bab36eed7b9ce0ba0b16775a9d429c71c5eed7 (diff)
downloadenigma2-e31f64ef6fbe42305c93efdc24ae08a35303a90b.tar.gz
enigma2-e31f64ef6fbe42305c93efdc24ae08a35303a90b.zip
add ci resource manager
Diffstat (limited to 'lib')
-rw-r--r--lib/dvb_ci/dvbci_resmgr.cpp81
-rw-r--r--lib/dvb_ci/dvbci_resmgr.h19
2 files changed, 100 insertions, 0 deletions
diff --git a/lib/dvb_ci/dvbci_resmgr.cpp b/lib/dvb_ci/dvbci_resmgr.cpp
new file mode 100644
index 00000000..df0fb8d0
--- /dev/null
+++ b/lib/dvb_ci/dvbci_resmgr.cpp
@@ -0,0 +1,81 @@
+/* DVB CI Resource Manager */
+
+#include <lib/dvb_ci/dvbci_resmgr.h>
+
+int eDVBCIResourceManagerSession::receivedAPDU(const unsigned char *tag,const void *data, int len)
+{
+ printf("SESSION(%d) %02x %02x %02x: ", session_nb, tag[0], tag[1], tag[2]);
+ for (int i=0; i<len; i++)
+ printf("%02x ", ((const unsigned char*)data)[i]);
+ printf("\n");
+ if ((tag[0]==0x9f) && (tag[1]==0x80))
+ {
+ switch (tag[2])
+ {
+ case 0x10: // profile enquiry
+ printf("cam fragt was ich kann.\n");
+ state=stateProfileEnquiry;
+ return 1;
+ break;
+ case 0x11: // Tprofile
+ printf("mein cam kann: ");
+ if (!len)
+ printf("nichts\n");
+ else
+ for (int i=0; i<len; i++)
+ printf("%02x ", ((const unsigned char*)data)[i]);
+ if (state == stateFirstProfileEnquiry)
+ {
+ // profile change
+ return 1;
+ }
+ state=stateFinal;
+ break;
+ default:
+ printf("unknown APDU tag 9F 80 %02x\n", tag[2]);
+ }
+ }
+ return 0;
+}
+
+int eDVBCIResourceManagerSession::doAction()
+{
+ switch (state)
+ {
+ case stateStarted:
+ {
+ const unsigned char tag[3]={0x9F, 0x80, 0x10}; // profile enquiry
+ sendAPDU(tag);
+ state=stateFirstProfileEnquiry;
+ return 0;
+ }
+ case stateFirstProfileEnquiry:
+ {
+ const unsigned char tag[3]={0x9F, 0x80, 0x12}; // profile change
+ sendAPDU(tag);
+ state=stateProfileChange;
+ return 0;
+ }
+ case stateProfileEnquiry:
+ {
+ const unsigned char tag[3]={0x9F, 0x80, 0x11};
+ const unsigned char data[][4]=
+ {
+ {0x00, 0x01, 0x00, 0x41},
+ {0x00, 0x02, 0x00, 0x41},
+ {0x00, 0x03, 0x00, 0x41},
+ {0x00, 0x20, 0x00, 0x41},
+ {0x00, 0x24, 0x00, 0x41},
+ {0x00, 0x40, 0x00, 0x41},
+ {0x00, 0x10, 0x00, 0x41}, // auth.
+ };
+ sendAPDU(tag, data, sizeof(data));
+ state=stateFinal;
+ return 0;
+ }
+ case stateFinal:
+ printf("stateFinal und action! kann doch garnicht sein ;)\n");
+ default:
+ return 0;
+ }
+}
diff --git a/lib/dvb_ci/dvbci_resmgr.h b/lib/dvb_ci/dvbci_resmgr.h
new file mode 100644
index 00000000..6dab62c1
--- /dev/null
+++ b/lib/dvb_ci/dvbci_resmgr.h
@@ -0,0 +1,19 @@
+#ifndef __dvbci_dvbci_resmgr_h
+#define __dvbci_dvbci_resmgr_h
+
+//#include <lib/base/ebase.h>
+#include <lib/dvb_ci/dvbci_session.h>
+
+class eDVBCIResourceManagerSession: public eDVBCISession
+{
+ enum {
+ stateFirstProfileEnquiry=statePrivate,
+ stateProfileChange,
+ stateProfileEnquiry,
+ stateFinal };
+ int receivedAPDU(const unsigned char *tag, const void *data, int len);
+ int doAction();
+public:
+};
+
+#endif