blob: e83deea0761cb9876e61f62243f68048a42a2bae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
/*
* ci.h: Common Interface
*
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: ci.h 1.10 2003/12/23 10:20:59 kls Exp $
*/
#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;
cMutex mutex;
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;
cMutex mutex;
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?
public:
cCiCaPmt(int ProgramNumber);
void AddPid(int Pid, uint8_t StreamType);
void AddCaDescriptor(int Length, uint8_t *Data);
};
#define MAX_CI_SESSION 16 //XXX
class cCiSession;
class cCiTransportLayer;
class cCiTransportConnection;
class cCiHandler {
private:
cMutex mutex;
int fd;
int numSlots;
bool newCaSupport;
bool hasUserIO;
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);
cCiSession *GetSessionByResourceId(int ResourceId, int Slot);
cCiSession *CreateSession(int ResourceId);
bool OpenSession(int Length, const uint8_t *Data);
bool CloseSession(int SessionId);
int CloseAllSessions(int Slot);
cCiHandler(int Fd, int NumSlots);
public:
~cCiHandler();
static cCiHandler *CreateCiHandler(const char *FileName);
int NumSlots(void) { return numSlots; }
bool Process(void);
bool HasUserIO(void) { return hasUserIO; }
bool EnterMenu(int Slot);
cCiMenu *GetMenu(void);
cCiEnquiry *GetEnquiry(void);
const unsigned short *GetCaSystemIds(int Slot);
bool SetCaPmt(cCiCaPmt &CaPmt, int Slot);
bool Reset(int Slot);
};
#endif //__CI_H
|