void show_subscriber_table(webs_t wp, char *type, int which) { static char word[256]; char *next, *wordlist; char *user, *pass; static char new_user[200], new_pass[200]; int temp; wordlist = nvram_safe_get("milkfish_ddsubscribers"); temp = which; foreach(word, wordlist, next) { if (which-- == 0) { pass = word; user = strsep(&pass, ":"); if (!user || !pass) continue; if (!strcmp(type, "user")) { httpd_filter_name(user, new_user, sizeof(new_user), GET); websWrite(wp, "%s", new_user); } else if (!strcmp(type, "pass")) { httpd_filter_name(pass, new_pass, sizeof(new_pass), GET); websWrite(wp, "%s", new_pass); } return; } } }
static void show_chaps_table(webs_t wp, char *type, int which) { static char word[256]; char *next, *wordlist; char *user, *pass, *ip, *enable; static char new_user[200], new_pass[200]; int temp; wordlist = nvram_safe_get("pppoeserver_chaps"); temp = which; foreach(word, wordlist, next) { if (which-- == 0) { pass = word; user = strsep(&pass, ":"); if (!user || !pass) continue; ip = pass; pass = strsep(&ip, ":"); if (!pass || !ip) continue; enable = ip; ip = strsep(&enable, ":"); if (!ip || !enable) continue; if (!strcmp(type, "user")) { httpd_filter_name(user, new_user, sizeof(new_user), GET); websWrite(wp, "%s", new_user); } else if (!strcmp(type, "pass")) { httpd_filter_name(pass, new_pass, sizeof(new_pass), GET); websWrite(wp, "%s", new_pass); } else if (!strcmp(type, "ip")) websWrite(wp, "%s", ip); else if (!strcmp(type, "enable")) { if (!strcmp(enable, "on")) websWrite(wp, "checked=\"checked\""); else websWrite(wp, ""); } return; } } if (!strcmp(type, "ip")) websWrite(wp, "0.0.0.0"); else websWrite(wp, ""); }
void show_registrations_table(webs_t wp, char *type, int which) { static char word[256]; char *next, *wordlist; char *user, *contact, *agent; static char new_user[200], new_contact[200], new_agent[200]; int temp; wordlist = nvram_safe_get("milkfish_ddactive"); temp = which; foreach(word, wordlist, next) { if (which-- == 0) { contact = word; user = strsep(&contact, ":"); if (!user || !contact) continue; agent = contact; contact = strsep(&agent, ":"); if (!contact || !agent) continue; if (!strcmp(type, "user")) { httpd_filter_name(user, new_user, sizeof(new_user), GET); websWrite(wp, "%s", new_user); } else if (!strcmp(type, "contact")) { httpd_filter_name(contact, new_contact, sizeof(new_contact), GET); websWrite(wp, "%s", new_contact); } else if (!strcmp(type, "agent")) { httpd_filter_name(agent, new_agent, sizeof(new_agent), GET); websWrite(wp, "%s", new_agent); } return; } } }
void port_trigger_table(webs_t wp, char *type, int which) { static char word[256]; char *next, *wordlist; char *name = NULL, *enable = NULL, *proto = NULL, *i_from = NULL, *i_to = NULL, *o_from = NULL, *o_to = NULL; static char new_name[200]; int temp; wordlist = nvram_safe_get("port_trigger"); temp = which; foreach(word, wordlist, next) { if (which-- == 0) { enable = word; name = strsep(&enable, ":"); if (!name || !enable) continue; proto = enable; enable = strsep(&proto, ":"); if (!enable || !proto) continue; i_from = proto; proto = strsep(&i_from, ":"); if (!proto || !i_from) continue; i_to = i_from; i_from = strsep(&i_to, "-"); if (!i_from || !i_to) continue; o_from = i_to; i_to = strsep(&o_from, ">"); if (!i_to || !o_from) continue; o_to = o_from; o_from = strsep(&o_to, "-"); if (!o_from || !o_to) continue; if (!strcmp(type, "name")) { if (strcmp(name, "")) { httpd_filter_name(name, new_name, sizeof(new_name), GET); websWrite(wp, "%s", new_name); } } else if (!strcmp(type, "enable")) { if (!strcmp(enable, "on")) websWrite(wp, "checked=\\\"checked\\\""); else websWrite(wp, ""); } else if (!strcmp(type, "sel_tcp")) { // use select if (!strcmp(proto, "udp") || !strcmp(proto, "both")) websWrite(wp, ""); else websWrite(wp, "selected=\"selected\""); } else if (!strcmp(type, "sel_udp")) { // use select if (!strcmp(proto, "tcp") || !strcmp(proto, "both")) websWrite(wp, ""); else websWrite(wp, "selected=\"selected\""); } else if (!strcmp(type, "sel_both")) { // use select if (!strcmp(proto, "both")) websWrite(wp, "selected=\\\"selected\\\""); else websWrite(wp, ""); } else if (!strcmp(type, "i_from")) websWrite(wp, "%s", i_from); else if (!strcmp(type, "i_to")) websWrite(wp, "%s", i_to); else if (!strcmp(type, "o_from")) websWrite(wp, "%s", o_from); else if (!strcmp(type, "o_to")) websWrite(wp, "%s", o_to); return; } } if (!strcmp(type, "name")) websWrite(wp, ""); else websWrite(wp, "0"); return; }
void port_forward_table(webs_t wp, char *type, int which) { static char word[256]; char *next, *wordlist; char *name, *from, *to, *proto, *ip, *enable; static char new_name[200]; int temp; wordlist = nvram_safe_get("forward_port"); temp = which; foreach(word, wordlist, next) { if (which-- == 0) { enable = word; name = strsep(&enable, ":"); if (!name || !enable) continue; proto = enable; enable = strsep(&proto, ":"); if (!enable || !proto) continue; from = proto; proto = strsep(&from, ":"); if (!proto || !from) continue; to = from; from = strsep(&to, ":"); if (!to || !from) continue; ip = to; to = strsep(&ip, ">"); if (!ip || !to) continue; if (!strcmp(type, "name")) { httpd_filter_name(name, new_name, sizeof(new_name), GET); websWrite(wp, "%s", new_name); } else if (!strcmp(type, "from")) websWrite(wp, "%s", from); else if (!strcmp(type, "to")) websWrite(wp, "%s", to); else if (!strcmp(type, "tcp")) { // use checkbox if (!strcmp(proto, "udp")) websWrite(wp, ""); else websWrite(wp, "checked=\"checked\""); } else if (!strcmp(type, "udp")) { // use checkbox if (!strcmp(proto, "tcp")) websWrite(wp, ""); else websWrite(wp, "checked=\"checked\""); } else if (!strcmp(type, "sel_tcp")) { // use select if (!strcmp(proto, "udp")) websWrite(wp, ""); else websWrite(wp, "selected=\"selected\""); } else if (!strcmp(type, "sel_udp")) { // use select if (!strcmp(proto, "tcp")) websWrite(wp, ""); else websWrite(wp, "selected=\"selected\""); } else if (!strcmp(type, "sel_both")) { // use select if (!strcmp(proto, "both")) websWrite(wp, "selected=\\\"selected\\\""); else websWrite(wp, ""); } else if (!strcmp(type, "ip")) websWrite(wp, "%s", ip); else if (!strcmp(type, "enable")) { if (!strcmp(enable, "on")) websWrite(wp, "checked=\"checked\""); else websWrite(wp, ""); } return; } } if (!strcmp(type, "from") || !strcmp(type, "to")) websWrite(wp, "0"); else if (!strcmp(type, "ip")) websWrite(wp, "0.0.0.0"); else if (!strcmp(type, "sel_both")) websWrite(wp, "selected=\\\"selected\\\""); else websWrite(wp, ""); }