source: trunk/globals.h@ 954

Last change on this file since 954 was 954, checked in by C.H.A.D.o, 11 years ago

Fix compiler warnings

File size: 20.9 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 8
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 ulong grp;
320 int crypted;
321 int dup;
322 int au;
323 char autoau;
324 int monlvl;
325 int dbglvl;
326 CAIDTAB ctab;
327 TUNTAB ttab;
328 ulong sidtabok; // positiv services
329 ulong sidtabno; // negative services
330 int typ;
331 int ctyp;
332 int stat;
333 int ufd;
334 int last_srvid;
335 int last_caid;
336 int tosleep;
337 char usr[32];
338 int udp_fd;
339 int fd_m2c;
340 struct sockaddr_in udp_sa;
341 int log;
342 int logcounter;
343 int cwfound;
344 int cwcache;
345 int cwnot;
346 uchar ucrc[4]; // needed by monitor and used by camd35
347 ulong pcrc; // pwd crc
348 AES_KEY aeskey; // needed by monitor and used by camd33, camd35
349 ushort ncd_msgid;
350 uchar ncd_skey[16];
351 int port_idx; // index in server ptab
352 int ncd_server; // newcamd server?
353#ifdef CS_ANTICASC
354 ushort ac_idx;
355 ushort ac_limit;
356 uchar ac_penalty;
357#endif
358 FTAB fchid;
359 FTAB ftab; // user [caid] and ident filter
360 CLASSTAB cltab;
361};
362
363struct s_reader
364{
365 int cs_idx;
366 int fd;
367 ulong grp;
368 int fallback;
369 int typ;
370 int card_system;
371 char label[32];
372 char device[128];
373 char pcsc_name[128];
374 int pcsc_has_card;
375 int detect;
376 int mhz; //actual clock rate of reader in 10khz steps
377 int cardmhz; //standard clock speed your card should have in 10khz steps; normally 357 but for Irdeto cards 600
378 int r_port;
379 char r_usr[64];
380 char r_pwd[64];
381 int r_crypted;
382 int l_port;
383 int log_port;
384 CAIDTAB ctab;
385 ulong boxid;
386 uchar nagra_boxkey[8];
387 int nagra_native;
388 uchar aes_key[16];
389 uchar rsa_mod[64]; //rsa modulus for nagra cards
390 ulong sidtabok; // positiv services
391 ulong sidtabno; // negative services
392 uchar hexserial[8];
393 int nprov;
394 uchar prid[CS_MAXPROV][8];
395 uchar availkeys[CS_MAXPROV][16]; // viaccess; misused in seca, if availkeys[PROV][0]=0 then expired, 1 then valid.
396 uchar sa[CS_MAXPROV][4]; // viaccess & seca
397 ushort acs; // irdeto
398 ushort caid[16];
399 uchar b_nano[256];
400 uchar emmfile[128];
401 char pincode[5];
402 int logemm;
403 int cachemm;
404 int rewritemm;
405 int online;
406 int card_status;
407 struct s_module ph;
408 uchar ncd_key[16];
409 uchar ncd_skey[16];
410 int ncd_disable_server_filt;
411 ushort ncd_msgid;
412 int ncd_proto;
413 char cc_version[7]; // cccam version
414 char cc_build[5]; // cccam build number
415 int cc_maxhop; // cccam max distance
416 void *cc; // ptr to cccam internal data struct
417 uchar tcp_connected;
418 int tcp_ito; // inactivity timeout
419 int tcp_rto; // reconnect timeout
420 time_t last_g; // get (if last_s-last_g>tcp_rto - reconnect )
421 time_t last_s; // send
422 uchar show_cls; // number of classes subscription showed on kill -31
423 int maxqlen; // max queue length
424 int qlen; // current queue length
425 FTAB fchid;
426 FTAB ftab;
427 CLASSTAB cltab;
428 uchar gbox_pwd[4];
429 uchar gbox_timecode[7];
430 int gbox_online;
431 uchar gbox_vers;
432 uchar gbox_prem;
433 int gbox_fd;
434 struct timeb gbox_lasthello; // incoming time stamp
435#ifdef CS_RDR_INIT_HIST
436 uchar init_history[4096];
437 int init_history_pos;
438#endif
439 int msg_idx;
440#ifdef HAVE_PCSC
441 SCARDCONTEXT hContext;
442 SCARDHANDLE hCard;
443 DWORD dwActiveProtocol;
444#endif
445
446};
447
448#ifdef CS_ANTICASC
449
450struct s_acasc_shm {
451 ushort ac_count : 15;
452 ushort ac_deny : 1;
453};
454
455struct s_acasc {
456 ushort stat[10];
457 uchar idx; // current active index in stat[]
458};
459
460struct s_cpmap
461{
462 ushort caid;
463 ulong provid;
464 ushort sid;
465 ushort chid;
466 ushort dwtime;
467 struct s_cpmap *next;
468};
469#endif
470
471struct s_auth
472{
473 char usr[33];
474 char pwd[33];
475 int uniq;
476 int au;
477 int autoau;
478 int monlvl;
479 ulong grp;
480 int tosleep;
481 CAIDTAB ctab;
482 ulong sidtabok; // positiv services
483 ulong sidtabno; // negative services
484 FTAB fchid;
485 FTAB ftab; // user [caid] and ident filter
486 CLASSTAB cltab;
487 TUNTAB ttab;
488#ifdef CS_ANTICASC
489 int ac_idx;
490 int ac_users; // 0 - unlimited
491 uchar ac_penalty; // 0 - log, >0 - fake dw
492#endif
493 in_addr_t dynip;
494 uchar dyndns[64];
495 struct s_auth *next;
496};
497
498struct s_srvid
499{
500 int srvid;
501 char name[33];
502 struct s_srvid *next;
503};
504
505struct s_ip
506{
507 in_addr_t ip[2];
508 struct s_ip *next;
509};
510
511struct s_config
512{
513 int nice;
514 ulong netprio;
515 ulong ctimeout;
516 ulong ftimeout;
517 int cmaxidle;
518 int ulparent;
519 ulong delay;
520 int bindwait;
521 int resolvedelay;
522 int tosleep;
523 in_addr_t srvip;
524 char pidfile[128];
525 char usrfile[128];
526 char cwlogdir[128];
527 struct s_auth *account;
528 struct s_srvid *srvid;
529 struct s_sidtab *sidtab;
530 int mon_port;
531 in_addr_t mon_srvip;
532 struct s_ip *mon_allowed;
533 int mon_aulow;
534 int mon_hideclient_to;
535 int mon_level;
536 int c33_port;
537 in_addr_t c33_srvip;
538 uchar c33_key[16];
539 int c33_crypted;
540 int c33_passive;
541 struct s_ip *c33_plain;
542 int c35_port;
543 in_addr_t c35_srvip;
544 PTAB c35_tcp_ptab;
545 in_addr_t c35_tcp_srvip;
546 PTAB ncd_ptab;
547 in_addr_t ncd_srvip;
548 uchar ncd_key[16];
549 PTAB cc_ptab;
550 int rad_port;
551 in_addr_t rad_srvip;
552 struct s_ip *rad_allowed;
553 char rad_usr[32];
554 char ser_device[512];
555 int srtimeout; // SerialReaderTimeount in millisec
556 int max_log_size;
557 int show_ecm_dw;
558 int waitforcards;
559 int preferlocalcards;
560 uchar gbox_pwd[8];
561 uchar ignorefile[512];
562 uchar cardfile[512];
563 uchar gbxShareOnl[512];
564 int maxdist;
565 int num_locals;
566 unsigned long locals[CS_MAXLOCALS];
567 //struct s_irdeto_quess *itab[0xff];
568#ifdef CS_ANTICASC
569 char ac_enabled;
570 int ac_users; // num of users for account (0 - default)
571 int ac_stime; // time to collect AC statistics (3 min - default)
572 int ac_samples; // qty of samples
573 int ac_penalty; // 0 - write to log
574 int ac_fakedelay; // 100-1000 ms
575 int ac_denysamples;
576 char ac_logfile[128];
577 struct s_cpmap *cpmap;
578#endif
579// struct s_reader reader[];
580};
581
582typedef struct ecm_request_t
583{
584
585 uchar ecm[256];
586 uchar cw[16];
587 uchar ecmd5[CS_ECMSTORESIZE];
588// uchar l;
589 short l;
590 ushort caid;
591 ushort ocaid;
592 ushort srvid;
593 ushort chid;
594 ushort pid;
595 ushort idx;
596 ulong prid;
597 int reader[CS_MAXREADER];
598 int cidx; // client index
599 int cpti; // client pending table index
600 int stage; // processing stage in server module
601 int level; // send-level in client module
602 int rc;
603 uchar rcEx;
604 struct timeb tps; // incoming time stamp
605 uchar locals_done;
606 ushort gbxCWFrom;
607 ushort gbxFrom;
608 ushort gbxTo;
609
610 uchar gbxForward[16];
611 int gbxRidx;
612} GCC_PACK ECM_REQUEST;
613
614typedef struct emm_packet_t
615{
616 uchar emm[258];
617 uchar l;
618 uchar caid[2];
619 uchar provid[4];
620 uchar hexserial[8];
621 uchar type;
622 int cidx;
623} GCC_PACK EMM_PACKET;
624
625// oscam-simples
626extern char *remote_txt(void);
627extern char *trim(char *);
628extern char *strtolower(char *);
629extern int gethexval(char);
630extern int cs_atob(uchar *, char *, int);
631extern ulong cs_atoi(char *, int, int);
632extern int byte_atob(char *);
633extern long word_atob(char *);
634extern int key_atob(char *, uchar *);
635extern int key_atob4(char *, uchar *);
636extern char *key_btoa(char *, uchar *);
637extern char *cs_hexdump(int, uchar *, int);
638extern in_addr_t cs_inet_order(in_addr_t);
639extern char *cs_inet_ntoa(in_addr_t);
640extern in_addr_t cs_inet_addr(char *txt);
641extern ulong b2i(int, uchar *);
642extern ullong b2ll(int, uchar *);
643extern uchar *i2b(int, ulong);
644extern ulong a2i(char *, int);
645extern int boundary(int, int);
646extern void cs_ftime(struct timeb *);
647extern void cs_sleepms(int);
648extern int bytes_available(int);
649extern void cs_setpriority(int);
650extern struct s_auth *find_user(char *);
651
652// oscam variables
653extern int pfd, rfd, fd_c2m, fd_m2c, cs_idx, *c_start, cs_ptyp, cs_dblevel, cs_hw;
654extern int *logidx, *loghistidx, *log_fd;
655extern int is_server, *mcl;
656extern uchar mbuf[1024];
657extern ushort len4caid[256];
658extern pid_t master_pid;
659extern struct s_ecm *ecmcache;
660extern struct s_client *client;
661extern struct s_reader *reader;
662
663extern struct card_struct *Cards;
664extern struct idstore_struct *idstore;
665extern unsigned long *IgnoreList;
666
667extern struct s_config *cfg;
668extern char cs_confdir[], *loghist;
669extern EMM_PACKET epg;
670extern struct s_module ph[CS_MAX_MOD];
671extern ECM_REQUEST *ecmtask;
672extern char logfile[256];
673#ifdef CS_ANTICASC
674extern struct s_acasc_shm *acasc;
675extern FILE *fpa;
676extern int use_ac_log;
677#endif
678
679
680// oscam
681extern char *cs_platform(char *);
682extern int recv_from_udpipe(uchar *, int);
683extern char* username(int);
684extern int idx_from_pid(pid_t);
685extern int idx_from_username(char *uname);
686extern int chk_bcaid(ECM_REQUEST *, CAIDTAB *);
687extern void cs_exit(int sig);
688extern int cs_fork(in_addr_t, in_port_t);
689extern void wait4master(void);
690extern int cs_auth_client(struct s_auth *, char*);
691extern void cs_disconnect_client(void);
692extern int check_ecmcache(ECM_REQUEST *, ulong);
693extern int write_to_pipe(int, int, uchar *, int);
694extern int read_from_pipe(int, uchar **, int);
695extern int write_ecm_request(int, ECM_REQUEST *);
696extern int write_ecm_answer(int, ECM_REQUEST *);
697extern void log_emm_request(int);
698extern ulong chk_provid(uchar *, ushort);
699extern void guess_cardsystem(ECM_REQUEST *);
700extern void guess_irdeto(ECM_REQUEST *);
701extern void get_cw(ECM_REQUEST *);
702extern void do_emm(EMM_PACKET *);
703extern ECM_REQUEST *get_ecmtask(void);
704extern void request_cw(ECM_REQUEST *, int, int);
705extern int send_dcw(ECM_REQUEST *);
706extern int process_input(uchar *, int, int);
707extern int chk_srvid(ECM_REQUEST *, int);
708extern int chk_sfilter(ECM_REQUEST *, PTAB*);
709extern int chk_ufilters(ECM_REQUEST *);
710extern int chk_rfilter(ECM_REQUEST *, struct s_reader *);
711extern int chk_rsfilter(ECM_REQUEST *, int);
712extern int chk_avail_reader(ECM_REQUEST *, struct s_reader *);
713extern int matching_reader(ECM_REQUEST *, struct s_reader *);
714extern void set_signal_handler(int , int , void (*)(int));
715extern void cs_log_config(void);
716extern void cs_resolve(void);
717
718#ifdef CS_ANTICASC
719//extern void start_anticascader(void);
720extern void init_ac(void);
721extern void ac_init_stat();
722extern int ac_init_log(char*);
723extern void ac_do_stat(void);
724extern void ac_init_client(struct s_auth *);
725extern void ac_chk(ECM_REQUEST*, int);
726#endif
727
728// oscam-nano
729extern int chk_class(ECM_REQUEST *, CLASSTAB*, const char*, const char*);
730
731// oscam-config
732extern int init_config(void);
733extern int init_userdb(void);
734extern int init_readerdb(void);
735extern int init_sidtab(void);
736extern int init_srvid(void);
737extern int search_boxkey(ushort, ulong, char *);
738extern void init_len4caid(void);
739extern int init_irdeto_guess_tab(void);
740
741// oscam-reader
742extern int ridx, logfd;
743extern void cs_ri_brk(int);
744extern void cs_ri_log(char *,...);
745extern void start_cardreader(void);
746extern void reader_card_info(void);
747extern void network_tcp_connection_close(int);
748
749// oscam-log
750extern int cs_init_log(char *);
751extern void cs_write_log(char *);
752extern void cs_log(char *,...);
753extern void cs_debug(char *,...);
754extern void cs_ddump(uchar *, int, char *, ...);
755extern void cs_close_log(void);
756extern int cs_init_statistics(char *);
757extern void cs_statistics(int);
758extern void cs_dump(uchar *, int, char *, ...);
759
760// oscam-aes
761extern void aes_set_key(char *);
762extern void aes_encrypt_idx(int, uchar *, int);
763extern void aes_decrypt(uchar *, int);
764#define aes_encrypt(b, n) aes_encrypt_idx(cs_idx, b, n)
765
766// reader-common
767extern int reader_device_init(char *, int);
768extern int reader_checkhealth(void);
769extern void reader_post_process(void);
770extern int reader_ecm(ECM_REQUEST *);
771extern int reader_emm(EMM_PACKET *);
772
773#ifdef HAVE_PCSC
774// reader-pcsc
775extern int pcsc_reader_do_api(struct s_reader *pcsc_reader, uchar *buf, uchar *cta_res, ushort *cta_lr,int l, int dbg);
776extern int pcsc_activate_card(struct s_reader *pcsc_reader, uchar *atr, ushort *atr_size);
777extern int pcsc_check_card_inserted(struct s_reader *pcsc_reader);
778extern int pcsc_reader_init(struct s_reader *pcsc_reader, char *device);
779#endif
780
781// reader-irdeto
782extern int irdeto_card_init(uchar *, int);
783extern int irdeto_do_ecm(ECM_REQUEST *);
784extern int irdeto_do_emm(EMM_PACKET *);
785extern int irdeto_card_info(void);
786
787// reader-viaccess
788extern int viaccess_card_init(uchar *, int);
789extern int viaccess_do_ecm(ECM_REQUEST *);
790extern int viaccess_do_emm(EMM_PACKET *);
791extern int viaccess_card_info(void);
792
793// reader-videoguard
794extern int videoguard_card_init(uchar *, int);
795extern int videoguard_do_ecm(ECM_REQUEST *);
796extern int videoguard_do_emm(EMM_PACKET *);
797extern int videoguard_card_info(void);
798
799// reader-cryptoworks
800extern int cryptoworks_card_init(uchar *, int);
801extern int cryptoworks_do_ecm(ECM_REQUEST *);
802extern int cryptoworks_do_emm(EMM_PACKET *);
803extern int cryptoworks_card_info(void);
804
805// reader-seca
806extern int seca_card_init(uchar *, int);
807extern int seca_do_ecm(ECM_REQUEST *);
808extern int seca_do_emm(EMM_PACKET *);
809extern int seca_card_info(void);
810
811// reader-nds
812extern int nds_card_init(uchar *, int);
813extern int nds_do_ecm(ECM_REQUEST *);
814extern int nds_do_emm(EMM_PACKET *);
815extern int nds_card_info(void);
816
817// reader nagra2/3
818extern int nagra2_card_init(uchar *, int);
819extern int nagra2_do_ecm(ECM_REQUEST *er);
820extern int nagra2_card_info(void);
821extern int nagra2_do_emm(EMM_PACKET *);
822extern void nagra2_post_process();
823
824// protocol modules
825extern int monitor_send_idx(int, char *);
826extern void module_monitor(struct s_module *);
827extern void module_camd35(struct s_module *);
828extern void module_camd35_tcp(struct s_module *);
829extern void module_camd33(struct s_module *);
830extern void module_newcamd(struct s_module *);
831extern void module_radegast(struct s_module *);
832extern void module_oscam_ser(struct s_module *);
833extern void module_gbox(struct s_module *);
834extern void module_cccam(struct s_module *);
835extern struct timeval *chk_pending(struct timeb tp_ctimeout);
836#endif // CS_GLOBALS
Note: See TracBrowser for help on using the repository browser.