Changeset 4588 for trunk/module-cccam.c
- Timestamp:
- 01/24/11 14:21:29 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/module-cccam.c
r4586 r4588 631 631 memset(buf, 0, 0x48); 632 632 633 if (cfg ->cc_stealth)633 if (cfg.cc_stealth) 634 634 { 635 635 int i; … … 640 640 memcpy(buf, cc->node_id, 8); 641 641 char cc_build[7]; 642 cc_check_version((char *) cfg ->cc_version, cc_build);643 memcpy(buf + 8, cfg ->cc_version, sizeof(cfg->cc_version)); // cccam version (ascii)642 cc_check_version((char *) cfg.cc_version, cc_build); 643 memcpy(buf + 8, cfg.cc_version, sizeof(cfg.cc_version)); // cccam version (ascii) 644 644 memcpy(buf + 40, cc_build, sizeof(cc_build)); // build number (ascii) 645 645 646 646 cs_debug_mask(D_CLIENT, "%s version: %s, build: %s nodeid: %s", getprefix(), 647 cfg ->cc_version, cc_build, cs_hexdump(0, cc->peer_node_id, 8));647 cfg.cc_version, cc_build, cs_hexdump(0, cc->peer_node_id, 8)); 648 648 649 649 return cc_cmd_send(cl, buf, 0x48, MSG_SRV_DATA); … … 661 661 n = -1; 662 662 for (i = 0; i < CS_MAXPENDING; i++) { 663 if ((t - (ulong) cl->ecmtask[i].tps.time > ((cfg ->ctimeout + 500)663 if ((t - (ulong) cl->ecmtask[i].tps.time > ((cfg.ctimeout + 500) 664 664 / 1000) + 1) && (cl->ecmtask[i].rc >= 10)) // drop timeouts 665 665 { … … 1016 1016 struct timeb timeout; 1017 1017 timeout = cc->ecm_time; 1018 unsigned int tt = cfg ->ctimeout * 4;1018 unsigned int tt = cfg.ctimeout * 4; 1019 1019 timeout.time += tt / 1000; 1020 1020 timeout.millitm += tt % 1000; … … 1196 1196 for (i=1,n=1; i<CS_MAXPENDING; i++) 1197 1197 { 1198 if ((t-cl->ecmtask[i].tps.time > ((cfg ->ctimeout + 500) / 1000) + 1) &&1198 if ((t-cl->ecmtask[i].tps.time > ((cfg.ctimeout + 500) / 1000) + 1) && 1199 1199 (cl->ecmtask[i].rc>=10)) // drop timeouts 1200 1200 { … … 2176 2176 cs_ftime(&tpe); 2177 2177 ulong cwlastresptime = 1000*(tpe.time-cc->ecm_time.time)+tpe.millitm-cc->ecm_time.millitm; 2178 if (cwlastresptime > cfg ->ftimeout && !cc->extended_mode) {2178 if (cwlastresptime > cfg.ftimeout && !cc->extended_mode) { 2179 2179 cs_debug_mask(D_READER, "%s card %04X is too slow, moving to the end...", getprefix(), card->id); 2180 2180 move_card_to_end(cl, card); … … 2351 2351 { 2352 2352 //switching to an oder version and then disconnect... 2353 strcpy(cfg ->cc_version, version[0]);2353 strcpy(cfg.cc_version, version[0]); 2354 2354 ret = -1; 2355 2355 } … … 2771 2771 2772 2772 //Minimize all, transmit just CAID, merge providers: 2773 if (cfg ->cc_minimize_cards == MINIMIZE_CAID) {2773 if (cfg.cc_minimize_cards == MINIMIZE_CAID) { 2774 2774 while ((card2 = ll_iter_next(it))) 2775 2775 if (card2->caid == card->caid && … … 2805 2805 2806 2806 //Removed duplicate cards, keeping card with lower hop: 2807 else if (cfg ->cc_minimize_cards == MINIMIZE_HOPS) {2807 else if (cfg.cc_minimize_cards == MINIMIZE_HOPS) { 2808 2808 while ((card2 = ll_iter_next(it))) { 2809 2809 if (card2->caid == card->caid && … … 2923 2923 struct s_sidtab *ptr_no; 2924 2924 int n; 2925 for (n=0,ptr_no=cfg ->sidtab; ptr_no; ptr_no=ptr_no->next,n++) {2925 for (n=0,ptr_no=cfg.sidtab; ptr_no; ptr_no=ptr_no->next,n++) { 2926 2926 if (cl->sidtabno&((SIDTABBITS)1<<n)) { 2927 2927 int m; … … 2952 2952 struct s_sidtab *ptr; 2953 2953 int j; 2954 for (j=0,ptr=cfg ->sidtab; ptr; ptr=ptr->next,j++) {2954 for (j=0,ptr=cfg.sidtab; ptr; ptr=ptr->next,j++) { 2955 2955 if (cl->sidtabok&((SIDTABBITS)1<<j)) { 2956 2956 int m; … … 2975 2975 * returns 1=ok, 0=error 2976 2976 * 2977 * cfg ->cc_reshare_services=0 CCCAM reader reshares only received cards2977 * cfg.cc_reshare_services=0 CCCAM reader reshares only received cards 2978 2978 * =1 CCCAM reader reshares received cards + defined services 2979 2979 * =2 CCCAM reader reshares only defined reader-services as virtual cards … … 3003 3003 3004 3004 //User-Services: 3005 if (cfg ->cc_reshare_services==3 && cfg->sidtab && cl->sidtabok) {3005 if (cfg.cc_reshare_services==3 && cfg.sidtab && cl->sidtabok) { 3006 3006 struct s_sidtab *ptr; 3007 for (j=0,ptr=cfg ->sidtab; ptr; ptr=ptr->next,j++) {3007 for (j=0,ptr=cfg.sidtab; ptr; ptr=ptr->next,j++) { 3008 3008 if (cl->sidtabok&((SIDTABBITS)1<<j)) { 3009 3009 int k; … … 3059 3059 3060 3060 //Reader-Services: 3061 if ((cfg ->cc_reshare_services==1||cfg->cc_reshare_services==2) && cfg->sidtab && rdr->sidtabok) {3061 if ((cfg.cc_reshare_services==1||cfg.cc_reshare_services==2) && cfg.sidtab && rdr->sidtabok) { 3062 3062 struct s_sidtab *ptr; 3063 for (j=0,ptr=cfg ->sidtab; ptr; ptr=ptr->next,j++) {3063 for (j=0,ptr=cfg.sidtab; ptr; ptr=ptr->next,j++) { 3064 3064 if (rdr->sidtabok&((SIDTABBITS)1<<j)) { 3065 3065 int k; … … 3192 3192 } 3193 3193 3194 if (rdr->typ == R_CCCAM && cfg ->cc_reshare_services<2 && rdr->card_status != CARD_FAILURE) {3194 if (rdr->typ == R_CCCAM && cfg.cc_reshare_services<2 && rdr->card_status != CARD_FAILURE) { 3195 3195 3196 3196 cs_debug_mask(D_CLIENT, "%s asking reader %s for cards...", … … 3209 3209 && chk_ctab(card->caid, &rdr->ctab)) { 3210 3210 3211 if ((cfg ->cc_ignore_reshare || card->maxdown > 0)) {3211 if ((cfg.cc_ignore_reshare || card->maxdown > 0)) { 3212 3212 int ignore = 0; 3213 3213 … … 3227 3227 if (!ignore) { //Filtered by service 3228 3228 int new_reshare = 3229 cfg ->cc_ignore_reshare ? reshare3229 cfg.cc_ignore_reshare ? reshare 3230 3230 : (card->maxdown - 1); 3231 3231 if (new_reshare > reshare) … … 3318 3318 int check_cccam_compat(struct cc_data *cc) { 3319 3319 int res = 0; 3320 if (strcmp(cfg ->cc_version, "2.2.0") == 0 || strcmp(cfg->cc_version, "2.2.1") == 0) {3320 if (strcmp(cfg.cc_version, "2.2.0") == 0 || strcmp(cfg.cc_version, "2.2.1") == 0) { 3321 3321 3322 3322 if (strcmp(cc->remote_version, "2.2.0") == 0 || strcmp(cc->remote_version, "2.2.1") == 0) { … … 3408 3408 return -2; 3409 3409 3410 account = cfg ->account;3410 account = cfg.account; 3411 3411 struct cc_crypt_block *save_block = cs_malloc(&save_block, sizeof(struct cc_crypt_block), QUITERROR); 3412 3412 memcpy(save_block, cc->block, sizeof(struct cc_crypt_block)); … … 3517 3517 if (i == -9) { 3518 3518 cmi += 10; 3519 if (cmi >= cfg ->cmaxidle) {3520 if (cfg ->cc_keep_connected || cl->account->ncd_keepalive) {3519 if (cmi >= cfg.cmaxidle) { 3520 if (cfg.cc_keep_connected || cl->account->ncd_keepalive) { 3521 3521 if (wait_for_keepalive<3 || wait_for_keepalive == 100) { 3522 3522 if (cc_cmd_send(cl, NULL, 0, MSG_KEEPALIVE) < 0) … … 3550 3550 cs_ftime(&cur_time); 3551 3551 timeout = cc->ecm_time; 3552 timeout.time += cfg ->cc_update_interval;3553 3554 int needs_card_updates = (cfg ->cc_update_interval >= 0)3552 timeout.time += cfg.cc_update_interval; 3553 3554 int needs_card_updates = (cfg.cc_update_interval >= 0) 3555 3555 && comp_timeb(&cur_time, &timeout) > 0; 3556 3556 … … 3816 3816 // loc_sa.sin_family = AF_INET; 3817 3817 //#ifdef LALL 3818 // if (cfg ->serverip[0])3819 // loc_sa.sin_addr.s_addr = inet_addr(cfg ->serverip);3818 // if (cfg.serverip[0]) 3819 // loc_sa.sin_addr.s_addr = inet_addr(cfg.serverip); 3820 3820 // else 3821 3821 //#endif … … 3832 3832 3833 3833 #ifdef SO_PRIORITY 3834 if (cfg ->netprio)3834 if (cfg.netprio) 3835 3835 setsockopt(cl->udp_fd, SOL_SOCKET, SO_PRIORITY, 3836 (void *)&cfg ->netprio, sizeof(ulong));3836 (void *)&cfg.netprio, sizeof(ulong)); 3837 3837 #endif 3838 3838 rdr->tcp_ito = 1; //60sec...This now invokes ph_idle() … … 3868 3868 cc_cli_connect(cl); //connect to remote server 3869 3869 3870 while (!reader->tcp_connected && reader->cc_keepalive && cfg ->reader_restart_seconds > 0) {3870 while (!reader->tcp_connected && reader->cc_keepalive && cfg.reader_restart_seconds > 0) { 3871 3871 3872 3872 if ((cc && cc->mode == CCCAM_MODE_SHUTDOWN)) … … 3879 3879 return res; 3880 3880 } 3881 cs_debug_mask(D_READER, "%s restarting reader in %d seconds", reader->label, cfg ->reader_restart_seconds);3882 cs_sleepms(cfg ->reader_restart_seconds*1000);3881 cs_debug_mask(D_READER, "%s restarting reader in %d seconds", reader->label, cfg.reader_restart_seconds); 3882 cs_sleepms(cfg.reader_restart_seconds*1000); 3883 3883 cs_debug_mask(D_READER, "%s restarting reader...", reader->label); 3884 3884 cc_cli_connect(cl); … … 3952 3952 ph->c_send_ecm = cc_send_ecm; 3953 3953 ph->c_send_emm = cc_send_emm; 3954 ph->s_ip = cfg ->cc_srvip;3954 ph->s_ip = cfg.cc_srvip; 3955 3955 ph->s_handler = cc_srv_init; 3956 3956 ph->send_dcw = cc_send_dcw; … … 3958 3958 ph->c_card_info = cc_card_info; 3959 3959 static PTAB ptab; //since there is always only 1 cccam server running, this is threadsafe 3960 ptab.ports[0].s_port = cfg ->cc_port;3960 ptab.ports[0].s_port = cfg.cc_port; 3961 3961 ph->ptab = &ptab; 3962 3962 ph->ptab->nports = 1;
Note:
See TracChangeset
for help on using the changeset viewer.