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