Changeset 1688
- Timestamp:
- 02/25/10 19:22:47 (11 years ago)
- Location:
- branches/monitor-improvement
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/monitor-improvement/oscam-config.c
r1681 r1688 1147 1147 cfg->http_hide_idle_clients = 0; 1148 1148 strcpy(cfg->http_tpl, ""); 1149 cfg->ncd_keepalive = 1; 1149 1150 #ifdef CS_ANTICASC 1150 1151 cfg->ac_enabled = 0; … … 1156 1157 strcpy(cfg->ac_logfile, "./oscam_ac.log"); 1157 1158 #endif 1158 cfg->ncd_keepalive=1;1159 1159 sprintf(token, "%s%s", cs_confdir, cs_conf); 1160 1160 if (!(fp = fopen(token, "r"))) { … … 2050 2050 static void chk_reader(char *token, char *value, struct s_reader *rdr) 2051 2051 { 2052 int i; 2053 char *ptr; 2054 /* 2055 * case sensitive first 2056 */ 2057 if (!strcmp(token, "device")) 2058 { 2059 for (i=0, ptr=strtok(value, ","); (i<3)&&(ptr); ptr=strtok(NULL, ","), i++) 2060 { 2061 trim(ptr); 2062 switch(i) 2063 { 2064 case 0: cs_strncpy(rdr->device, ptr, sizeof(rdr->device)); break; 2065 case 1: rdr->r_port=atoi(ptr); break; 2066 case 2: rdr->l_port=atoi(ptr); break; 2067 } 2068 } 2069 return; 2070 } 2071 if (!strcmp(token, "key")) 2072 { 2073 if (key_atob14(value, rdr->ncd_key)) 2074 { 2075 fprintf(stderr, "Configuration newcamd: Error in Key\n"); 2076 exit(1); 2077 } 2078 return; 2079 } 2052 int i; 2053 char *ptr; 2054 /* 2055 * case sensitive first 2056 */ 2057 if (!strcmp(token, "device")) { 2058 for (i = 0, ptr = strtok(value, ","); (i < 3) && (ptr); ptr = strtok(NULL, ","), i++) { 2059 trim(ptr); 2060 switch(i) { 2061 case 0: 2062 cs_strncpy(rdr->device, ptr, sizeof(rdr->device)); 2063 break; 2064 2065 case 1: 2066 rdr->r_port = atoi(ptr); 2067 break; 2068 2069 case 2: 2070 rdr->l_port = atoi(ptr); 2071 break; 2072 } 2073 } 2074 return; 2075 } 2076 2077 if (!strcmp(token, "key")) { 2078 if (key_atob14(value, rdr->ncd_key)) { 2079 fprintf(stderr, "Configuration newcamd: Error in Key\n"); 2080 exit(1); 2081 } 2082 return; 2083 } 2084 2080 2085 #ifdef CS_WITH_GBOX 2081 if (!strcmp(token, "password")) { cs_strncpy((char *)rdr->gbox_pwd, (const char *)i2b(4, a2i(value, 4)), 4); return; } 2082 if (!strcmp(token, "premium")) { rdr->gbox_prem=1; return; } 2083 #endif 2084 if (!strcmp(token, "account")) 2085 { 2086 for (i=0, ptr=strtok(value, ","); (i<2)&&(ptr); ptr=strtok(NULL, ","), i++) 2087 { 2088 trim(ptr); 2089 switch(i) 2090 { 2091 case 0: cs_strncpy(rdr->r_usr, ptr, sizeof(rdr->r_usr)); break; 2092 case 1: cs_strncpy(rdr->r_pwd, ptr, sizeof(rdr->r_pwd)); break; 2093 } 2094 } 2095 return; 2096 } 2097 if( !strcmp(token, "pincode")) { strncpy(rdr->pincode, value, sizeof(rdr->pincode)-1); return; } 2098 if (!strcmp(token, "readnano") && value[0]) { asprintf(&(rdr->emmfile), "%s", value); return; } 2099 /* 2100 * case insensitive 2101 */ 2102 strtolower(value); 2103 2104 if (!strcmp(token, "enable")) { rdr->enable=atoi(value) ? 1 : 0; return; } 2105 if (!strcmp(token, "services")) { chk_services(value, &rdr->sidtabok, &rdr->sidtabno); return; } 2106 if (!strcmp(token, "inactivitytimeout")) { rdr->tcp_ito = atoi(value); return; } 2107 if (!strcmp(token, "reconnecttimeout")) { rdr->tcp_rto = atoi(value); return; } 2108 if (!strcmp(token, "disableserverfilter")) { rdr->ncd_disable_server_filt = atoi(value); return; } 2109 //FIXME workaround for Smargo until native mode works 2110 if (!strcmp(token, "smargopatch")) { rdr->smargopatch = atoi(value); return; } 2111 if (!strcmp(token, "label")) { cs_strncpy(rdr->label, value, sizeof(rdr->label)); return; } 2112 if (!strcmp(token, "fallback")) { rdr->fallback=atoi(value) ? 1 : 0; return; } 2113 if (!strcmp(token, "logport")) { rdr->log_port=atoi(value); return; } 2114 if (!strcmp(token, "caid")) { chk_caidtab(value, &rdr->ctab); return; } 2115 if (!strcmp(token, "boxid")) { rdr->boxid=a2i(value,4); return; } 2116 if (!strcmp(token, "aeskey")) 2117 { 2118 if (key_atob(value, rdr->aes_key)) 2119 { 2120 fprintf(stderr, "Configuration reader: Error in AES Key\n"); 2121 exit(1); 2122 } 2123 return; 2124 } 2125 if ((!strcmp(token, "n3_rsakey")) || (!strcmp(token, "rsakey")) ) 2126 { 2127 rdr->has_rsa=1; 2128 if (key_atob_l(value, rdr->rsa_mod, 128)) 2129 { 2130 fprintf(stderr, "Configuration reader: Error in rsakey\n"); 2131 exit(1); 2132 } 2133 return; 2134 } 2135 if (!strcmp(token, "tiger_rsakey")) 2136 { 2137 if (key_atob_l(value, rdr->rsa_mod, 240)) 2138 { 2139 fprintf(stderr, "Configuration reader: Error in tiger_rsakey\n"); 2140 exit(1); 2141 } 2142 return; 2143 } 2144 if ((!strcmp(token, "n3_boxkey")) || (!strcmp(token, "boxkey"))) 2145 { 2146 if (key_atob_l(value, rdr->nagra_boxkey, 16)) 2147 { 2148 fprintf(stderr, "Configuration reader: Error in boxkey\n"); 2149 exit(1); 2150 } 2151 return; 2152 } 2153 if (!strcmp(token, "detect")) 2154 { 2155 for (i=0; RDR_CD_TXT[i]; i++) 2156 { 2157 if (!strcmp(value, RDR_CD_TXT[i])) 2158 rdr->detect=i; 2159 else 2160 if ((value[0]=='!') && (!strcmp(value+1, RDR_CD_TXT[i]))) 2161 rdr->detect=i|0x80; 2162 } 2163 return; 2164 } 2165 if (!strcmp(token, "mhz")) { rdr->mhz=atoi(value); return; } 2166 if (!strcmp(token, "cardmhz")) { rdr->cardmhz=atoi(value); return; } 2167 if (!strcmp(token, "protocol")) 2168 { 2169 if (!strcmp(value, "mouse")) { rdr->typ=R_MOUSE; return; } 2170 if (!strcmp(value, "smartreader")) { rdr->typ=R_SMART; return; } 2171 if (!strcmp(value, "internal")) { rdr->typ=R_INTERNAL; return; } 2086 if (!strcmp(token, "password")) { 2087 cs_strncpy((char *)rdr->gbox_pwd, (const char *)i2b(4, a2i(value, 4)), 4); 2088 return; 2089 } 2090 2091 if (!strcmp(token, "premium")) { 2092 rdr->gbox_prem = 1; 2093 return; 2094 } 2095 #endif 2096 if (!strcmp(token, "account")) { 2097 for (i = 0, ptr = strtok(value, ","); (i < 2) && (ptr); ptr = strtok(NULL, ","), i++) { 2098 trim(ptr); 2099 switch(i) { 2100 case 0: 2101 cs_strncpy(rdr->r_usr, ptr, sizeof(rdr->r_usr)); 2102 break; 2103 2104 case 1: 2105 cs_strncpy(rdr->r_pwd, ptr, sizeof(rdr->r_pwd)); 2106 break; 2107 } 2108 } 2109 return; 2110 } 2111 2112 if (!strcmp(token, "pincode")) { 2113 strncpy(rdr->pincode, value, sizeof(rdr->pincode) - 1); 2114 return; 2115 } 2116 2117 if (!strcmp(token, "readnano") && value[0]) { 2118 asprintf(&(rdr->emmfile), "%s", value); 2119 return; 2120 } 2121 2122 /* 2123 * case insensitive 2124 */ 2125 strtolower(value); 2126 2127 if (!strcmp(token, "enable")) { 2128 rdr->enable = atoi(value) ? 1 : 0; 2129 return; 2130 } 2131 2132 if (!strcmp(token, "services")) { 2133 chk_services(value, &rdr->sidtabok, &rdr->sidtabno); 2134 return; 2135 } 2136 2137 if (!strcmp(token, "inactivitytimeout")) { 2138 rdr->tcp_ito = atoi(value); 2139 return; 2140 } 2141 2142 if (!strcmp(token, "reconnecttimeout")) { 2143 rdr->tcp_rto = atoi(value); 2144 return; 2145 } 2146 2147 if (!strcmp(token, "disableserverfilter")) { 2148 rdr->ncd_disable_server_filt = atoi(value); 2149 return; 2150 } 2151 2152 //FIXME workaround for Smargo until native mode works 2153 if (!strcmp(token, "smargopatch")) { 2154 rdr->smargopatch = atoi(value); 2155 return; 2156 } 2157 2158 if (!strcmp(token, "label")) { 2159 cs_strncpy(rdr->label, value, sizeof(rdr->label)); 2160 return; 2161 } 2162 2163 if (!strcmp(token, "fallback")) { 2164 rdr->fallback = atoi(value) ? 1 : 0; 2165 return; 2166 } 2167 2168 if (!strcmp(token, "logport")) { 2169 rdr->log_port = atoi(value); 2170 return; 2171 } 2172 2173 if (!strcmp(token, "caid")) { 2174 chk_caidtab(value, &rdr->ctab); 2175 return; 2176 } 2177 2178 if (!strcmp(token, "boxid")) { 2179 rdr->boxid = a2i(value, 4); 2180 return; 2181 } 2182 2183 if (!strcmp(token, "aeskey")) { 2184 if (key_atob(value, rdr->aes_key)) { 2185 fprintf(stderr, "Configuration reader: Error in AES Key\n"); 2186 exit(1); 2187 } 2188 return; 2189 } 2190 2191 if ((!strcmp(token, "n3_rsakey")) || (!strcmp(token, "rsakey"))) { 2192 rdr->has_rsa = 1; 2193 if (key_atob_l(value, rdr->rsa_mod, 128)) { 2194 fprintf(stderr, "Configuration reader: Error in rsakey\n"); 2195 exit(1); 2196 } 2197 return; 2198 } 2199 2200 if (!strcmp(token, "tiger_rsakey")) { 2201 if (key_atob_l(value, rdr->rsa_mod, 240)) { 2202 fprintf(stderr, "Configuration reader: Error in tiger_rsakey\n"); 2203 exit(1); 2204 } 2205 return; 2206 } 2207 2208 if ((!strcmp(token, "n3_boxkey")) || (!strcmp(token, "boxkey"))) { 2209 if (key_atob_l(value, rdr->nagra_boxkey, 16)) { 2210 fprintf(stderr, "Configuration reader: Error in boxkey\n"); 2211 exit(1); 2212 } 2213 return; 2214 } 2215 2216 if (!strcmp(token, "detect")) { 2217 for (i = 0; RDR_CD_TXT[i]; i++) { 2218 if (!strcmp(value, RDR_CD_TXT[i])) { 2219 rdr->detect = i; 2220 } 2221 else { 2222 if ((value[0] == '!') && (!strcmp(value+1, RDR_CD_TXT[i]))) 2223 rdr->detect = i|0x80; 2224 } 2225 } 2226 return; 2227 } 2228 2229 if (!strcmp(token, "mhz")) { 2230 rdr->mhz = atoi(value); 2231 return; 2232 } 2233 2234 if (!strcmp(token, "cardmhz")) { 2235 rdr->cardmhz = atoi(value); 2236 return; 2237 } 2238 2239 if (!strcmp(token, "protocol")) { 2240 2241 if (!strcmp(value, "mouse")) { 2242 rdr->typ = R_MOUSE; 2243 return; 2244 } 2245 2246 if (!strcmp(value, "smartreader")) { 2247 rdr->typ = R_SMART; 2248 return; 2249 } 2250 2251 if (!strcmp(value, "internal")) { 2252 rdr->typ = R_INTERNAL; 2253 return; 2254 } 2255 2172 2256 #ifdef HAVE_PCSC 2173 if (!strcmp(value, "pcsc")) { rdr->typ=R_PCSC; return; } 2174 #endif 2175 if (!strcmp(value, "serial")) { rdr->typ=R_SERIAL; return; } 2176 if (!strcmp(value, "camd35")) { rdr->typ=R_CAMD35; return; } 2177 if (!strcmp(value, "cs378x")) { rdr->typ=R_CS378X; return; } 2178 if (!strcmp(value, "cs357x")) { rdr->typ=R_CAMD35; return; } 2179 if (!strcmp(value, "gbox")) { rdr->typ=R_GBOX; return; } 2180 if (!strcmp(value, "cccam")) { 2181 rdr->typ=R_CCCAM; 2182 // strcpy(value, "1"); 2183 // chk_caidtab(value, &rdr->ctab); // this is a MAJOR hack for auto multiple caid support (not currently working due to ncd table issue) 2184 return; 2185 } 2186 if (!strcmp(value, "radegast")) { rdr->typ=R_RADEGAST; return; } 2187 if (!strcmp(value, "newcamd") || 2188 !strcmp(value, "newcamd525")) {rdr->typ=R_NEWCAMD; 2189 rdr->ncd_proto=NCD_525; return; } 2190 if (!strcmp(value, "newcamd524")) {rdr->typ=R_NEWCAMD; 2191 rdr->ncd_proto=NCD_524; return; } 2192 fprintf(stderr, "WARNING: value '%s' in protocol-line not recognized, assuming MOUSE\n",value); 2193 rdr->typ=R_MOUSE; 2194 return; 2195 } 2196 if (!strcmp(token, "loadbalanced")) { rdr->loadbalanced=atoi(value); return; } 2197 if (!strcmp(token, "ident")) { chk_ftab(value, &rdr->ftab,"reader",rdr->label,"provid"); return; } 2198 if (!strcmp(token, "class")) { chk_cltab(value, &rdr->cltab); return; } 2199 if (!strcmp(token, "chid")) { chk_ftab(value, &rdr->fchid,"reader",rdr->label,"chid"); return; } 2200 if (!strcmp(token, "showcls")) { rdr->show_cls = atoi(value); return; } 2201 if (!strcmp(token, "maxqlen")) 2202 { 2203 rdr->maxqlen = atoi(value); 2204 if( rdr->maxqlen<0 || rdr->maxqlen>CS_MAXQLEN ) 2205 rdr->maxqlen=CS_MAXQLEN; 2206 return; 2207 } 2208 if (!strcmp(token, "group")) 2209 { 2210 for (ptr=strtok(value, ","); ptr; ptr=strtok(NULL, ",")) 2211 { 2212 int g; 2213 g=atoi(ptr); 2214 if ((g>0) && (g<33)) rdr->grp|=(1<<(g-1)); 2215 } 2216 return; 2217 } 2218 if (!strcmp(token, "emmcache")) 2219 { 2220 for (i=0, ptr=strtok(value, ","); (i<3)&&(ptr); ptr=strtok(NULL, ","), i++) 2221 switch(i) 2222 { 2223 case 0: rdr->cachemm=atoi(ptr); break; 2224 case 1: rdr->rewritemm=atoi(ptr); break; 2225 case 2: rdr->logemm=atoi(ptr); break; 2226 } 2227 if (rdr->rewritemm <=0) { 2228 fprintf(stderr, "Notice: Setting EMMCACHE to %i,1,%i instead of %i,%i,%i. Zero or negative number of rewrites is silly\n", rdr->cachemm,rdr->logemm,rdr->cachemm,rdr->rewritemm,rdr->logemm); 2229 rdr->rewritemm = 1; 2230 } 2231 return; 2232 } 2233 2234 if (!strcmp(token, "blocknano")) 2235 { 2236 if (!strcmp(value,"all")) //wildcard is used 2237 for (i=0 ; i<256; i++) 2238 rdr->b_nano[i] |= 0x01; //set all lsb's to block all nanos 2239 else 2240 for (ptr=strtok(value, ","); ptr; ptr=strtok(NULL, ",")) 2241 if ((i=byte_atob(ptr))>=0) 2242 rdr->b_nano[i]|= 0x01; //lsb is set when to block nano 2243 return; 2244 } 2245 if (!strcmp(token, "savenano")) 2246 { 2247 if (!strcmp(value,"all")) //wildcard is used 2248 for (i=0 ; i<256; i++) 2249 rdr->b_nano[i] |= 0x02; //set all lsb+1 to save all nanos to file 2250 else 2251 for (ptr=strtok(value, ","); ptr; ptr=strtok(NULL, ",")) 2252 if ((i=byte_atob(ptr))>=0) 2253 rdr->b_nano[i]|= 0x02; //lsb+1 is set when to save nano to file 2254 return; 2255 } 2256 if (!strcmp(token, "cccversion")) { // cccam version 2257 if (strlen(value)>sizeof(rdr->cc_version)-1) { 2258 fprintf(stderr, "cccam config: version too long\n"); 2259 exit(1); 2260 } 2261 memset(rdr->cc_version, 0, sizeof(rdr->cc_version)); 2262 cs_strncpy(rdr->cc_version, value, sizeof(rdr->cc_version)); 2263 return; 2264 } 2265 if (!strcmp(token, "cccbuild")) { // cccam build number 2266 if (strlen(value)>sizeof(rdr->cc_build)-1) { 2267 fprintf(stderr, "cccam config build number too long\n"); 2268 exit(1); 2269 } 2270 memset(rdr->cc_build, 0, sizeof(rdr->cc_build)); 2271 cs_strncpy(rdr->cc_build, value, sizeof(rdr->cc_build)); 2272 return; 2273 } 2274 if (!strcmp(token, "cccmaxhop")) { // cccam max card distance 2275 rdr->cc_maxhop = atoi(value); 2276 return; 2277 } 2278 if (!strcmp(token, "deprecated")) { rdr->deprecated=atoi(value); return; } 2279 if (token[0] != '#') 2280 cs_log( "Warning: keyword '%s' in reader section not recognized",token); 2257 if (!strcmp(value, "pcsc")) { 2258 rdr->typ = R_PCSC; 2259 return; 2260 } 2261 #endif 2262 2263 if (!strcmp(value, "serial")) { 2264 rdr->typ = R_SERIAL; 2265 return; 2266 } 2267 2268 if (!strcmp(value, "camd35")) { 2269 rdr->typ = R_CAMD35; 2270 return; 2271 } 2272 2273 if (!strcmp(value, "cs378x")) { 2274 rdr->typ = R_CS378X; 2275 return; 2276 } 2277 2278 if (!strcmp(value, "cs357x")) { 2279 rdr->typ = R_CAMD35; 2280 return; 2281 } 2282 2283 #ifdef CS_WITH_GBOX 2284 if (!strcmp(value, "gbox")) { 2285 rdr->typ = R_GBOX; 2286 return; 2287 } 2288 #endif 2289 2290 if (!strcmp(value, "cccam")) { 2291 rdr->typ = R_CCCAM; 2292 //strcpy(value, "1"); 2293 //chk_caidtab(value, &rdr->ctab); 2294 //this is a MAJOR hack for auto multiple caid support (not currently working due to ncd table issue) 2295 return; 2296 } 2297 2298 if (!strcmp(value, "radegast")) { 2299 rdr->typ = R_RADEGAST; 2300 return; 2301 } 2302 2303 if (!strcmp(value, "newcamd") || !strcmp(value, "newcamd525")) { 2304 rdr->typ = R_NEWCAMD; 2305 rdr->ncd_proto = NCD_525; 2306 return; 2307 } 2308 2309 if (!strcmp(value, "newcamd524")) { 2310 rdr->typ = R_NEWCAMD; 2311 rdr->ncd_proto = NCD_524; 2312 return; 2313 } 2314 2315 fprintf(stderr, "WARNING: value '%s' in protocol-line not recognized, assuming MOUSE\n",value); 2316 rdr->typ = R_MOUSE; 2317 return; 2318 } 2319 2320 if (!strcmp(token, "loadbalanced")) { 2321 rdr->loadbalanced = atoi(value); 2322 return; 2323 } 2324 2325 if (!strcmp(token, "ident")) { 2326 chk_ftab(value, &rdr->ftab,"reader",rdr->label,"provid"); 2327 return; 2328 } 2329 2330 if (!strcmp(token, "class")) { 2331 chk_cltab(value, &rdr->cltab); 2332 return; 2333 } 2334 2335 if (!strcmp(token, "chid")) { 2336 chk_ftab(value, &rdr->fchid,"reader",rdr->label,"chid"); 2337 return; 2338 } 2339 2340 if (!strcmp(token, "showcls")) { 2341 rdr->show_cls = atoi(value); 2342 return; 2343 } 2344 2345 if (!strcmp(token, "maxqlen")) { 2346 rdr->maxqlen = atoi(value); 2347 if( rdr->maxqlen < 0 || rdr->maxqlen > CS_MAXQLEN) { 2348 rdr->maxqlen = CS_MAXQLEN; 2349 } 2350 return; 2351 } 2352 2353 if (!strcmp(token, "group")) 2354 { 2355 for (ptr = strtok(value, ","); ptr; ptr = strtok(NULL, ",")) { 2356 int g; 2357 g = atoi(ptr); 2358 if ((g>0) && (g<33)) { 2359 rdr->grp |= (1<<(g-1)); 2360 } 2361 } 2362 return; 2363 } 2364 2365 if (!strcmp(token, "emmcache")) { 2366 for (i = 0, ptr = strtok(value, ","); (i < 3) && (ptr); ptr = strtok(NULL, ","), i++) { 2367 switch(i) 2368 { 2369 case 0: 2370 rdr->cachemm = atoi(ptr); 2371 break; 2372 2373 case 1: 2374 rdr->rewritemm = atoi(ptr); 2375 break; 2376 2377 case 2: rdr->logemm = atoi(ptr); 2378 break; 2379 } 2380 } 2381 2382 if (rdr->rewritemm <= 0) { 2383 fprintf(stderr, "Notice: Setting EMMCACHE to %i,1,%i instead of %i,%i,%i. ", 2384 rdr->cachemm, rdr->logemm, 2385 rdr->cachemm, rdr->rewritemm, 2386 rdr->logemm); 2387 2388 fprintf(stderr, "Zero or negative number of rewrites is silly\n"); 2389 rdr->rewritemm = 1; 2390 } 2391 return; 2392 } 2393 2394 if (!strcmp(token, "blocknano")) { 2395 //wildcard is used 2396 if (!strcmp(value,"all")) { 2397 for (i = 0 ; i < 256; i++) { 2398 rdr->b_nano[i] |= 0x01; //set all lsb's to block all nanos 2399 } 2400 } 2401 else { 2402 for (ptr = strtok(value, ","); ptr; ptr = strtok(NULL, ",")) { 2403 if ((i = byte_atob(ptr)) >= 0) { 2404 rdr->b_nano[i] |= 0x01; //lsb is set when to block nano 2405 } 2406 } 2407 } 2408 return; 2409 } 2410 2411 if (!strcmp(token, "savenano")) { 2412 //wildcard is used 2413 if (!strcmp(value,"all")) { 2414 for (i = 0 ; i < 256; i++) { 2415 rdr->b_nano[i] |= 0x02; //set all lsb+1 to save all nanos to file 2416 } 2417 } 2418 else { 2419 for (ptr = strtok(value, ","); ptr; ptr = strtok(NULL, ",")) { 2420 if ((i = byte_atob(ptr)) >= 0) { 2421 rdr->b_nano[i] |= 0x02; //lsb+1 is set when to save nano to file 2422 } 2423 } 2424 } 2425 return; 2426 } 2427 2428 if (!strcmp(token, "cccversion")) { 2429 // cccam version 2430 if (strlen(value) > sizeof(rdr->cc_version) - 1) { 2431 fprintf(stderr, "cccam config: version too long\n"); 2432 exit(1); 2433 } 2434 memset(rdr->cc_version, 0, sizeof(rdr->cc_version)); 2435 cs_strncpy(rdr->cc_version, value, sizeof(rdr->cc_version)); 2436 return; 2437 } 2438 2439 if (!strcmp(token, "cccbuild")) { 2440 // cccam build number 2441 if (strlen(value) > sizeof(rdr->cc_build) - 1) { 2442 fprintf(stderr, "cccam config build number too long\n"); 2443 exit(1); 2444 } 2445 2446 memset(rdr->cc_build, 0, sizeof(rdr->cc_build)); 2447 cs_strncpy(rdr->cc_build, value, sizeof(rdr->cc_build)); 2448 return; 2449 } 2450 2451 if (!strcmp(token, "cccmaxhop")) { 2452 // cccam max card distance 2453 rdr->cc_maxhop = atoi(value); 2454 return; 2455 } 2456 2457 if (!strcmp(token, "deprecated")) { 2458 rdr->deprecated = atoi(value); 2459 return; 2460 } 2461 2462 if (token[0] != '#') 2463 cs_log("Warning: keyword '%s' in reader section not recognized",token); 2281 2464 } 2282 2465 -
branches/monitor-improvement/oscam-reader.c
r1587 r1688 483 483 fd_set fds; 484 484 struct timeval tv; 485 486 if(reader[ridx].typ==R_GBOX){ 485 486 #ifdef CS_WITH_GBOX 487 if(reader[ridx].typ==R_GBOX) { 487 488 struct timeb tpe; 488 int x;489 ulong ms;490 cs_ftime(&tpe);491 for(x=0;x<CS_MAXPENDING;x++){492 ms=1000*(tpe.time-ecmtask[x].tps.time)+tpe.millitm-ecmtask[x].tps.millitm;493 if(ecmtask[x].rc == 10 && ms > cfg->ctimeout && ridx == ecmtask[x].gbxRidx){494 //cs_log("hello rc=%d idx:%d x:%d ridx%d ridx:%d",ecmtask[x].rc,ecmtask[x].idx,x,ridx,ecmtask[x].gbxRidx);495 ecmtask[x].rc=5;496 send_dcw(&ecmtask[x]);497 498 } 499 } 500 } 489 int x; 490 ulong ms; 491 cs_ftime(&tpe); 492 for(x=0;x<CS_MAXPENDING;x++){ 493 ms=1000*(tpe.time-ecmtask[x].tps.time)+tpe.millitm-ecmtask[x].tps.millitm; 494 if(ecmtask[x].rc == 10 && ms > cfg->ctimeout && ridx == ecmtask[x].gbxRidx) { 495 //cs_log("hello rc=%d idx:%d x:%d ridx%d ridx:%d",ecmtask[x].rc,ecmtask[x].idx,x,ridx,ecmtask[x].gbxRidx); 496 ecmtask[x].rc=5; 497 send_dcw(&ecmtask[x]); 498 } 499 } 500 } 501 #endif 501 502 502 503 if (master_pid!=getppid()) cs_exit(0); -
branches/monitor-improvement/oscam.c
r1648 r1688 1594 1594 if (er->rc==0) 1595 1595 { 1596 #ifdef CS_WITH_GBOX 1596 1597 if(reader[er->reader[0]].typ==R_GBOX) 1597 1598 snprintf(sby, sizeof(sby)-1, " by %s(%04X)", reader[er->reader[0]].label,er->gbxCWFrom); 1598 1599 else 1600 #endif 1599 1601 snprintf(sby, sizeof(sby)-1, " by %s", reader[er->reader[0]].label); 1600 1602 }
Note:
See TracChangeset
for help on using the changeset viewer.