Changeset 1142
- Timestamp:
- 01/09/10 15:16:32 (14 years ago)
- Location:
- branches/monitor-improvement
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/monitor-improvement/oscam-config.c
r1141 r1142 1002 1002 fprintf_conf(f, CONFVARWIDTH, "serverip", "%s\n", inet_ntoa(*(struct in_addr *)&cfg->c33_srvip)); 1003 1003 fprintf_conf(f, CONFVARWIDTH, "passive", "%d\n", cfg->c33_passive); 1004 unsigned int ui; 1005 fprintf_conf(f, CONFVARWIDTH, "key", ""); for (ui = 0; ui < sizeof(cfg->c33_key); ++ui) fprintf(f,"%02X", cfg->c33_key[ui]); fputc((int)'\n', f); 1004 fprintf_conf(f, CONFVARWIDTH, "key", ""); for (i = 0; i < (int) sizeof(cfg->c33_key); ++i) fprintf(f,"%02X", cfg->c33_key[i]); fputc((int)'\n', f); 1006 1005 fprintf_conf(f, CONFVARWIDTH, "nocrypt", ""); 1007 1006 dot=""; -
branches/monitor-improvement/oscam-http.c
r1141 r1142 10 10 #include <sys/socket.h> 11 11 12 void refresh_oscam(enum refreshtypes refreshtype ){12 void refresh_oscam(enum refreshtypes refreshtype, struct in_addr in){ 13 13 int i; 14 14 switch (refreshtype){ 15 15 case REFR_ACCOUNTS: 16 cs_log("Refresh Accounts requested by WebIF ");16 cs_log("Refresh Accounts requested by WebIF from %s", inet_ntoa(*(struct in_addr *)&in)); 17 17 init_userdb(); 18 18 cs_reinit_clients(); … … 32 32 33 33 case REFR_SERVER: 34 cs_log("Refresh Server requested by WebIF ");34 cs_log("Refresh Server requested by WebIF from %s", inet_ntoa(*(struct in_addr *)&in)); 35 35 //kill(client[0].pid, SIGHUP); 36 36 //todo how I can refresh the server after global settings … … 38 38 39 39 case REFR_SERVICES: 40 cs_log("Refresh Services requested by WebIF ");40 cs_log("Refresh Services requested by WebIF from %s", inet_ntoa(*(struct in_addr *)&in)); 41 41 init_sidtab(); 42 42 break; … … 44 44 #ifdef CS_ANTICASC 45 45 case REFR_ANTICASC: 46 cs_log("Refresh Anticascading requested by WebIF ");46 cs_log("Refresh Anticascading requested by WebIF from %s", inet_ntoa(*(struct in_addr *)&in)); 47 47 for (i=0; i<CS_MAXPID; i++) 48 48 if (client[i].typ=='a') { … … 55 55 } 56 56 57 void send_oscam_config_global(struct templatevars *vars, FILE *f, struct uriparams *params ) {57 void send_oscam_config_global(struct templatevars *vars, FILE *f, struct uriparams *params, struct in_addr in) { 58 58 int i; 59 59 … … 67 67 } 68 68 tpl_addVar(vars, 1, "MESSAGE", "<BR><BR><B>Configuration Global *DONE*</B><BR><BR>"); 69 /*if(write_config()==0) */refresh_oscam(REFR_SERVER );69 /*if(write_config()==0) */refresh_oscam(REFR_SERVER, in); 70 70 } 71 71 tpl_addVar(vars, 0, "SERVERIP", inet_ntoa(*(struct in_addr *)&cfg->srvip)); … … 93 93 } 94 94 95 void send_oscam_config_camd33(struct templatevars *vars, FILE *f, struct uriparams *params ) {95 void send_oscam_config_camd33(struct templatevars *vars, FILE *f, struct uriparams *params, struct in_addr in) { 96 96 int i; 97 97 … … 108 108 } 109 109 tpl_addVar(vars, 1, "MESSAGE", "<BR><BR><B>Configuration camd33 *DONE*</B><BR><BR>"); 110 refresh_oscam(REFR_SERVER );110 refresh_oscam(REFR_SERVER, in); 111 111 } 112 112 tpl_printf(vars, 0, "PORT", "%d", cfg->c33_port); … … 114 114 tpl_printf(vars, 0, "PASSIVE", "%d", cfg->c33_passive); 115 115 116 unsigned int ui; 117 for (ui = 0; ui < sizeof(cfg->c33_key); ++ui) tpl_printf(vars, 1, "KEY", "%02X",cfg->c33_key[ui]); 116 for (i = 0; i < (int) sizeof(cfg->c33_key); ++i) tpl_printf(vars, 1, "KEY", "%02X",cfg->c33_key[i]); 118 117 struct s_ip *cip; 119 118 char *dot=""; … … 127 126 } 128 127 129 void send_oscam_config_camd35(struct templatevars *vars, FILE *f, struct uriparams *params ) {128 void send_oscam_config_camd35(struct templatevars *vars, FILE *f, struct uriparams *params, struct in_addr in) { 130 129 int i; 131 130 if (strcmp(getParam(params, "action"),"execute") == 0){ … … 138 137 } 139 138 tpl_addVar(vars, 1, "MESSAGE", "<BR><BR><B>Configuration camd35 *DONE*</B><BR><BR>"); 140 refresh_oscam(REFR_SERVER );139 refresh_oscam(REFR_SERVER, in); 141 140 } 142 141 tpl_printf(vars, 0, "PORT", "%d", cfg->c35_port); … … 146 145 } 147 146 148 void send_oscam_config_camd35tcp(struct templatevars *vars, FILE *f, struct uriparams *params ) {147 void send_oscam_config_camd35tcp(struct templatevars *vars, FILE *f, struct uriparams *params, struct in_addr in) { 149 148 int i; 150 149 if (strcmp(getParam(params, "action"),"execute") == 0){ … … 158 157 } 159 158 tpl_addVar(vars, 1, "MESSAGE", "<BR><BR><B>Configuration camd35 TCP *DONE*</B><BR><BR>"); 160 refresh_oscam(REFR_SERVER );159 refresh_oscam(REFR_SERVER, in); 161 160 } 162 161 … … 183 182 } 184 183 185 void send_oscam_config_newcamd(struct templatevars *vars, FILE *f, struct uriparams *params ) {184 void send_oscam_config_newcamd(struct templatevars *vars, FILE *f, struct uriparams *params, struct in_addr in) { 186 185 int i; 187 186 if (strcmp(getParam(params, "action"),"execute") == 0){ … … 195 194 } 196 195 tpl_addVar(vars, 1, "MESSAGE", "<BR><BR><B>Configuration Newcamd *DONE*</B><BR><BR>"); 197 refresh_oscam(REFR_SERVER );196 refresh_oscam(REFR_SERVER, in); 198 197 } 199 198 int j; … … 221 220 } 222 221 223 void send_oscam_config_radegast(struct templatevars *vars, FILE *f, struct uriparams *params ) {222 void send_oscam_config_radegast(struct templatevars *vars, FILE *f, struct uriparams *params, struct in_addr in) { 224 223 int i; 225 224 if (strcmp(getParam(params, "action"),"execute") == 0){ … … 235 234 } 236 235 tpl_addVar(vars, 1, "MESSAGE", "<BR><BR><B>Configuration Radegast *DONE*</B><BR><BR>"); 237 refresh_oscam(REFR_SERVER );236 refresh_oscam(REFR_SERVER, in); 238 237 } 239 238 tpl_printf(vars, 0, "PORT", "%d", cfg->rad_port); … … 252 251 } 253 252 254 void send_oscam_config_cccam(struct templatevars *vars, FILE *f, struct uriparams *params ) {253 void send_oscam_config_cccam(struct templatevars *vars, FILE *f, struct uriparams *params, struct in_addr in) { 255 254 int i; 256 255 if (strcmp(getParam(params, "action"),"execute") == 0){ … … 263 262 } 264 263 tpl_addVar(vars, 1, "MESSAGE", "<BR><BR>Configuration Cccam Do not yet implemented<BR><BR>"); 265 refresh_oscam(REFR_SERVER );264 refresh_oscam(REFR_SERVER, in); 266 265 } 267 266 fputs(tpl_getTpl(vars, "CONFIGCCCAM"), f); … … 269 268 270 269 #ifdef CS_WITH_GBOX 271 void send_oscam_config_gbox(struct templatevars *vars, FILE *f, struct uriparams *params ) {270 void send_oscam_config_gbox(struct templatevars *vars, FILE *f, struct uriparams *params, struct in_addr in) { 272 271 int i; 273 272 if (strcmp(getParam(params, "action"),"execute") == 0){ … … 280 279 } 281 280 tpl_addVar(vars, 1, "MESSAGE", "<BR><BR><B>Configuration Gbox *DONE*</B><BR><BR>"); 282 refresh_oscam(REFR_SERVER );281 refresh_oscam(REFR_SERVER, in); 283 282 } 284 283 tpl_printf(vars, 0, "MAXDIST", "%d", cfg->maxdist); … … 296 295 #endif 297 296 298 void send_oscam_config_monitor(struct templatevars *vars, FILE *f, struct uriparams *params ) {297 void send_oscam_config_monitor(struct templatevars *vars, FILE *f, struct uriparams *params, struct in_addr in) { 299 298 int i; 300 299 if (strcmp(getParam(params, "action"),"execute") == 0){ … … 310 309 } 311 310 tpl_addVar(vars, 1, "MESSAGE", "<BR><BR><B>Configuration Monitor *DONE*</B><BR><BR>"); 312 refresh_oscam(REFR_SERVER );311 refresh_oscam(REFR_SERVER, in); 313 312 } 314 313 tpl_printf(vars, 0, "MONPORT", "%d", cfg->mon_port); … … 339 338 } 340 339 341 void send_oscam_config_serial(struct templatevars *vars, FILE *f, struct uriparams *params ) {340 void send_oscam_config_serial(struct templatevars *vars, FILE *f, struct uriparams *params, struct in_addr in) { 342 341 int i; 343 342 if (strcmp(getParam(params, "action"),"execute") == 0){ … … 350 349 } 351 350 tpl_addVar(vars, 1, "MESSAGE", "<BR><BR><B>Configuration Serial *DONE*</B><BR><BR>"); 352 refresh_oscam(REFR_SERVER );351 refresh_oscam(REFR_SERVER, in); 353 352 } 354 353 … … 359 358 360 359 #ifdef HAVE_DVBAPI 361 void send_oscam_config_dvbapi(struct templatevars *vars, FILE *f, struct uriparams *params ) {360 void send_oscam_config_dvbapi(struct templatevars *vars, FILE *f, struct uriparams *params, struct in_addr in) { 362 361 int i; 363 362 if (strcmp(getParam(params, "action"),"execute") == 0){ … … 370 369 } 371 370 tpl_addVar(vars, 1, "MESSAGE", "<BR><BR><B>Configuration DVB Api *DONE*</B><BR><BR>"); 372 refresh_oscam(REFR_SERVER );371 refresh_oscam(REFR_SERVER, in); 373 372 } 374 373 … … 383 382 384 383 #ifdef CS_ANTICASC 385 void send_oscam_config_anticasc(struct templatevars *vars, FILE *f, struct uriparams *params ) {384 void send_oscam_config_anticasc(struct templatevars *vars, FILE *f, struct uriparams *params, struct in_addr in) { 386 385 int i; 387 386 if (strcmp(getParam(params, "action"),"execute") == 0){ … … 394 393 } 395 394 tpl_addVar(vars, 1, "MESSAGE", "<BR><BR><B>Configuration Anticascading *DONE*</B><BR><BR>"); 396 refresh_oscam(REFR_ANTICASC );395 refresh_oscam(REFR_ANTICASC, in); 397 396 } 398 397 if (cfg->ac_enabled > 0) tpl_addVar(vars, 0, "CHECKED", "checked"); … … 408 407 #endif 409 408 410 void send_oscam_config(struct templatevars *vars, FILE *f, struct uriparams *params ) {409 void send_oscam_config(struct templatevars *vars, FILE *f, struct uriparams *params, struct in_addr in) { 411 410 char *part = getParam(params, "part"); 412 if (!strcmp(part,"camd33")) send_oscam_config_camd33(vars, f, params );413 else if (!strcmp(part,"camd35")) send_oscam_config_camd35(vars, f, params );414 else if (!strcmp(part,"camd35tcp")) send_oscam_config_camd35tcp(vars, f, params );415 else if (!strcmp(part,"newcamd")) send_oscam_config_newcamd(vars, f, params );416 else if (!strcmp(part,"radegast")) send_oscam_config_radegast(vars, f, params );417 else if (!strcmp(part,"cccam")) send_oscam_config_cccam(vars, f, params );411 if (!strcmp(part,"camd33")) send_oscam_config_camd33(vars, f, params, in); 412 else if (!strcmp(part,"camd35")) send_oscam_config_camd35(vars, f, params, in); 413 else if (!strcmp(part,"camd35tcp")) send_oscam_config_camd35tcp(vars, f, params, in); 414 else if (!strcmp(part,"newcamd")) send_oscam_config_newcamd(vars, f, params, in); 415 else if (!strcmp(part,"radegast")) send_oscam_config_radegast(vars, f, params, in); 416 else if (!strcmp(part,"cccam")) send_oscam_config_cccam(vars, f, params, in); 418 417 #ifdef CS_WITH_GBOX 419 else if (!strcmp(part,"gbox")) send_oscam_config_gbox(vars, f, params );418 else if (!strcmp(part,"gbox")) send_oscam_config_gbox(vars, f, params, in); 420 419 #endif 421 420 #ifdef HAVE_DVBAPI 422 else if (!strcmp(part,"dvbapi")) send_oscam_config_dvbapi(vars, f, params );421 else if (!strcmp(part,"dvbapi")) send_oscam_config_dvbapi(vars, f, params, in); 423 422 #endif 424 423 #ifdef CS_ANTICASC 425 else if (!strcmp(part,"anticasc")) send_oscam_config_anticasc(vars, f, params );424 else if (!strcmp(part,"anticasc")) send_oscam_config_anticasc(vars, f, params, in); 426 425 #endif 427 else if (!strcmp(part,"monitor")) send_oscam_config_monitor(vars, f, params );428 else if (!strcmp(part,"serial")) send_oscam_config_serial(vars, f, params );429 else send_oscam_config_global(vars, f, params );426 else if (!strcmp(part,"monitor")) send_oscam_config_monitor(vars, f, params, in); 427 else if (!strcmp(part,"serial")) send_oscam_config_serial(vars, f, params, in); 428 else send_oscam_config_global(vars, f, params, in); 430 429 } 431 430 … … 461 460 } 462 461 463 void send_oscam_reader_config(struct templatevars *vars, FILE *f, struct uriparams *params ) {462 void send_oscam_reader_config(struct templatevars *vars, FILE *f, struct uriparams *params, struct in_addr in) { 464 463 int ridx; 465 464 char *reader_ = getParam(params, "reader"); … … 469 468 } else if(strcmp(getParam(params, "action"), "execute") == 0){ 470 469 tpl_addVar(vars, 0, "MESSAGE", "<BR><BR>Saving not yet implemented<BR><BR>"); 471 refresh_oscam(REFR_READERS );470 refresh_oscam(REFR_READERS, in); 472 471 } 473 472 int i; … … 535 534 } 536 535 537 void send_oscam_user_config_edit(struct templatevars *vars, FILE *f, struct uriparams *params ){536 void send_oscam_user_config_edit(struct templatevars *vars, FILE *f, struct uriparams *params, struct in_addr in){ 538 537 struct s_auth *account, *ptr; 539 538 char user[128]; … … 578 577 #endif 579 578 tpl_addVar(vars, 1, "MESSAGE", "<b>New user has been added with default settings</b><BR>"); 580 if (write_userdb()==0) refresh_oscam(REFR_ACCOUNTS );579 if (write_userdb()==0) refresh_oscam(REFR_ACCOUNTS, in); 581 580 else tpl_addVar(vars, 1, "MESSAGE", "<b>Writing configuration to disk failed!</b><BR>"); 582 581 // need to reget account as writing to disk changes account! … … 599 598 chk_account("services", servicelabels, account); 600 599 tpl_addVar(vars, 1, "MESSAGE", "<B>Settings updated</B><BR><BR>"); 601 if (write_userdb()==0) refresh_oscam(REFR_ACCOUNTS );600 if (write_userdb()==0) refresh_oscam(REFR_ACCOUNTS, in); 602 601 else tpl_addVar(vars, 1, "MESSAGE", "<B>Write Config failed</B><BR><BR>"); 603 602 } … … 712 711 } 713 712 714 void send_oscam_user_config(struct templatevars *vars, FILE *f, struct uriparams *params ) {713 void send_oscam_user_config(struct templatevars *vars, FILE *f, struct uriparams *params, struct in_addr in) { 715 714 struct s_auth *account, *account2; 716 715 char *user = getParam(params, "user"); … … 737 736 if (found > 0){ 738 737 tpl_addVar(vars, 1, "MESSAGE", "<b>Account has been deleted!</b><BR>"); 739 if (write_userdb()==0) refresh_oscam(REFR_ACCOUNTS );738 if (write_userdb()==0) refresh_oscam(REFR_ACCOUNTS, in); 740 739 else tpl_addVar(vars, 1, "MESSAGE", "<b>Writing configuration to disk failed!</b><BR>"); 741 740 } else tpl_addVar(vars, 1, "MESSAGE", "<b>Sorry but the specified user doesn't exist. No deletion will be made!</b><BR>"); … … 816 815 } 817 816 818 void send_oscam_status(struct templatevars *vars, FILE *f, struct uriparams *params ) {817 void send_oscam_status(struct templatevars *vars, FILE *f, struct uriparams *params, struct in_addr in) { 819 818 int i; 820 819 char *usr; … … 828 827 chk_t_monitor("httphideidleclients", hideidle); 829 828 if(oldval != cfg->http_hide_idle_clients){ 830 refresh_oscam(REFR_SERVER );829 refresh_oscam(REFR_SERVER, in); 831 830 } 832 831 } … … 918 917 } 919 918 920 void send_oscam_services_edit(struct templatevars *vars, FILE *f, struct uriparams *params ) {919 void send_oscam_services_edit(struct templatevars *vars, FILE *f, struct uriparams *params, struct in_addr in) { 921 920 struct s_sidtab *sidtab,*ptr; 922 921 char label[128]; … … 950 949 951 950 tpl_addVar(vars, 1, "MESSAGE", "<b>New service has been added</b><BR>"); 952 if (write_services()==0) refresh_oscam(REFR_SERVICES );951 if (write_services()==0) refresh_oscam(REFR_SERVICES, in); 953 952 else tpl_addVar(vars, 1, "MESSAGE", "<b>Writing services to disk failed!</b><BR>"); 954 953 … … 963 962 } 964 963 tpl_addVar(vars, 1, "MESSAGE", "<B>Services updated</B><BR><BR>"); 965 if (write_services()==0) refresh_oscam(REFR_SERVICES );964 if (write_services()==0) refresh_oscam(REFR_SERVICES, in); 966 965 else tpl_addVar(vars, 1, "MESSAGE", "<B>Write Config failed</B><BR><BR>"); 967 966 … … 987 986 } 988 987 989 void send_oscam_services(struct templatevars *vars, FILE *f, struct uriparams *params ) {988 void send_oscam_services(struct templatevars *vars, FILE *f, struct uriparams *params, struct in_addr in) { 990 989 struct s_sidtab *sidtab, *sidtab2; 991 990 char *service = getParam(params, "service"); … … 1011 1010 if (found > 0){ 1012 1011 tpl_addVar(vars, 1, "MESSAGE", "<b>Service has been deleted!</b><BR>"); 1013 if (write_services()==0) refresh_oscam(REFR_SERVICES );1012 if (write_services()==0) refresh_oscam(REFR_SERVICES, in); 1014 1013 else tpl_addVar(vars, 1, "MESSAGE", "<b>Writing services to disk failed!</b><BR>"); 1015 1014 } else tpl_addVar(vars, 1, "MESSAGE", "<b>Sorry but the specified service doesn't exist. No deletion will be made!</b><BR>"); … … 1169 1168 tpl_printf(vars, 0, "CURDATE", "%02d.%02d.%02d", lt->tm_mday, lt->tm_mon+1, lt->tm_year%100); 1170 1169 tpl_printf(vars, 0, "CURTIME", "%02d:%02d:%02d", lt->tm_hour, lt->tm_min, lt->tm_sec); 1170 tpl_printf(vars, 0, "CURIP", "%s", inet_ntoa(*(struct in_addr *)&in)); 1171 1171 switch(pgidx){ 1172 case 0: send_oscam_config(vars, f, ¶ms ); break;1172 case 0: send_oscam_config(vars, f, ¶ms, in); break; 1173 1173 case 1: send_oscam_reader(vars, f); break; 1174 1174 case 2: send_oscam_entitlement(vars, f, ¶ms); break; 1175 case 3: send_oscam_status(vars, f, ¶ms ); break;1176 case 4: send_oscam_user_config(vars, f, ¶ms ); break;1177 case 5: send_oscam_reader_config(vars, f, ¶ms ); break;1178 case 6: send_oscam_services(vars, f, ¶ms ); break;1179 case 7: send_oscam_user_config_edit(vars, f, ¶ms ); break;1180 case 9: send_oscam_services_edit(vars, f, ¶ms ); break;1175 case 3: send_oscam_status(vars, f, ¶ms, in); break; 1176 case 4: send_oscam_user_config(vars, f, ¶ms, in); break; 1177 case 5: send_oscam_reader_config(vars, f, ¶ms, in); break; 1178 case 6: send_oscam_services(vars, f, ¶ms, in); break; 1179 case 7: send_oscam_user_config_edit(vars, f, ¶ms, in); break; 1180 case 9: send_oscam_services_edit(vars, f, ¶ms, in); break; 1181 1181 case 10: send_oscam_savetpls(vars, f); break; 1182 default: send_oscam_status(vars, f, ¶ms ); break;1182 default: send_oscam_status(vars, f, ¶ms, in); break; 1183 1183 } 1184 1184 tpl_clear(vars); -
branches/monitor-improvement/oscam-http.h
r1139 r1142 46 46 47 47 #define TPLFOOTER "\ 48 <HR/><H4>OSCAM Webinterface - ##CURDATE## ##CURTIME## </H4>\48 <HR/><H4>OSCAM Webinterface - ##CURDATE## ##CURTIME## | Access from ##CURIP##</H4>\ 49 49 </BODY>\ 50 50 </HTML>"
Note:
See TracChangeset
for help on using the changeset viewer.