Changeset 4556 for trunk/module-cccam.c
- Timestamp:
- 01/21/11 18:08:35 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/module-cccam.c
r4551 r4556 1694 1694 #define READ_CARD_TIMEOUT 100 1695 1695 1696 int write_card(struct cc_data *cc, uint8 *buf, struct cc_card *card, int add_own, int ext ) {1696 int write_card(struct cc_data *cc, uint8 *buf, struct cc_card *card, int add_own, int ext, int au_allowed) { 1697 1697 memset(buf, 0, CC_MAXMSGSIZE); 1698 1698 buf[0] = card->id >> 24; … … 1708 1708 buf[10] = card->hop; 1709 1709 buf[11] = card->maxdown; 1710 memcpy(buf + 12, card->hexserial, 8); 1710 if (au_allowed) 1711 memcpy(buf + 12, card->hexserial, 8); 1711 1712 1712 1713 //with cccam 2.2.0 we have assigned and rejected sids: … … 2826 2827 * Adds a new card to a cardlist. 2827 2828 */ 2828 int add_card_to_serverlist(struct s_reader *rdr, struct s_client *cl, LLIST *cardlist, struct cc_card *card, int reshare ) {2829 int add_card_to_serverlist(struct s_reader *rdr, struct s_client *cl, LLIST *cardlist, struct cc_card *card, int reshare, int au_allowed) { 2829 2830 2830 2831 if (!chk_ident(&cl->ftab, card)) … … 2862 2863 if (!card2) { 2863 2864 card2 = create_card(card); 2865 if (!au_allowed) 2866 memset(card2->hexserial, 0, 8); 2864 2867 card2->hop = 0; 2865 2868 card2->remote_id = card->remote_id; … … 2895 2898 if (!card2) { 2896 2899 card2 = create_card(card); 2900 if (!au_allowed) 2901 memset(card2->hexserial, 0, 8); 2897 2902 card2->hop = card->hop; 2898 2903 card2->remote_id = card->remote_id; … … 2921 2926 if (!card2) { 2922 2927 card2 = create_card(card); 2928 if (!au_allowed) 2929 memset(card2->hexserial, 0, 8); 2923 2930 card2->hop = card->hop; 2924 2931 card2->remote_id = card->remote_id; … … 2954 2961 } 2955 2962 2956 int report_card(struct s_client *cl, struct cc_card *card, LLIST *new_reported_carddatas )2963 int report_card(struct s_client *cl, struct cc_card *card, LLIST *new_reported_carddatas, int au_allowed) 2957 2964 { 2958 2965 int res = 0; … … 2966 2973 cc->report_carddata_id++; 2967 2974 2968 int len = write_card(cc, buf, card, TRUE, ext );2975 int len = write_card(cc, buf, card, TRUE, ext, au_allowed); 2969 2976 res = cc_cmd_send(cl, buf, len, ext?MSG_NEW_CARD_SIDINFO:MSG_NEW_CARD); 2970 2977 cc->card_added_count++; … … 2973 2980 cc_add_reported_carddata(new_reported_carddatas, card); 2974 2981 return res; 2982 } 2983 2984 void add_good_bad_sids(struct s_sidtab *ptr, struct s_client *cl, struct cc_card *card) { 2985 struct cc_data *cc = cl->cc; 2986 if (cc->cccam220) { 2987 //good sids: 2988 int l; 2989 for (l=0;l<ptr->num_srvid;l++) { 2990 struct cc_srvid *srvid = malloc(sizeof(struct cc_srvid)); 2991 srvid->sid = ptr->srvid[l]; 2992 srvid->ecmlen = 0; //0=undefined, also not used with "O" CCcam 2993 ll_append(card->goodsids, srvid); 2994 } 2995 2996 //bad sids: 2997 if (cl->sidtabno) { 2998 struct s_sidtab *ptr_no; 2999 int n; 3000 for (n=0,ptr_no=cfg->sidtab; ptr_no; ptr_no=ptr_no->next,n++) { 3001 if (cl->sidtabno&((SIDTABBITS)1<<n)) { 3002 int m; 3003 int ok_caid = FALSE; 3004 for (m=0;m<ptr_no->num_caid;m++) { //search bad sids for this caid: 3005 if (ptr_no->caid[m] == card->caid) { 3006 ok_caid = TRUE; 3007 break; 3008 } 3009 } 3010 if (ok_caid) { 3011 for (l=0;l<ptr_no->num_srvid;l++) { 3012 struct cc_srvid *srvid = malloc(sizeof(struct cc_srvid)); 3013 srvid->sid = ptr_no->srvid[l]; 3014 srvid->ecmlen = 0; //0=undefined, also not used with "O" CCcam 3015 ll_append(card->badsids, srvid); 3016 } 3017 } 3018 } 3019 } 3020 } 3021 } 3022 } 3023 3024 void add_good_bad_sids_for_card(struct s_client *cl, struct cc_card *card) { 3025 struct cc_data *cc = cl->cc; 3026 if (cc->cccam220) { 3027 struct s_sidtab *ptr; 3028 int j; 3029 for (j=0,ptr=cfg->sidtab; ptr; ptr=ptr->next,j++) { 3030 if (cl->sidtabok&((SIDTABBITS)1<<j)) { 3031 int m; 3032 int ok_caid = FALSE; 3033 for (m=0;m<ptr->num_caid;m++) { //search good sids for this caid: 3034 if (ptr->caid[m] == card->caid) { 3035 ok_caid = TRUE; 3036 break; 3037 } 3038 } 3039 if (ok_caid) { 3040 add_good_bad_sids(ptr, cl, card); 3041 } 3042 } 3043 } 3044 } 2975 3045 } 2976 3046 … … 3022 3092 ll_append(card->providers, prov); 3023 3093 } 3024 add_card_to_serverlist(NULL, cl, server_cards, card, usr_reshare); 3094 3095 //CCcam 2.2.x proto can transfer good and bad sids: 3096 add_good_bad_sids(ptr, cl, card); 3097 3098 add_card_to_serverlist(NULL, cl, server_cards, card, usr_reshare, isau); 3025 3099 } 3026 3100 flt=1; … … 3074 3148 ll_append(card->providers, prov); 3075 3149 } 3076 add_card_to_serverlist(rdr, cl, server_cards, card, reshare); 3150 3151 //CCcam 2.2.x proto can transfer good and bad sids: 3152 add_good_bad_sids(ptr, cl, card); 3153 3154 add_card_to_serverlist(rdr, cl, server_cards, card, reshare, au_allowed); 3077 3155 } 3078 3156 flt=1; … … 3110 3188 } 3111 3189 } 3190 3112 3191 ll_append(card->providers, prov); 3113 3192 } … … 3124 3203 } 3125 3204 3126 if (!ignore) add_card_to_serverlist(rdr, cl, server_cards, card, reshare); 3205 if (!ignore) { 3206 //CCcam 2.2.x proto can transfer good and bad sids: 3207 add_good_bad_sids_for_card(cl, card); 3208 3209 add_card_to_serverlist(rdr, cl, server_cards, card, reshare, au_allowed); 3210 } 3127 3211 else cc_free_card(card); 3128 3212 flt = 1; … … 3143 3227 if (au_allowed) 3144 3228 cc_UA_oscam2cccam(rdr->hexserial, card->hexserial, lcaid); 3145 3146 add_card_to_serverlist(rdr, cl, server_cards, card, reshare); 3229 3230 //CCcam 2.2.x proto can transfer good and bad sids: 3231 add_good_bad_sids_for_card(cl, card); 3232 3233 add_card_to_serverlist(rdr, cl, server_cards, card, reshare, au_allowed); 3147 3234 flt = 1; 3148 3235 } … … 3170 3257 } 3171 3258 if (rdr->tcp_connected || rdr->card_status == CARD_INSERTED) { 3172 add_card_to_serverlist(rdr, cl, server_cards, card, reshare); 3259 3260 //CCcam 2.2.x proto can transfer good and bad sids: 3261 add_good_bad_sids_for_card(cl, card); 3262 3263 add_card_to_serverlist(rdr, cl, server_cards, card, reshare, au_allowed); 3173 3264 } 3174 3265 else … … 3216 3307 new_reshare = reshare; 3217 3308 add_card_to_serverlist(rdr, cl, server_cards, card, 3218 new_reshare );3309 new_reshare, au_allowed); 3219 3310 count++; 3220 3311 } … … 3240 3331 //cs_debug_mask(D_TRACE, "%s card %d caid %04X hop %d", getprefix(), card->id, card->caid, card->hop); 3241 3332 3242 ok = report_card(cl, card, new_reported_carddatas ) >= 0;3333 ok = report_card(cl, card, new_reported_carddatas, isau) >= 0; 3243 3334 ll_iter_remove(it); 3244 3335 }
Note:
See TracChangeset
for help on using the changeset viewer.