source: trunk/module-dvbapi.h@ 8439

Last change on this file since 8439 was 8439, checked in by gf, 9 years ago

webif/dvbapi: Do not prefix log messages comming from WebIf with "dvbapi: ".

module-dvbapi.h redefines cs_log() to include "dvbapi: " prefix.

Since module-webif.c includes module-dvbapi.h all cs_log lines coming
from webif were wrongly were prefixed with "dvbapi: ".

  • Property svn:eol-style set to LF
File size: 5.2 KB
Line 
1#ifndef MODULE_DVBAPI_H_
2#define MODULE_DVBAPI_H_
3
4#ifdef HAVE_DVBAPI
5#include <sys/un.h>
6
7#define TYPE_ECM 1
8#define TYPE_EMM 2
9
10//api
11#define DVBAPI_3 0
12#define DVBAPI_1 1
13#define STAPI 2
14#define COOLAPI 3
15
16#define PORT 9000
17
18#define TMPDIR "/tmp/"
19#define STANDBY_FILE "/tmp/.pauseoscam"
20#define ECMINFO_FILE "/tmp/ecm.info"
21
22#define MAX_DEMUX 16
23#define MAX_CAID 50
24#define ECM_PIDS 30
25#define MAX_FILTER 24
26
27#define BOX_COUNT 6
28
29#define BOXTYPE_DREAMBOX 1
30#define BOXTYPE_DUCKBOX 2
31#define BOXTYPE_UFS910 3
32#define BOXTYPE_DBOX2 4
33#define BOXTYPE_IPBOX 5
34#define BOXTYPE_IPBOX_PMT 6
35#define BOXTYPE_DM7000 7
36#define BOXTYPE_QBOXHD 8
37#define BOXTYPE_COOLSTREAM 9
38#define BOXTYPE_NEUMO 10
39#define BOXTYPE_PC 11
40#define BOXTYPES 11
41
42struct box_devices
43{
44 char *path;
45 char *ca_device;
46 char *demux_device;
47 char *cam_socket_path;
48 int8_t api;
49};
50
51struct s_ecmpids
52{
53 uint16_t CAID;
54 uint32_t PROVID;
55 uint16_t ECM_PID;
56 uint16_t EMM_PID;
57 int8_t irdeto_numchids;
58 int8_t irdeto_curchid;
59 int32_t irdeto_chids;
60 int32_t irdeto_cycle;
61 int8_t checked;
62 int8_t status;
63 unsigned char table;
64 int8_t index;
65 uint32_t streams;
66};
67
68typedef struct filter_s
69{
70 uint32_t fd; //FilterHandle
71 int32_t pidindex;
72 int32_t pid;
73 uint16_t caid;
74 uint32_t provid;
75 uint16_t type;
76 int32_t count;
77#ifdef WITH_STAPI
78 int32_t NumSlots;
79 uint32_t SlotHandle[10];
80 uint32_t BufferHandle[10];
81#endif
82} FILTERTYPE;
83
84struct s_emmpids
85{
86 uint16_t CAID;
87 uint32_t PROVID;
88 uint16_t PID;
89 uint8_t type;
90};
91
92#define PTINUM 10
93#define SLOTNUM 20
94
95typedef struct demux_s
96{
97 int8_t demux_index;
98 FILTERTYPE demux_fd[MAX_FILTER];
99 int32_t ca_mask;
100 int8_t adapter_index;
101 int32_t socket_fd;
102 int8_t ECMpidcount;
103 struct s_ecmpids ECMpids[ECM_PIDS];
104 int8_t EMMpidcount;
105 struct s_emmpids EMMpids[ECM_PIDS];
106 uint16_t max_emm_filter;
107 int8_t STREAMpidcount;
108 uint16_t STREAMpids[ECM_PIDS];
109 int16_t pidindex;
110 int16_t curindex;
111 int8_t tries;
112 int8_t max_status;
113 uint16_t program_number;
114 uint16_t onid;
115 uint16_t tsid;
116 uint32_t enigma_namespace;
117 unsigned char lastcw[2][8];
118 int8_t emm_filter;
119 uchar hexserial[8];
120 struct s_reader *rdr;
121 char pmt_file[30];
122 time_t pmt_time;
123#ifdef WITH_STAPI
124 uint32_t DescramblerHandle[PTINUM];
125 int32_t desc_pidcount;
126 uint32_t slot_assc[PTINUM][SLOTNUM];
127#endif
128} DEMUXTYPE;
129
130struct s_dvbapi_priority
131{
132 char type; // p or i
133 uint16_t caid;
134 uint32_t provid;
135 uint16_t srvid;
136 uint16_t chid;
137 uint16_t ecmpid;
138 uint16_t mapcaid;
139 uint32_t mapprovid;
140 uint16_t mapecmpid;
141 int16_t delay;
142 int8_t force;
143#ifdef WITH_STAPI
144 char devname[30];
145 char pmtfile[30];
146 int8_t disablefilter;
147#endif
148 struct s_dvbapi_priority *next;
149};
150
151
152#define DMX_FILTER_SIZE 16
153
154
155//dvbapi 1
156typedef struct dmxFilter
157{
158 uint8_t filter[DMX_FILTER_SIZE];
159 uint8_t mask[DMX_FILTER_SIZE];
160} dmxFilter_t;
161
162struct dmxSctFilterParams
163{
164 uint16_t pid;
165 dmxFilter_t filter;
166 uint32_t timeout;
167 uint32_t flags;
168#define DMX_CHECK_CRC 1
169#define DMX_ONESHOT 2
170#define DMX_IMMEDIATE_START 4
171#define DMX_BUCKET 0x1000 /* added in 2005.05.18 */
172#define DMX_KERNEL_CLIENT 0x8000
173};
174
175#define DMX_START1 _IOW('o',41,int)
176#define DMX_STOP1 _IOW('o',42,int)
177#define DMX_SET_FILTER1 _IOW('o',43,struct dmxSctFilterParams *)
178//------------------------------------------------------------------
179
180
181//dbox2+ufs
182typedef struct dmx_filter
183{
184 uint8_t filter[DMX_FILTER_SIZE];
185 uint8_t mask[DMX_FILTER_SIZE];
186 uint8_t mode[DMX_FILTER_SIZE];
187} dmx_filter_t;
188
189
190struct dmx_sct_filter_params
191{
192 uint16_t pid;
193 dmx_filter_t filter;
194 uint32_t timeout;
195 uint32_t flags;
196#define DMX_CHECK_CRC 1
197#define DMX_ONESHOT 2
198#define DMX_IMMEDIATE_START 4
199#define DMX_KERNEL_CLIENT 0x8000
200};
201
202typedef struct ca_descr {
203 uint32_t index;
204 uint32_t parity; /* 0 == even, 1 == odd */
205 unsigned char cw[8];
206} ca_descr_t;
207
208typedef struct ca_pid {
209 uint32_t pid;
210 int32_t index; /* -1 == disable*/
211} ca_pid_t;
212
213#define DMX_START _IO('o', 41)
214#define DMX_STOP _IO('o', 42)
215#define DMX_SET_FILTER _IOW('o', 43, struct dmx_sct_filter_params)
216
217#define CA_SET_DESCR _IOW('o', 134, ca_descr_t)
218#define CA_SET_PID _IOW('o', 135, ca_pid_t)
219// --------------------------------------------------------------------
220
221void dvbapi_stop_descrambling(int);
222void dvbapi_process_input(int32_t demux_id, int32_t filter_num, uchar *buffer, int32_t len);
223int32_t dvbapi_open_device(int32_t, int32_t, int);
224int32_t dvbapi_stop_filternum(int32_t demux_index, int32_t num);
225int32_t dvbapi_stop_filter(int32_t demux_index, int32_t type);
226struct s_dvbapi_priority *dvbapi_check_prio_match(int32_t demux_id, int32_t pidindex, char type);
227void dvbapi_send_dcw(struct s_client *client, ECM_REQUEST *er);
228void dvbapi_write_cw(int32_t demux_id, uchar *cw, int32_t idx);
229int32_t dvbapi_parse_capmt(unsigned char *buffer, uint32_t length, int32_t connfd, char *pmtfile);
230void request_cw(struct s_client *dvbapi_client, ECM_REQUEST *er);
231void dvbapi_try_next_caid(int32_t demux_id);
232void dvbapi_read_priority(void);
233
234#ifdef DVBAPI_LOG_PREFIX
235#undef cs_log
236#define cs_log(txt, x...) cs_log_int(0, 1, NULL, 0, "dvbapi: "txt, ##x)
237#ifdef WITH_DEBUG
238 #undef cs_debug_mask
239 #define cs_debug_mask(x,txt,y...) cs_log_int(x, 1, NULL, 0, "dvbapi: "txt, ##y)
240#endif
241#endif
242
243#else
244static inline void dvbapi_read_priority(void) { }
245#endif // WITH_DVBAPI
246
247#endif // MODULE_DVBAPI_H_
Note: See TracBrowser for help on using the repository browser.