source: trunk/globals.h@ 1014

Last change on this file since 1014 was 1014, checked in by landlord, 13 years ago

Renamed 'HAVE_DVBAPI' to 'HAVE_DVBAPI_3'

File size: 21.3 KB
Line 
1#include <stdlib.h>
2#include <stdio.h>
3#include <assert.h>
4#include <fcntl.h>
5#include <sys/ioctl.h>
6#include <sys/poll.h>
7#include <ctype.h>
8#include <sys/types.h>
9#include <sys/stat.h>
10#include <sys/shm.h>
11#include <sys/wait.h>
12#include <unistd.h>
13#include <sys/mman.h>
14#include <stdarg.h>
15#include <time.h>
16#include <sys/timeb.h>
17#include <limits.h>
18
19#include <sys/socket.h>
20#include <netinet/in.h>
21#include <arpa/inet.h>
22#include <netdb.h>
23#include <string.h>
24#include <signal.h>
25#include <errno.h>
26
27#include <pthread.h>
28
29#ifndef CS_GLOBALS
30#define CS_GLOBALS
31#define CS_VERSION "0.99.4svn"
32
33#if defined(__GNUC__)
34# define GCC_PACK __attribute__((packed))
35#else
36# define GCC_PACK
37#endif
38
39#if defined(WIN32) || defined(OS_CYGWIN32)
40# define MSG_WAITALL 0
41#endif
42
43#include "oscam-config.h"
44#ifndef USE_CMAKE
45# include "oscam-ostype.h"
46#endif
47#include "oscam-types.h"
48#include "cscrypt/cscrypt.h"
49
50#ifdef HAVE_PCSC
51#include <PCSC/pcsclite.h>
52#ifdef OS_MACOSX
53#include <PCSC/wintypes.h>
54#else
55#include <PCSC/reader.h>
56#endif
57#endif
58
59#ifndef CS_CONFDIR
60#define CS_CONFDIR "/usr/local/etc"
61#endif
62#ifndef CS_MMAPFILE
63#define CS_MMAPFILE "/tmp/oscam.mem"
64#endif
65#ifndef CS_LOGFILE
66#define CS_LOGFILE "/var/log/oscam.log"
67#endif
68#define CS_QLEN 128 // size of request queue
69#define CS_MAXQLEN 128 // size of request queue for cardreader
70#define CS_MAXCAIDTAB 32 // max. caid-defs/user
71#define CS_MAXTUNTAB 16 // max. betatunnel mappings
72#define CS_MAXPROV 32
73#define CS_MAXPORTS 32 // max server ports
74#define CS_MAXFILTERS 16
75
76#define CS_MAXCARDS 4096
77#define CS_MAXIGNORE 1024
78#define CS_MAXLOCALS 16
79#define CS_ECMSTORESIZE 16 // use MD5()
80#define CS_EMMSTORESIZE 270
81#define CS_CLIENT_TIMEOUT 5000
82#define CS_CLIENT_MAXIDLE 120
83#define CS_BIND_TIMEOUT 120
84#define CS_DELAY 0
85#define CS_RESOLVE_DELAY 30
86#define CS_MAXLOGHIST 30
87#define CS_LOGHISTSIZE 160 // 32+128: username + logline
88
89#ifdef OLD_DEFS
90#ifdef CS_EMBEDDED
91#define CS_MAXPENDING 32
92#define CS_ECMCACHESIZE 32
93#define CS_EMMCACHESIZE 64
94#define CS_MAXPID 32
95#define CS_MAXREADER 8
96#else
97#define CS_MAXPENDING 128
98#define CS_ECMCACHESIZE 128
99#define CS_EMMCACHESIZE 256
100#define CS_MAXPID 128
101#define CS_MAXREADER 64
102#endif
103#endif
104
105#ifdef CS_EMBEDDED
106#define CS_MAXPID 32
107#define CS_MAXREADER (CS_MAXPID>>1)
108#define CS_MAXPENDING CS_MAXPID
109#define CS_ECMCACHESIZE CS_MAXPID
110#define CS_EMMCACHESIZE (CS_MAXPID<<1)
111#else
112#define CS_MAXPID 512
113#define CS_MAXREADER (CS_MAXPID>>2)
114#define CS_MAXPENDING (CS_MAXPID<<1)
115#define CS_ECMCACHESIZE CS_MAXPID
116#define CS_EMMCACHESIZE (CS_MAXPID<<1)
117#define CS_RDR_INIT_HIST
118#endif
119
120#define D_DUMP 1 // Debug Dumps
121#define D_MASTER 2 // Debug Master Process
122#define D_READER 4 // Debug Reader/Proxy Process
123#define D_CLIENT 8 // Debug Client Process
124#define D_DEVICE 16 // Debug Reader I/O
125#define D_WATCHDOG 32 // Debug Watchdog
126#define D_ALL_DUMP 63
127
128#define R_MOUSE 0x1 // Reader smartcard mouse
129#define R_INTERNAL 0x2 // Reader smartcard intern
130#define R_SMART 0x5 // Smartreader+
131#define R_CAMD35 0x10 // Reader cascading camd 3.5x
132#define R_CAMD33 0x11 // Reader cascading camd 3.3x
133#define R_NEWCAMD 0x12 // Reader cascading newcamd
134#define R_RADEGAST 0x13 // Reader cascading radegast
135#define R_CS378X 0x14 // Reader cascading camd 3.5x TCP
136#define R_GBOX 0x20 // Reader cascading gbox
137#define R_CCCAM 0x25 // Reader cascading cccam
138#define R_SERIAL 0x80 // Reader serial
139#define R_IS_NETWORK 0x70
140#define R_IS_CASCADING 0xF0
141
142#ifdef HAVE_PCSC
143 #define R_PCSC 0x6 // PCSC
144#endif
145
146#define CS_MAX_MOD 12
147#define MOD_CONN_TCP 1
148#define MOD_CONN_UDP 2
149#define MOD_CONN_NET 3
150#define MOD_CONN_SERIAL 4
151
152#ifdef CS_CORE
153char *PIP_ID_TXT[] = { "ECM", "EMM", "LOG", "CIN", "HUP", NULL };
154char *RDR_CD_TXT[] = { "cd", "dsr", "cts", "ring", "none",
155#ifdef USE_GPIO
156 "gpio2", "gpio3", "gpio4", "gpio5", "gpio6", "gpio7",
157#endif
158 NULL };
159#else
160extern char *PIP_ID_TXT[];
161extern char *RDR_CD_TXT[];
162#endif
163
164#define PIP_ID_ECM 0
165#define PIP_ID_EMM 1
166#define PIP_ID_LOG 2
167#define PIP_ID_CIN 3 // CARD_INFO
168#define PIP_ID_HUP 4
169#define PIP_ID_MAX PIP_ID_HUP
170#define PIP_ID_DCW 5
171
172#define PIP_ID_ERR (-1)
173#define PIP_ID_DIR (-2)
174#define PIP_ID_NUL (-3)
175
176#define cdiff *c_start
177
178#define NCD_AUTO 0
179#define NCD_524 1
180#define NCD_525 2
181
182#define CS_ANTICASC
183
184// moved from reader-common.h
185#define CARD_INSERTED 1
186#define CARD_NEED_INIT 2
187#define CARD_FAILURE 4
188
189enum {E1_GLOBAL=0, E1_USER, E1_READER, E1_SERVER, E1_LSERVER};
190enum {E2_GLOBAL=0, E2_GROUP, E2_CAID, E2_IDENT, E2_CLASS, E2_CHID, E2_QUEUE,
191 E2_EA_LEN, E2_F0_LEN, E2_OFFLINE, E2_SID};
192
193//typedef unsigned char uchar;
194//typedef unsigned long ulong;
195
196// constants
197#define CTA_RES_LEN 512
198
199typedef struct s_classtab
200{
201 uchar an;
202 uchar bn;
203 uchar aclass[31];
204 uchar bclass[31];
205} GCC_PACK CLASSTAB;
206
207typedef struct s_caidtab
208{
209 ushort caid[CS_MAXCAIDTAB];
210 ushort mask[CS_MAXCAIDTAB];
211 ushort cmap[CS_MAXCAIDTAB];
212} GCC_PACK CAIDTAB;
213
214typedef struct s_tuntab
215{
216 ushort bt_caidfrom[CS_MAXTUNTAB];
217 ushort bt_caidto[CS_MAXTUNTAB];
218 ushort bt_srvid[CS_MAXTUNTAB];
219} GCC_PACK TUNTAB;
220
221typedef struct s_sidtab
222{
223 char label[33];
224 ushort num_caid;
225 ushort num_provid;
226 ushort num_srvid;
227 ushort *caid;
228 ulong *provid;
229 ushort *srvid;
230 struct s_sidtab *next;
231} GCC_PACK SIDTAB;
232
233
234typedef struct s_filter
235{
236 ushort caid;
237 uchar nprids;
238 ulong prids[CS_MAXPROV];
239} GCC_PACK FILTER;
240
241typedef struct s_ftab
242{
243 int nfilts;
244 FILTER filts[CS_MAXFILTERS];
245} GCC_PACK FTAB;
246
247typedef struct s_port
248{
249 int fd;
250 int s_port;
251 FTAB ftab;
252} GCC_PACK PORT;
253
254typedef struct s_ptab
255{
256 int nports;
257 PORT ports[CS_MAXPORTS];
258} GCC_PACK PTAB;
259
260struct s_ecm
261{
262 uchar ecmd5[CS_ECMSTORESIZE];
263 uchar cw[16];
264 ushort caid;
265 ulong prid;
266 ulong grp;
267// int level;
268};
269
270struct s_emm
271{
272 uchar emm[CS_EMMSTORESIZE];
273 uchar type;
274 int count;
275};
276
277struct s_module
278{
279 //int fd;
280 int multi;
281 int type;
282 int watchdog;
283 char desc[16];
284 char *logtxt;
285 //int s_port;
286 in_addr_t s_ip;
287 void (*s_handler)();
288 int (*recv)();
289 void (*send_dcw)();
290 void (*cleanup)();
291 int c_multi;
292 int (*c_recv_chk)();
293 int (*c_init)();
294 int (*c_send_ecm)();
295 int (*c_init_log)();
296 int (*c_recv_log)();
297 int c_port;
298 PTAB *ptab;
299};
300
301struct s_irdeto_quess
302{
303 int b47;
304 ushort caid;
305 ushort sid;
306 struct s_irdeto_quess *next;
307};
308
309struct s_client
310{
311 pid_t pid;
312 in_addr_t ip;
313 in_port_t port;
314 time_t login;
315 time_t last;
316 time_t lastswitch;
317 time_t lastemm;
318 time_t lastecm;
319 time_t expirationdate;
320 ulong grp;
321 int crypted;
322 int dup;
323 int au;
324 char autoau;
325 int monlvl;
326 int dbglvl;
327 CAIDTAB ctab;
328 TUNTAB ttab;
329 ulong sidtabok; // positiv services
330 ulong sidtabno; // negative services
331 int typ;
332 int ctyp;
333 int stat;
334 int ufd;
335 int last_srvid;
336 int last_caid;
337 int tosleep;
338 char usr[32];
339 int udp_fd;
340 int fd_m2c;
341 struct sockaddr_in udp_sa;
342 int log;
343 int logcounter;
344 int cwfound;
345 int cwcache;
346 int cwnot;
347 uchar ucrc[4]; // needed by monitor and used by camd35
348 ulong pcrc; // pwd crc
349 AES_KEY aeskey; // needed by monitor and used by camd33, camd35
350 ushort ncd_msgid;
351 uchar ncd_skey[16];
352 int port_idx; // index in server ptab
353 int ncd_server; // newcamd server?
354#ifdef CS_ANTICASC
355 ushort ac_idx;
356 ushort ac_limit;
357 uchar ac_penalty;
358#endif
359 FTAB fchid;
360 FTAB ftab; // user [caid] and ident filter
361 CLASSTAB cltab;
362};
363
364struct s_reader
365{
366 int cs_idx;
367 int fd;
368 ulong grp;
369 int fallback;
370 int typ;
371 int card_system;
372 char label[32];
373 char device[128];
374 char pcsc_name[128];
375 int pcsc_has_card;
376 int detect;
377 int mhz; //actual clock rate of reader in 10khz steps
378 int cardmhz; //standard clock speed your card should have in 10khz steps; normally 357 but for Irdeto cards 600
379 int r_port;
380 char r_usr[64];
381 char r_pwd[64];
382 int r_crypted;
383 int l_port;
384 int log_port;
385 CAIDTAB ctab;
386 ulong boxid;
387 uchar nagra_boxkey[8];
388 int nagra_native;
389 uchar aes_key[16];
390 uchar rsa_mod[64]; //rsa modulus for nagra cards
391 ulong sidtabok; // positiv services
392 ulong sidtabno; // negative services
393 uchar hexserial[8];
394 int nprov;
395 uchar prid[CS_MAXPROV][8];
396 uchar availkeys[CS_MAXPROV][16]; // viaccess; misused in seca, if availkeys[PROV][0]=0 then expired, 1 then valid.
397 uchar sa[CS_MAXPROV][4]; // viaccess & seca
398 ushort acs; // irdeto
399 ushort caid[16];
400 uchar b_nano[256];
401 uchar emmfile[128];
402 char pincode[5];
403 int logemm;
404 int cachemm;
405 int rewritemm;
406 int online;
407 int card_status;
408 struct s_module ph;
409 uchar ncd_key[16];
410 uchar ncd_skey[16];
411 int ncd_disable_server_filt;
412 ushort ncd_msgid;
413 int ncd_proto;
414 char cc_version[7]; // cccam version
415 char cc_build[5]; // cccam build number
416 int cc_maxhop; // cccam max distance
417 void *cc; // ptr to cccam internal data struct
418 uchar tcp_connected;
419 int tcp_ito; // inactivity timeout
420 int tcp_rto; // reconnect timeout
421 time_t last_g; // get (if last_s-last_g>tcp_rto - reconnect )
422 time_t last_s; // send
423 uchar show_cls; // number of classes subscription showed on kill -31
424 int maxqlen; // max queue length
425 int qlen; // current queue length
426 FTAB fchid;
427 FTAB ftab;
428 CLASSTAB cltab;
429 uchar gbox_pwd[4];
430 uchar gbox_timecode[7];
431 int gbox_online;
432 uchar gbox_vers;
433 uchar gbox_prem;
434 int gbox_fd;
435 struct timeb gbox_lasthello; // incoming time stamp
436#ifdef CS_RDR_INIT_HIST
437 uchar init_history[4096];
438 int init_history_pos;
439#endif
440 int msg_idx;
441#ifdef HAVE_PCSC
442 SCARDCONTEXT hContext;
443 SCARDHANDLE hCard;
444 DWORD dwActiveProtocol;
445#endif
446
447};
448
449#ifdef CS_ANTICASC
450
451struct s_acasc_shm {
452 ushort ac_count : 15;
453 ushort ac_deny : 1;
454};
455
456struct s_acasc {
457 ushort stat[10];
458 uchar idx; // current active index in stat[]
459};
460
461struct s_cpmap
462{
463 ushort caid;
464 ulong provid;
465 ushort sid;
466 ushort chid;
467 ushort dwtime;
468 struct s_cpmap *next;
469};
470#endif
471
472struct s_auth
473{
474 char usr[33];
475 char pwd[33];
476 int uniq;
477 int au;
478 int autoau;
479 int monlvl;
480 ulong grp;
481 int tosleep;
482 CAIDTAB ctab;
483 ulong sidtabok; // positiv services
484 ulong sidtabno; // negative services
485 FTAB fchid;
486 FTAB ftab; // user [caid] and ident filter
487 CLASSTAB cltab;
488 TUNTAB ttab;
489#ifdef CS_ANTICASC
490 int ac_idx;
491 int ac_users; // 0 - unlimited
492 uchar ac_penalty; // 0 - log, >0 - fake dw
493#endif
494 in_addr_t dynip;
495 uchar dyndns[64];
496 time_t expirationdate;
497 struct s_auth *next;
498};
499
500struct s_srvid
501{
502 int srvid;
503 char name[33];
504 struct s_srvid *next;
505};
506
507struct s_ip
508{
509 in_addr_t ip[2];
510 struct s_ip *next;
511};
512
513struct s_config
514{
515 int nice;
516 ulong netprio;
517 ulong ctimeout;
518 ulong ftimeout;
519 int cmaxidle;
520 int ulparent;
521 ulong delay;
522 int bindwait;
523 int resolvedelay;
524 int tosleep;
525 in_addr_t srvip;
526 char pidfile[128];
527 char usrfile[128];
528 char cwlogdir[128];
529 struct s_auth *account;
530 struct s_srvid *srvid;
531 struct s_sidtab *sidtab;
532 int mon_port;
533 in_addr_t mon_srvip;
534 struct s_ip *mon_allowed;
535 int mon_aulow;
536 int mon_hideclient_to;
537 int mon_level;
538 int c33_port;
539 in_addr_t c33_srvip;
540 uchar c33_key[16];
541 int c33_crypted;
542 int c33_passive;
543 struct s_ip *c33_plain;
544 int c35_port;
545 in_addr_t c35_srvip;
546 PTAB c35_tcp_ptab;
547 in_addr_t c35_tcp_srvip;
548 PTAB ncd_ptab;
549 in_addr_t ncd_srvip;
550 uchar ncd_key[16];
551 PTAB cc_ptab;
552 int rad_port;
553 in_addr_t rad_srvip;
554 struct s_ip *rad_allowed;
555 char rad_usr[32];
556 char ser_device[512];
557 int srtimeout; // SerialReaderTimeount in millisec
558 int max_log_size;
559 int show_ecm_dw;
560 int waitforcards;
561 int preferlocalcards;
562 uchar gbox_pwd[8];
563 uchar ignorefile[512];
564 uchar cardfile[512];
565 uchar gbxShareOnl[512];
566 int maxdist;
567 int num_locals;
568 unsigned long locals[CS_MAXLOCALS];
569 //struct s_irdeto_quess *itab[0xff];
570#ifdef HAVE_DVBAPI_3
571 int dvbapi_enabled;
572 int dvbapi_au;
573 char dvbapi_usr[64];
574 char dvbapi_demux[128];
575 char dvbapi_ca[128];
576 char dvbapi_socket[128];
577#endif
578#ifdef CS_ANTICASC
579 char ac_enabled;
580 int ac_users; // num of users for account (0 - default)
581 int ac_stime; // time to collect AC statistics (3 min - default)
582 int ac_samples; // qty of samples
583 int ac_penalty; // 0 - write to log
584 int ac_fakedelay; // 100-1000 ms
585 int ac_denysamples;
586 char ac_logfile[128];
587 struct s_cpmap *cpmap;
588#endif
589// struct s_reader reader[];
590};
591
592typedef struct ecm_request_t
593{
594
595 uchar ecm[256];
596 uchar cw[16];
597 uchar ecmd5[CS_ECMSTORESIZE];
598// uchar l;
599 short l;
600 ushort caid;
601 ushort ocaid;
602 ushort srvid;
603 ushort chid;
604 ushort pid;
605 ushort idx;
606 ulong prid;
607 int reader[CS_MAXREADER];
608 int cidx; // client index
609 int cpti; // client pending table index
610 int stage; // processing stage in server module
611 int level; // send-level in client module
612 int rc;
613 uchar rcEx;
614 struct timeb tps; // incoming time stamp
615 uchar locals_done;
616 ushort gbxCWFrom;
617 ushort gbxFrom;
618 ushort gbxTo;
619
620 uchar gbxForward[16];
621 int gbxRidx;
622} GCC_PACK ECM_REQUEST;
623
624typedef struct emm_packet_t
625{
626 uchar emm[258];
627 uchar l;
628 uchar caid[2];
629 uchar provid[4];
630 uchar hexserial[8];
631 uchar type;
632 int cidx;
633} GCC_PACK EMM_PACKET;
634
635// oscam-simples
636extern char *remote_txt(void);
637extern char *trim(char *);
638extern char *strtolower(char *);
639extern int gethexval(char);
640extern int cs_atob(uchar *, char *, int);
641extern ulong cs_atoi(char *, int, int);
642extern int byte_atob(char *);
643extern long word_atob(char *);
644extern int key_atob(char *, uchar *);
645extern int key_atob4(char *, uchar *);
646extern char *key_btoa(char *, uchar *);
647extern char *cs_hexdump(int, uchar *, int);
648extern in_addr_t cs_inet_order(in_addr_t);
649extern char *cs_inet_ntoa(in_addr_t);
650extern in_addr_t cs_inet_addr(char *txt);
651extern ulong b2i(int, uchar *);
652extern ullong b2ll(int, uchar *);
653extern uchar *i2b(int, ulong);
654extern ulong a2i(char *, int);
655extern int boundary(int, int);
656extern void cs_ftime(struct timeb *);
657extern void cs_sleepms(int);
658extern int bytes_available(int);
659extern void cs_setpriority(int);
660extern struct s_auth *find_user(char *);
661
662// oscam variables
663extern int pfd, rfd, fd_c2m, fd_m2c, cs_idx, *c_start, cs_ptyp, cs_dblevel, cs_hw;
664extern int *logidx, *loghistidx, *log_fd;
665extern int is_server, *mcl;
666extern uchar mbuf[1024];
667extern ushort len4caid[256];
668extern pid_t master_pid;
669extern struct s_ecm *ecmcache;
670extern struct s_client *client;
671extern struct s_reader *reader;
672
673extern struct card_struct *Cards;
674extern struct idstore_struct *idstore;
675extern unsigned long *IgnoreList;
676
677extern struct s_config *cfg;
678extern char cs_confdir[], *loghist;
679extern EMM_PACKET epg;
680extern struct s_module ph[CS_MAX_MOD];
681extern ECM_REQUEST *ecmtask;
682extern char logfile[256];
683#ifdef CS_ANTICASC
684extern struct s_acasc_shm *acasc;
685extern FILE *fpa;
686extern int use_ac_log;
687#endif
688
689
690// oscam
691extern char *cs_platform(char *);
692extern int recv_from_udpipe(uchar *, int);
693extern char* username(int);
694extern int idx_from_pid(pid_t);
695extern int idx_from_username(char *uname);
696extern int chk_bcaid(ECM_REQUEST *, CAIDTAB *);
697extern void cs_exit(int sig);
698extern int cs_fork(in_addr_t, in_port_t);
699extern void wait4master(void);
700extern int cs_auth_client(struct s_auth *, char*);
701extern void cs_disconnect_client(void);
702extern int check_ecmcache(ECM_REQUEST *, ulong);
703extern int write_to_pipe(int, int, uchar *, int);
704extern int read_from_pipe(int, uchar **, int);
705extern int write_ecm_request(int, ECM_REQUEST *);
706extern int write_ecm_answer(int, ECM_REQUEST *);
707extern void log_emm_request(int);
708extern ulong chk_provid(uchar *, ushort);
709extern void guess_cardsystem(ECM_REQUEST *);
710extern void guess_irdeto(ECM_REQUEST *);
711extern void get_cw(ECM_REQUEST *);
712extern void do_emm(EMM_PACKET *);
713extern ECM_REQUEST *get_ecmtask(void);
714extern void request_cw(ECM_REQUEST *, int, int);
715extern int send_dcw(ECM_REQUEST *);
716extern int process_input(uchar *, int, int);
717extern int chk_srvid(ECM_REQUEST *, int);
718extern int chk_sfilter(ECM_REQUEST *, PTAB*);
719extern int chk_ufilters(ECM_REQUEST *);
720extern int chk_rfilter(ECM_REQUEST *, struct s_reader *);
721extern int chk_rsfilter(ECM_REQUEST *, int);
722extern int chk_avail_reader(ECM_REQUEST *, struct s_reader *);
723extern int matching_reader(ECM_REQUEST *, struct s_reader *);
724extern void set_signal_handler(int , int , void (*)(int));
725extern void cs_log_config(void);
726extern void cs_resolve(void);
727extern void chk_dcw(int fd);
728
729#ifdef CS_ANTICASC
730//extern void start_anticascader(void);
731extern void init_ac(void);
732extern void ac_init_stat();
733extern int ac_init_log(char*);
734extern void ac_do_stat(void);
735extern void ac_init_client(struct s_auth *);
736extern void ac_chk(ECM_REQUEST*, int);
737#endif
738
739// oscam-nano
740extern int chk_class(ECM_REQUEST *, CLASSTAB*, const char*, const char*);
741
742// oscam-config
743extern int init_config(void);
744extern int init_userdb(void);
745extern int init_readerdb(void);
746extern int init_sidtab(void);
747extern int init_srvid(void);
748extern int search_boxkey(ushort, ulong, char *);
749extern void init_len4caid(void);
750extern int init_irdeto_guess_tab(void);
751
752// oscam-reader
753extern int ridx, logfd;
754extern void cs_ri_brk(int);
755extern void cs_ri_log(char *,...);
756extern void start_cardreader(void);
757extern void reader_card_info(void);
758extern void network_tcp_connection_close(int);
759
760// oscam-log
761extern int cs_init_log(char *);
762extern void cs_write_log(char *);
763extern void cs_log(char *,...);
764extern void cs_debug(char *,...);
765extern void cs_ddump(uchar *, int, char *, ...);
766extern void cs_close_log(void);
767extern int cs_init_statistics(char *);
768extern void cs_statistics(int);
769extern void cs_dump(uchar *, int, char *, ...);
770
771// oscam-aes
772extern void aes_set_key(char *);
773extern void aes_encrypt_idx(int, uchar *, int);
774extern void aes_decrypt(uchar *, int);
775#define aes_encrypt(b, n) aes_encrypt_idx(cs_idx, b, n)
776
777// reader-common
778extern int reader_device_init(char *, int);
779extern int reader_checkhealth(void);
780extern void reader_post_process(void);
781extern int reader_ecm(ECM_REQUEST *);
782extern int reader_emm(EMM_PACKET *);
783
784#ifdef HAVE_PCSC
785// reader-pcsc
786extern int pcsc_reader_do_api(struct s_reader *pcsc_reader, uchar *buf, uchar *cta_res, ushort *cta_lr,int l, int dbg);
787extern int pcsc_activate_card(struct s_reader *pcsc_reader, uchar *atr, ushort *atr_size);
788extern int pcsc_check_card_inserted(struct s_reader *pcsc_reader);
789extern int pcsc_reader_init(struct s_reader *pcsc_reader, char *device);
790#endif
791
792// reader-irdeto
793extern int irdeto_card_init(uchar *, int);
794extern int irdeto_do_ecm(ECM_REQUEST *);
795extern int irdeto_do_emm(EMM_PACKET *);
796extern int irdeto_card_info(void);
797
798// reader-viaccess
799extern int viaccess_card_init(uchar *, int);
800extern int viaccess_do_ecm(ECM_REQUEST *);
801extern int viaccess_do_emm(EMM_PACKET *);
802extern int viaccess_card_info(void);
803
804// reader-videoguard
805extern int videoguard_card_init(uchar *, int);
806extern int videoguard_do_ecm(ECM_REQUEST *);
807extern int videoguard_do_emm(EMM_PACKET *);
808extern int videoguard_card_info(void);
809
810// reader-cryptoworks
811extern int cryptoworks_card_init(uchar *, int);
812extern int cryptoworks_do_ecm(ECM_REQUEST *);
813extern int cryptoworks_do_emm(EMM_PACKET *);
814extern int cryptoworks_card_info(void);
815
816// reader-seca
817extern int seca_card_init(uchar *, int);
818extern int seca_do_ecm(ECM_REQUEST *);
819extern int seca_do_emm(EMM_PACKET *);
820extern int seca_card_info(void);
821
822// reader-nds
823extern int nds_card_init(uchar *, int);
824extern int nds_do_ecm(ECM_REQUEST *);
825extern int nds_do_emm(EMM_PACKET *);
826extern int nds_card_info(void);
827
828// reader nagra2/3
829extern int nagra2_card_init(uchar *, int);
830extern int nagra2_do_ecm(ECM_REQUEST *er);
831extern int nagra2_card_info(void);
832extern int nagra2_do_emm(EMM_PACKET *);
833extern void nagra2_post_process();
834
835// protocol modules
836extern int monitor_send_idx(int, char *);
837extern void module_monitor(struct s_module *);
838extern void module_camd35(struct s_module *);
839extern void module_camd35_tcp(struct s_module *);
840extern void module_camd33(struct s_module *);
841extern void module_newcamd(struct s_module *);
842extern void module_radegast(struct s_module *);
843extern void module_oscam_ser(struct s_module *);
844extern void module_gbox(struct s_module *);
845extern void module_cccam(struct s_module *);
846#ifdef HAVE_DVBAPI_3
847extern void module_dvbapi(struct s_module *);
848#endif
849extern struct timeval *chk_pending(struct timeb tp_ctimeout);
850#endif // CS_GLOBALS
Note: See TracBrowser for help on using the repository browser.