2003-01-06 14:44:27 +01:00
|
|
|
/*
|
|
|
|
* ci.h: Common Interface
|
|
|
|
*
|
|
|
|
* See the main source file 'vdr.c' for copyright information and
|
|
|
|
* how to reach the author.
|
|
|
|
*
|
2004-02-08 15:11:07 +01:00
|
|
|
* $Id: ci.h 1.13 2004/02/08 14:36:23 kls Exp $
|
2003-01-06 14:44:27 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __CI_H
|
|
|
|
#define __CI_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "thread.h"
|
|
|
|
|
|
|
|
class cCiMMI;
|
|
|
|
|
|
|
|
class cCiMenu {
|
|
|
|
friend class cCiMMI;
|
|
|
|
private:
|
|
|
|
enum { MAX_CIMENU_ENTRIES = 64 }; ///< XXX is there a specified maximum?
|
|
|
|
cCiMMI *mmi;
|
2003-10-26 13:19:22 +01:00
|
|
|
cMutex mutex;
|
2003-01-06 14:44:27 +01:00
|
|
|
bool selectable;
|
|
|
|
char *titleText;
|
|
|
|
char *subTitleText;
|
|
|
|
char *bottomText;
|
|
|
|
char *entries[MAX_CIMENU_ENTRIES];
|
|
|
|
int numEntries;
|
|
|
|
bool AddEntry(char *s);
|
|
|
|
cCiMenu(cCiMMI *MMI, bool Selectable);
|
|
|
|
public:
|
|
|
|
~cCiMenu();
|
|
|
|
const char *TitleText(void) { return titleText; }
|
|
|
|
const char *SubTitleText(void) { return subTitleText; }
|
|
|
|
const char *BottomText(void) { return bottomText; }
|
|
|
|
const char *Entry(int n) { return n < numEntries ? entries[n] : NULL; }
|
|
|
|
int NumEntries(void) { return numEntries; }
|
|
|
|
bool Selectable(void) { return selectable; }
|
|
|
|
bool Select(int Index);
|
|
|
|
bool Cancel(void);
|
|
|
|
};
|
|
|
|
|
|
|
|
class cCiEnquiry {
|
|
|
|
friend class cCiMMI;
|
|
|
|
private:
|
|
|
|
cCiMMI *mmi;
|
2003-10-26 13:19:22 +01:00
|
|
|
cMutex mutex;
|
2003-01-06 14:44:27 +01:00
|
|
|
char *text;
|
|
|
|
bool blind;
|
|
|
|
int expectedLength;
|
|
|
|
cCiEnquiry(cCiMMI *MMI);
|
|
|
|
public:
|
|
|
|
~cCiEnquiry();
|
|
|
|
const char *Text(void) { return text; }
|
|
|
|
bool Blind(void) { return blind; }
|
|
|
|
int ExpectedLength(void) { return expectedLength; }
|
|
|
|
bool Reply(const char *s);
|
|
|
|
bool Cancel(void);
|
|
|
|
};
|
|
|
|
|
|
|
|
class cCiCaPmt {
|
|
|
|
friend class cCiConditionalAccessSupport;
|
|
|
|
private:
|
|
|
|
int length;
|
|
|
|
int esInfoLengthPos;
|
|
|
|
uint8_t capmt[2048]; ///< XXX is there a specified maximum?
|
2003-12-24 10:30:35 +01:00
|
|
|
int caDescriptorsLength;
|
|
|
|
uint8_t caDescriptors[2048];
|
|
|
|
bool streamFlag;
|
|
|
|
void AddCaDescriptors(int Length, const uint8_t *Data);
|
2003-01-06 14:44:27 +01:00
|
|
|
public:
|
2003-12-24 10:30:35 +01:00
|
|
|
cCiCaPmt(int Source, int Transponder, int ProgramNumber, const unsigned short *CaSystemIds);
|
|
|
|
bool Valid(void);
|
2003-12-23 10:34:51 +01:00
|
|
|
void AddPid(int Pid, uint8_t StreamType);
|
2003-01-06 14:44:27 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#define MAX_CI_SESSION 16 //XXX
|
|
|
|
|
|
|
|
class cCiSession;
|
|
|
|
class cCiTransportLayer;
|
|
|
|
class cCiTransportConnection;
|
|
|
|
|
|
|
|
class cCiHandler {
|
|
|
|
private:
|
|
|
|
cMutex mutex;
|
2003-05-25 11:51:28 +02:00
|
|
|
int fd;
|
2003-01-06 14:44:27 +01:00
|
|
|
int numSlots;
|
2003-04-18 12:48:49 +02:00
|
|
|
bool newCaSupport;
|
2003-04-20 09:53:08 +02:00
|
|
|
bool hasUserIO;
|
2003-01-06 14:44:27 +01:00
|
|
|
cCiSession *sessions[MAX_CI_SESSION];
|
|
|
|
cCiTransportLayer *tpl;
|
|
|
|
cCiTransportConnection *tc;
|
|
|
|
int ResourceIdToInt(const uint8_t *Data);
|
|
|
|
bool Send(uint8_t Tag, int SessionId, int ResourceId = 0, int Status = -1);
|
|
|
|
cCiSession *GetSessionBySessionId(int SessionId);
|
2003-02-09 11:54:22 +01:00
|
|
|
cCiSession *GetSessionByResourceId(int ResourceId, int Slot);
|
2003-01-06 14:44:27 +01:00
|
|
|
cCiSession *CreateSession(int ResourceId);
|
|
|
|
bool OpenSession(int Length, const uint8_t *Data);
|
|
|
|
bool CloseSession(int SessionId);
|
2003-02-09 11:54:22 +01:00
|
|
|
int CloseAllSessions(int Slot);
|
2003-01-06 14:44:27 +01:00
|
|
|
cCiHandler(int Fd, int NumSlots);
|
|
|
|
public:
|
|
|
|
~cCiHandler();
|
|
|
|
static cCiHandler *CreateCiHandler(const char *FileName);
|
2003-04-18 12:48:49 +02:00
|
|
|
int NumSlots(void) { return numSlots; }
|
2003-02-16 11:20:55 +01:00
|
|
|
bool Process(void);
|
2003-04-20 09:53:08 +02:00
|
|
|
bool HasUserIO(void) { return hasUserIO; }
|
2003-02-09 11:54:22 +01:00
|
|
|
bool EnterMenu(int Slot);
|
2003-01-06 14:44:27 +01:00
|
|
|
cCiMenu *GetMenu(void);
|
|
|
|
cCiEnquiry *GetEnquiry(void);
|
2004-02-08 15:11:07 +01:00
|
|
|
const char *GetCamName(int Slot);
|
2003-04-18 12:48:49 +02:00
|
|
|
const unsigned short *GetCaSystemIds(int Slot);
|
2004-01-04 12:30:00 +01:00
|
|
|
bool ProvidesCa(const unsigned short *CaSystemIds); //XXX Slot???
|
2003-04-18 12:48:49 +02:00
|
|
|
bool SetCaPmt(cCiCaPmt &CaPmt, int Slot);
|
2003-02-09 11:54:22 +01:00
|
|
|
bool Reset(int Slot);
|
2003-01-06 14:44:27 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif //__CI_H
|