1 #ifndef __dvbci_dvbci_tc_h
2 #define __dvbci_dvbci_tc_h
4 #include <lib/base/ebase.h>
5 #include <lib/base/object.h>
6 #include <lib/dvb_ci/dvbci.h>
12 DECLARE_REF(eDVBCISession);
13 static ePtr<eDVBCISession> sessions[SLMS];
14 static void createSession(eDVBCISlot *slot, const unsigned char *resource_identifier, unsigned char &status, ePtr<eDVBCISession> &ptr);
15 static void sendSPDU(eDVBCISlot *slot, unsigned char tag,const void *data, int len, unsigned short session_nb, const void *apdu=0,int alen=0);
16 static void sendOpenSessionResponse(eDVBCISlot *slot,unsigned char session_status, const unsigned char *resource_identifier,unsigned short session_nb);
17 void recvCreateSessionResponse(const unsigned char *data);
18 void recvCloseSessionRequest(const unsigned char *data);
23 eDVBCISlot *slot; //base only
24 unsigned short session_nb;
25 virtual int receivedAPDU(const unsigned char *tag, const void *data, int len) = 0;
26 void sendAPDU(const unsigned char *tag, const void *data=0,int len=0);
27 void sendSPDU(unsigned char tag, const void *data, int len,const void *apdu=0, int alen=0);
28 virtual int doAction()=0;
31 virtual ~eDVBCISession();
33 static void deleteSessions(const eDVBCISlot *slot);
35 int poll() { if (action) { action=doAction(); return 1; } return 0; }
36 enum { stateInCreation, stateBusy, stateInDeletion, stateStarted, statePrivate};
38 static int parseLengthField(const unsigned char *pkt, int &len);
39 static int buildLengthField(unsigned char *pkt, int len);
41 static void receiveData(eDVBCISlot *slot, const unsigned char *ptr, size_t len);
43 int getState() { return state; }
44 int getStatus() { return status; }