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 | #define TYPE_SDT 3
|
---|
10 | #define TYPE_PAT 4
|
---|
11 | #define TYPE_PMT 5
|
---|
12 |
|
---|
13 | // api
|
---|
14 | #define DVBAPI_3 0
|
---|
15 | #define DVBAPI_1 1
|
---|
16 | #define STAPI 2
|
---|
17 | #define COOLAPI 3
|
---|
18 |
|
---|
19 | #ifdef __CYGWIN__
|
---|
20 | #define TMPDIR "./"
|
---|
21 | #define STANDBY_FILE "./.pauseoscam"
|
---|
22 | #define ECMINFO_FILE "./ecm.info"
|
---|
23 | #else
|
---|
24 | #define TMPDIR "/tmp/"
|
---|
25 | #define STANDBY_FILE "/tmp/.pauseoscam"
|
---|
26 | #define ECMINFO_FILE "/tmp/ecm.info"
|
---|
27 | #endif
|
---|
28 |
|
---|
29 | #define BOX_COUNT 7
|
---|
30 |
|
---|
31 | #define BOXTYPE_DREAMBOX 1
|
---|
32 | #define BOXTYPE_DUCKBOX 2
|
---|
33 | #define BOXTYPE_UFS910 3
|
---|
34 | #define BOXTYPE_DBOX2 4
|
---|
35 | #define BOXTYPE_IPBOX 5
|
---|
36 | #define BOXTYPE_IPBOX_PMT 6
|
---|
37 | #define BOXTYPE_DM7000 7
|
---|
38 | #define BOXTYPE_QBOXHD 8
|
---|
39 | #define BOXTYPE_COOLSTREAM 9
|
---|
40 | #define BOXTYPE_NEUMO 10
|
---|
41 | #define BOXTYPE_PC 11
|
---|
42 | #define BOXTYPE_PC_NODMX 12
|
---|
43 | #define BOXTYPE_SAMYGO 13
|
---|
44 | #define BOXTYPES 13
|
---|
45 | #define DMXMD5HASHSIZE 16 // use MD5()
|
---|
46 |
|
---|
47 | // we store the results of remove_streampid_from_list()
|
---|
48 | // and update_streampid_list() in one variable, so make sure
|
---|
49 | // the return values do not collide
|
---|
50 |
|
---|
51 | // remove_streampid_from_list()
|
---|
52 | #define NO_STREAMPID_LISTED 0x00
|
---|
53 | #define REMOVED_STREAMPID_INDEX 0x01
|
---|
54 | #define REMOVED_STREAMPID_LASTINDEX 0x02
|
---|
55 | #define REMOVED_DECODING_STREAMPID_INDEX 0x03
|
---|
56 |
|
---|
57 | // update_streampid_list():
|
---|
58 | #define FOUND_STREAMPID_INDEX 0x10
|
---|
59 | #define ADDED_STREAMPID_INDEX 0x11
|
---|
60 | #define FIRST_STREAMPID_INDEX 0x12
|
---|
61 |
|
---|
62 | // remove_streampid_from_list() and update_streampid_list()
|
---|
63 | #define INVALID_STREAMPID_INDEX 0x20
|
---|
64 |
|
---|
65 | #define INDEX_DISABLE_ALL 0xEFFFFFFD // used for remove_streampid_from_list(), dvbapi_set_pid()
|
---|
66 | #define INDEX_INVALID 0xEFFFFFFF
|
---|
67 |
|
---|
68 | #define DUMMY_FD 0xFFFF
|
---|
69 |
|
---|
70 | //-----------------------------------------------------------------------------
|
---|
71 | // constants used in socket communication
|
---|
72 | //-----------------------------------------------------------------------------
|
---|
73 |
|
---|
74 | #define DVBAPI_PROTOCOL_VERSION 3
|
---|
75 | #define DVBAPI_MAX_PACKET_SIZE 262 // maximum possible packet size
|
---|
76 |
|
---|
77 | #define DVBAPI_CA_GET_DESCR_INFO 0x80086F83
|
---|
78 | #define DVBAPI_CA_SET_DESCR 0x40106F86
|
---|
79 | #define DVBAPI_CA_SET_PID 0x40086F87
|
---|
80 | #define DVBAPI_CA_SET_DESCR_MODE 0x400C6F88
|
---|
81 | #define DVBAPI_CA_SET_DESCR_DATA 0x40186F89
|
---|
82 | //#define DVBAPI_DMX_START 0x00006F29 // in case we ever need this
|
---|
83 | #define DVBAPI_DMX_STOP 0x00006F2A
|
---|
84 | #define DVBAPI_DMX_SET_FILTER 0x403C6F2B
|
---|
85 |
|
---|
86 | #define DVBAPI_AOT_CA 0x9F803000
|
---|
87 | #define DVBAPI_AOT_CA_PMT 0x9F803200 // least significant byte is length (ignored)
|
---|
88 | #define DVBAPI_AOT_CA_STOP 0x9F803F04
|
---|
89 | #define DVBAPI_FILTER_DATA 0xFFFF0000
|
---|
90 | #define DVBAPI_CLIENT_INFO 0xFFFF0001
|
---|
91 | #define DVBAPI_SERVER_INFO 0xFFFF0002
|
---|
92 | #define DVBAPI_ECM_INFO 0xFFFF0003
|
---|
93 |
|
---|
94 | #define DVBAPI_INDEX_DISABLE 0xFFFFFFFF // only used for ca_pid_t
|
---|
95 |
|
---|
96 | //-----------------------------------------------------------------------------
|
---|
97 | // api used for internal device communication
|
---|
98 | //-----------------------------------------------------------------------------
|
---|
99 |
|
---|
100 | #define DMX_FILTER_SIZE 16
|
---|
101 |
|
---|
102 | // The following is part of the linux dvb api (v1),
|
---|
103 | // but modifed to overcome some bugs in specific devices
|
---|
104 |
|
---|
105 | typedef struct dmxFilter
|
---|
106 | {
|
---|
107 | uint8_t filter[DMX_FILTER_SIZE];
|
---|
108 | uint8_t mask[DMX_FILTER_SIZE];
|
---|
109 | } dmxFilter_t;
|
---|
110 |
|
---|
111 | struct dmxSctFilterParams
|
---|
112 | {
|
---|
113 | uint16_t pid;
|
---|
114 | dmxFilter_t filter;
|
---|
115 | uint32_t timeout;
|
---|
116 | uint32_t flags;
|
---|
117 |
|
---|
118 | #define DMX_CHECK_CRC 1
|
---|
119 | #define DMX_ONESHOT 2
|
---|
120 | #define DMX_IMMEDIATE_START 4
|
---|
121 | };
|
---|
122 |
|
---|
123 | #define DMX_START1 _IOW('o', 41, int)
|
---|
124 | #define DMX_STOP1 _IOW('o', 42, int)
|
---|
125 | #define DMX_SET_FILTER1 _IOW('o', 43, struct dmxSctFilterParams *)
|
---|
126 |
|
---|
127 | // The following is part of the linux dvb api
|
---|
128 | // https://www.kernel.org/doc/html/latest/media/uapi/dvb/demux.html
|
---|
129 | // https://github.com/torvalds/linux/blob/master/include/uapi/linux/dvb/dmx.h
|
---|
130 |
|
---|
131 | typedef struct dmx_filter
|
---|
132 | {
|
---|
133 | uint8_t filter[DMX_FILTER_SIZE];
|
---|
134 | uint8_t mask[DMX_FILTER_SIZE];
|
---|
135 | uint8_t mode[DMX_FILTER_SIZE];
|
---|
136 | } dmx_filter_t;
|
---|
137 |
|
---|
138 | struct dmx_sct_filter_params
|
---|
139 | {
|
---|
140 | uint16_t pid;
|
---|
141 | dmx_filter_t filter;
|
---|
142 | uint32_t timeout;
|
---|
143 | uint32_t flags;
|
---|
144 |
|
---|
145 | #define DMX_CHECK_CRC 1
|
---|
146 | #define DMX_ONESHOT 2
|
---|
147 | #define DMX_IMMEDIATE_START 4
|
---|
148 | };
|
---|
149 |
|
---|
150 | #define DMX_START _IO('o', 41)
|
---|
151 | #define DMX_STOP _IO('o', 42)
|
---|
152 | #define DMX_SET_FILTER _IOW('o', 43, struct dmx_sct_filter_params)
|
---|
153 |
|
---|
154 | // The following is part of the linux dvb api
|
---|
155 | // https://www.kernel.org/doc/html/latest/media/uapi/dvb/ca.html
|
---|
156 | // https://github.com/torvalds/linux/blob/master/include/uapi/linux/dvb/ca.h
|
---|
157 |
|
---|
158 | typedef struct ca_descr_info
|
---|
159 | {
|
---|
160 | uint32_t num;
|
---|
161 | uint32_t type; /* bitmask: 1 == ECD, 2 == NDS, 4 == DDS */
|
---|
162 | } ca_descr_info_t;
|
---|
163 |
|
---|
164 | typedef struct ca_descr
|
---|
165 | {
|
---|
166 | uint32_t index;
|
---|
167 | uint32_t parity; /* 0 == even, 1 == odd */
|
---|
168 | uint8_t cw[8];
|
---|
169 | } ca_descr_t;
|
---|
170 |
|
---|
171 | // ca_pid has been removed from the api, but we still use it
|
---|
172 | typedef struct ca_pid
|
---|
173 | {
|
---|
174 | uint32_t pid;
|
---|
175 | int32_t index; /* -1 == disable */
|
---|
176 | } ca_pid_t;
|
---|
177 |
|
---|
178 | enum ca_descr_algo
|
---|
179 | {
|
---|
180 | CA_ALGO_DVBCSA,
|
---|
181 | CA_ALGO_DES,
|
---|
182 | CA_ALGO_AES128,
|
---|
183 | };
|
---|
184 |
|
---|
185 | enum ca_descr_cipher_mode
|
---|
186 | {
|
---|
187 | CA_MODE_ECB,
|
---|
188 | CA_MODE_CBC,
|
---|
189 | };
|
---|
190 |
|
---|
191 | // Structs "ca_descr_mode" and "ca_descr_data" and respective ioctl
|
---|
192 | // commands are part of a custom api
|
---|
193 |
|
---|
194 | /*
|
---|
195 | * struct ca_descr_mode - Used to select a crypto algorithm and mode
|
---|
196 | * for a key slot.
|
---|
197 | *
|
---|
198 | * @index: Key slot allocated for a PID or service.
|
---|
199 | * See CA_SET_PID and struct ca_pid.
|
---|
200 | * @algo: Algorithm to select for @index.
|
---|
201 | * @cipher_mode: Cipher mode to use with @algo.
|
---|
202 | */
|
---|
203 |
|
---|
204 | typedef struct ca_descr_mode
|
---|
205 | {
|
---|
206 | uint32_t index;
|
---|
207 | enum ca_descr_algo algo;
|
---|
208 | enum ca_descr_cipher_mode cipher_mode;
|
---|
209 | } ca_descr_mode_t;
|
---|
210 |
|
---|
211 | /*
|
---|
212 | * struct ca_descr_data - Used to write Keys and IVs to a descrambler.
|
---|
213 | *
|
---|
214 | * @index: Key slot allocated for a PID or service.
|
---|
215 | * See CA_SET_PID and struct ca_pid.
|
---|
216 | * @parity: Indicates even or odd parity for control words.
|
---|
217 | * @data_type: Key or IV.
|
---|
218 | * @length: Size of @data array; depends on selected algorithm and
|
---|
219 | * key or block size.
|
---|
220 | * @data: Pointer to variable @length key or initialization vector data.
|
---|
221 | */
|
---|
222 |
|
---|
223 | enum ca_descr_data_type
|
---|
224 | {
|
---|
225 | CA_DATA_IV,
|
---|
226 | CA_DATA_KEY,
|
---|
227 | };
|
---|
228 |
|
---|
229 | enum ca_descr_parity
|
---|
230 | {
|
---|
231 | CA_PARITY_EVEN,
|
---|
232 | CA_PARITY_ODD,
|
---|
233 | };
|
---|
234 |
|
---|
235 | typedef struct ca_descr_data
|
---|
236 | {
|
---|
237 | uint32_t index;
|
---|
238 | enum ca_descr_parity parity;
|
---|
239 | enum ca_descr_data_type data_type;
|
---|
240 | uint32_t length;
|
---|
241 | uint8_t *data;
|
---|
242 | } ca_descr_data_t;
|
---|
243 |
|
---|
244 | #define CA_GET_DESCR_INFO _IOR('o', 131, ca_descr_info_t)
|
---|
245 | #define CA_SET_DESCR _IOW('o', 134, ca_descr_t)
|
---|
246 | #define CA_SET_PID _IOW('o', 135, ca_pid_t)
|
---|
247 | #define CA_SET_DESCR_MODE _IOW('o', 136, ca_descr_mode_t)
|
---|
248 | #define CA_SET_DESCR_DATA _IOW('o', 137, ca_descr_data_t)
|
---|
249 |
|
---|
250 | //-----------------------------------------------------------------------------
|
---|
251 | // OSCam defined structures
|
---|
252 | //-----------------------------------------------------------------------------
|
---|
253 |
|
---|
254 | struct box_devices
|
---|
255 | {
|
---|
256 | char *path;
|
---|
257 | char *ca_device;
|
---|
258 | char *demux_device;
|
---|
259 | char *cam_socket_path;
|
---|
260 | int8_t api;
|
---|
261 | };
|
---|
262 |
|
---|
263 | typedef struct filter_s
|
---|
264 | {
|
---|
265 | uint32_t fd; // filter handle
|
---|
266 | int32_t pidindex;
|
---|
267 | int32_t pid;
|
---|
268 | uint16_t caid;
|
---|
269 | uint32_t provid;
|
---|
270 | uint16_t type;
|
---|
271 | int32_t count;
|
---|
272 | uint8_t filter[16];
|
---|
273 | uint8_t mask[16];
|
---|
274 | uint8_t lastecmd5[CS_ECMSTORESIZE]; // last requested ecm md5
|
---|
275 | int32_t lastresult;
|
---|
276 | uint8_t prevecmd5[CS_ECMSTORESIZE]; // previous requested ecm md5
|
---|
277 | int32_t prevresult;
|
---|
278 | #if defined(WITH_STAPI) || defined(WITH_STAPI5)
|
---|
279 | int32_t NumSlots;
|
---|
280 | uint32_t SlotHandle[10];
|
---|
281 | uint32_t BufferHandle[10];
|
---|
282 | #endif
|
---|
283 | #ifdef WITH_EMU
|
---|
284 | uint32_t cadata;
|
---|
285 | #endif
|
---|
286 | } FILTERTYPE;
|
---|
287 |
|
---|
288 | #ifdef WITH_EXTENDED_CW
|
---|
289 | #define MAX_STREAM_INDICES 32 // In practice, 5 is the maximum ever used
|
---|
290 | #else
|
---|
291 | #define MAX_STREAM_INDICES 1
|
---|
292 | #endif
|
---|
293 |
|
---|
294 | #define CA_MAX 32 // Max ca devices supported by oscam - limited by sizeof(ca_mask) of struct demux_s (32 bits)
|
---|
295 | #define INDEX_MAX 64 // Max descramblers per ca device - limited by sizeof(activeindexers) of struct s_streampid (64 bits)
|
---|
296 | #define INDEX_MAX_LOCAL 16 // Max total descramblers to use for enigma2 and other STBs when dvbapi_get_descrambler_info() fails
|
---|
297 | #define INDEX_MAX_NET 64 // Max total descramblers to use for PC (VDR, Tvheadend, etc)
|
---|
298 |
|
---|
299 | typedef struct s_ecmpid
|
---|
300 | {
|
---|
301 | uint16_t CAID;
|
---|
302 | uint32_t PROVID; // provider
|
---|
303 | uint16_t ECM_PID;
|
---|
304 | uint32_t CHID;
|
---|
305 | uint16_t EMM_PID;
|
---|
306 | uint32_t VPID; // video pid
|
---|
307 | uint8_t irdeto_maxindex; // max irdeto indices always fresh fetched from current ecm
|
---|
308 | uint8_t irdeto_curindex; // current irdeto index we want to handle
|
---|
309 | uint8_t irdeto_cycle; // temp var that holds the irdeto index we started with to detect if we cycled trough all indices
|
---|
310 | int8_t checked;
|
---|
311 | int8_t status;
|
---|
312 | uint8_t tries;
|
---|
313 | uint8_t table;
|
---|
314 | int8_t useMultipleIndices; // whether or not to use multiple indices for this ecm pid
|
---|
315 | uint32_t index[MAX_STREAM_INDICES]; // ca indices used for this ecm pid (index[0] holds ca index for STREAMmpids[0] and so on)
|
---|
316 | uint32_t streams; // bit mask of STREAMpids enabled for this ECMpid
|
---|
317 | uint32_t cadata;
|
---|
318 | #ifdef WITH_EMU
|
---|
319 | int16_t pvu_counter;
|
---|
320 | #endif
|
---|
321 | } ECMPIDTYPE;
|
---|
322 |
|
---|
323 | typedef struct s_emmpid
|
---|
324 | {
|
---|
325 | uint16_t CAID;
|
---|
326 | uint32_t PROVID;
|
---|
327 | uint16_t PID;
|
---|
328 | uint8_t type;
|
---|
329 | uint32_t cadata;
|
---|
330 | } EMMPIDTYPE;
|
---|
331 |
|
---|
332 | enum stream_type
|
---|
333 | {
|
---|
334 | STREAM_UNDEFINED,
|
---|
335 | STREAM_VIDEO,
|
---|
336 | STREAM_AUDIO,
|
---|
337 | STREAM_SUBTITLE
|
---|
338 | };
|
---|
339 |
|
---|
340 | #define MAX_DEMUX 32 // Max number of demuxes supported by OSCam - each channel/service occupies one demux
|
---|
341 | #define MAX_ECM_PIDS 24 // Max number of ECM pids per demux
|
---|
342 | #define MAX_EMM_PIDS 24 // Max number of EMM pids per demux
|
---|
343 | #define MAX_STREAM_PIDS 32 // Max number of pids other than ECM and EMM (e.g. audio, video, subtitle, etc) per demux (hardware descramblers might have a capacity of 30 pids)
|
---|
344 | #define MAX_FILTER 64
|
---|
345 |
|
---|
346 | #define PTINUM 10
|
---|
347 | #define SLOTNUM 20
|
---|
348 |
|
---|
349 | typedef struct demux_s
|
---|
350 | {
|
---|
351 | int8_t demux_index; // id of the (hardware) demux carrying the TS of this demux - we get this via CaPMT
|
---|
352 | int8_t adapter_index; // id of the (hardware) adapter carrying the TS of this demux - we get this via CaPMT
|
---|
353 | uint32_t ca_mask; // bit mask of ca devices used for descrambling of this demux - we get this via CaPMT
|
---|
354 | int32_t socket_fd;
|
---|
355 | uint16_t client_proto_version;
|
---|
356 | FILTERTYPE demux_fd[MAX_FILTER];
|
---|
357 | int8_t ECMpidcount; // count of ECM pids in the demux
|
---|
358 | ECMPIDTYPE ECMpids[MAX_ECM_PIDS];
|
---|
359 | int8_t EMMpidcount; // count of EMM pids in the demux
|
---|
360 | EMMPIDTYPE EMMpids[MAX_EMM_PIDS];
|
---|
361 | struct timeb emmstart; // last time emm cat was started
|
---|
362 | uint16_t max_emm_filter;
|
---|
363 | int8_t STREAMpidcount;
|
---|
364 | uint16_t STREAMpids[MAX_STREAM_PIDS];
|
---|
365 | enum stream_type STREAMpidsType[MAX_STREAM_PIDS]; // type (audio, video, subtitle, etc) of the corresponding stream pid
|
---|
366 | int16_t pidindex; // ECMpid used for descrambling - holds index of the ECMpids[] array
|
---|
367 | int16_t curindex;
|
---|
368 | int8_t max_status;
|
---|
369 | uint16_t program_number; // also called service id (srvid)
|
---|
370 | uint16_t onid; // original network id
|
---|
371 | uint16_t tsid; // transport stream id
|
---|
372 | uint16_t pmtpid; // PMT pid for the program_number
|
---|
373 | uint32_t ens; // enigma namespace
|
---|
374 | uint8_t last_cw[MAX_STREAM_INDICES][2][16]; // even/odd pairs of 16 byte CWs used for descrambling on the last crypto period
|
---|
375 | int8_t emm_filter;
|
---|
376 | int8_t sdt_filter;
|
---|
377 | uint8_t hexserial[8];
|
---|
378 | struct s_reader *rdr;
|
---|
379 | char pmt_file[30];
|
---|
380 | time_t pmt_time;
|
---|
381 | uint8_t stopdescramble;
|
---|
382 | uint8_t running;
|
---|
383 | uint8_t old_ecmfiltercount; // previous ecm filter count
|
---|
384 | uint8_t old_emmfiltercount; // previous emm filter count
|
---|
385 | pthread_mutex_t answerlock; // request mode 1 avoid race
|
---|
386 | #ifdef WITH_STAPI
|
---|
387 | uint32_t DescramblerHandle[PTINUM];
|
---|
388 | int32_t desc_pidcount;
|
---|
389 | uint32_t slot_assc[PTINUM][SLOTNUM];
|
---|
390 | #endif
|
---|
391 | #ifdef WITH_STAPI5
|
---|
392 | uint32_t dev_index;
|
---|
393 | #endif
|
---|
394 | int8_t decodingtries; // -1 = first run
|
---|
395 | struct timeb decstart;
|
---|
396 | struct timeb decend;
|
---|
397 | } DEMUXTYPE;
|
---|
398 |
|
---|
399 | typedef struct s_streampid
|
---|
400 | {
|
---|
401 | uint16_t streampid; // pid of this stream
|
---|
402 | uint8_t cadevice; // CA device used for descramlbing
|
---|
403 | uint32_t caindex; // index (slot) of the CA device used
|
---|
404 | uint64_t activeindexers; // bitmask indexers if streampid enabled for index, bit is set
|
---|
405 | bool use_des; // whether to use DES for descrambling this streampid
|
---|
406 | } STREAMPIDTYPE;
|
---|
407 |
|
---|
408 | struct s_dvbapi_priority
|
---|
409 | {
|
---|
410 | char type; // can be 'p', 'i', 'm', 'd', 's', 'l', 'j', 'a' or 'x'
|
---|
411 | uint16_t caid;
|
---|
412 | uint32_t provid;
|
---|
413 | uint16_t srvid;
|
---|
414 | uint32_t chid;
|
---|
415 | uint16_t ecmpid;
|
---|
416 | uint32_t cadata;
|
---|
417 | uint16_t mapcaid;
|
---|
418 | uint32_t mapprovid;
|
---|
419 | uint16_t mapecmpid;
|
---|
420 | int16_t delay;
|
---|
421 | int8_t force;
|
---|
422 | int8_t pidx;
|
---|
423 | #if defined(WITH_STAPI) || defined(WITH_STAPI5)
|
---|
424 | char devname[30];
|
---|
425 | char pmtfile[30];
|
---|
426 | int8_t disablefilter;
|
---|
427 | #endif
|
---|
428 | struct s_dvbapi_priority *next;
|
---|
429 | };
|
---|
430 |
|
---|
431 | //-----------------------------------------------------------------------------
|
---|
432 | // function declarations
|
---|
433 | //-----------------------------------------------------------------------------
|
---|
434 |
|
---|
435 | void dvbapi_stop_descrambling(int32_t demux_id, uint32_t msgid);
|
---|
436 | void dvbapi_stop_all_descrambling(uint32_t msgid);
|
---|
437 | void dvbapi_process_input(int32_t demux_id, int32_t filter_num, uint8_t *buffer, int32_t len, uint32_t msgid);
|
---|
438 | int32_t dvbapi_open_device(int32_t, int32_t, int);
|
---|
439 | int32_t dvbapi_stop_filternum(int32_t demux_id, int32_t num, uint32_t msgid);
|
---|
440 | int32_t dvbapi_stop_filter(int32_t demux_id, int32_t type, uint32_t msgid);
|
---|
441 | struct s_dvbapi_priority *dvbapi_check_prio_match(int32_t demux_id, int32_t pidindex, char type);
|
---|
442 | void dvbapi_send_dcw(struct s_client *client, ECM_REQUEST *er);
|
---|
443 | void dvbapi_write_cw(int32_t demux_id, int32_t pid, int32_t stream_id, uint8_t *cw, uint8_t cw_length, uint8_t *iv, uint8_t iv_length, enum ca_descr_algo algo, enum ca_descr_cipher_mode cipher_mode, uint32_t msgid);
|
---|
444 | int32_t dvbapi_parse_capmt(uint8_t *buffer, uint32_t length, int32_t connfd, char *pmtfile, int8_t is_real_pmt, uint16_t existing_demux_id, uint16_t client_proto_version, uint32_t msgid);
|
---|
445 | void request_cw(struct s_client *client, ECM_REQUEST *er, int32_t demux_id, uint8_t delayed_ecm_check);
|
---|
446 | void dvbapi_try_next_caid(int32_t demux_id, int8_t checked, uint32_t msgid);
|
---|
447 | void dvbapi_read_priority(void);
|
---|
448 | int32_t dvbapi_set_section_filter(int32_t demux_id, ECM_REQUEST *er, int32_t n);
|
---|
449 | int32_t dvbapi_activate_section_filter(int32_t demux_id, int32_t num, int32_t fd, int32_t pid, uint8_t *filter, uint8_t *mask, uint32_t msgid);
|
---|
450 | int32_t dvbapi_check_ecm_delayed_delivery(int32_t demux_id, ECM_REQUEST *er);
|
---|
451 | int32_t dvbapi_get_filternum(int32_t demux_id, ECM_REQUEST *er, int32_t type);
|
---|
452 | uint32_t dvbapi_ca_set_pid(int32_t demux_id, int32_t pid, int32_t stream_id, bool use_des, uint32_t msgid);
|
---|
453 | void dvbapi_set_pid(int32_t demux_id, int32_t num, uint32_t idx, bool enable, bool use_des, uint32_t msgid);
|
---|
454 | int8_t update_streampid_list(uint8_t cadevice, uint16_t pid, uint32_t idx, bool use_des);
|
---|
455 | int8_t remove_streampid_from_list(uint8_t cadevice, uint16_t pid, uint32_t idx);
|
---|
456 | void disable_unused_streampids(int16_t demux_id);
|
---|
457 | uint32_t is_ca_used(uint8_t cadevice, int32_t pid);
|
---|
458 | uint16_t dvbapi_get_client_proto_version(void);
|
---|
459 | const char *dvbapi_get_client_name(void);
|
---|
460 | void rotate_emmfilter(int32_t demux_id);
|
---|
461 | int32_t filtermatch(uint8_t *buffer, int32_t filter_num, int32_t demux_id, int32_t len);
|
---|
462 | void delayer(ECM_REQUEST *er, uint32_t delay);
|
---|
463 | void check_add_emmpid(int32_t demux_id, uint8_t *filter, int32_t l, int32_t emmtype);
|
---|
464 | void *dvbapi_start_handler(struct s_client *cl, uint8_t *mbuf, int32_t module_idx, void *(*_main_func)(void *));
|
---|
465 | uint32_t dvbapi_get_desc_index(int32_t demux_id, int32_t pid, int32_t stream_id);
|
---|
466 | void dvbapi_write_ecminfo_file(struct s_client *client, ECM_REQUEST *er, uint8_t *lastcw0, uint8_t *lastcw1, uint8_t cw_length);
|
---|
467 |
|
---|
468 | #if defined(WITH_AZBOX) || defined(WITH_MCA)
|
---|
469 | #define USE_OPENXCAS 1
|
---|
470 | extern int32_t openxcas_provid;
|
---|
471 | extern uint16_t openxcas_sid, openxcas_caid, openxcas_ecm_pid;
|
---|
472 | static inline void openxcas_set_caid(uint16_t _caid) { openxcas_caid = _caid; }
|
---|
473 | static inline void openxcas_set_ecm_pid(uint16_t _pid) { openxcas_ecm_pid = _pid; }
|
---|
474 | static inline void openxcas_set_sid(uint16_t _sid) { openxcas_sid = _sid; }
|
---|
475 | static inline void openxcas_set_provid(uint32_t _provid) { openxcas_provid = _provid; }
|
---|
476 | #else
|
---|
477 | #define USE_OPENXCAS 0
|
---|
478 | static inline void openxcas_set_caid(uint16_t UNUSED(_caid)) { }
|
---|
479 | static inline void openxcas_set_ecm_pid(uint16_t UNUSED(_pid)) { }
|
---|
480 | static inline void openxcas_set_sid(uint16_t UNUSED(_sid)) { }
|
---|
481 | static inline void openxcas_set_provid(uint32_t UNUSED(_provid)) { }
|
---|
482 | #endif
|
---|
483 |
|
---|
484 | bool is_dvbapi_usr(char *usr);
|
---|
485 | static inline bool module_dvbapi_enabled(void) { return cfg.dvbapi_enabled; }
|
---|
486 | #else
|
---|
487 | static inline void dvbapi_stop_all_descrambling(uint32_t UNUSED(msgid)) { }
|
---|
488 | static inline void dvbapi_read_priority(void) { }
|
---|
489 | static inline bool is_dvbapi_usr(char *UNUSED(usr)) { return 0; }
|
---|
490 | static inline bool module_dvbapi_enabled(void) { return 0; }
|
---|
491 | #endif // WITH_DVBAPI
|
---|
492 |
|
---|
493 | #endif // MODULE_DVBAPI_H_
|
---|