X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=src%2Fap-config.c;h=fa82c8c2faccc7ecbb9165c20d4e9cc62dceb1cb;hb=4b3f028aa4112a5b924c010fd19e78898d67cb49;hp=4ef92872b66cd571cb90848d2fcb9f26023e6f3c;hpb=67fc54773e1504698e80c9cb83977bde32665350;p=ap-utils.git diff --git a/src/ap-config.c b/src/ap-config.c index 4ef9287..fa82c8c 100644 --- a/src/ap-config.c +++ b/src/ap-config.c @@ -27,22 +27,15 @@ #include #include "ap-utils.h" -char *ap_types[3] = { - "ATMEL410", - "NWN", - "ATMEL12350" -}; +extern short ap_type; +extern int snmp_quit_by_keypress; WINDOW *win_for_menu, *sub_for_menu, *win_for_help, *main_win, *main_sub; -short ap_type; char *community; -int sockfd, atmel410_filter=0; +int atmel410_filter = 0, wait_mode = WAIT_FOREVER; struct in_addr ap_ip; char *prog_title = "Wireless Access Point Configurator"; - -extern char IS_ATMEL410_SBRIDGES; -extern char IS_ATMEL12350_TELLUS; -extern char IS_ATMEL12350_VERNET; +char set_oeminfo_allowed = 0; void config_menu() { @@ -51,7 +44,7 @@ void config_menu() 0}, {_("Wireless"), _("Set wireless options"), atmel_wireless, 0}, {_("Privacy"), MENU_ENCRYPT, wep, 0}, - {_("MAC auth"), MENU_MAC, atmel_auth_mac, 0}, + {_("Auth"), MENU_AUTH, atmel_auth, 0}, {_("Community"), MENU_COMMUNITY, AuthorizedSettings, 0}, {_("Radio"), _("Set radio signal power and antenna options"), power, 0}, @@ -63,7 +56,7 @@ void config_menu() {_("General"), _("Set general options"), nwn_wireless, 0}, {_("Advanced"), _("Set advanced options"), advanced, 0}, {_("Privacy"), MENU_ENCRYPT, nwn_wep, 0}, - {_("MAC auth"), MENU_MAC, nwn_auth_mac, 0}, + {_("MAC auth"), MENU_AUTH, nwn_auth_mac, 0}, {_("Community"), MENU_COMMUNITY, AuthorizedSettings, 0}, {"..", MAIN_MENU, NULL, 0}, {0, 0, NULL, 0} @@ -72,7 +65,9 @@ void config_menu() switch (ap_type) { case ATMEL410: case ATMEL12350: + set_oeminfo_allowed++; uni_menu(umenu_atmel, sizeof(umenu_atmel) / sizeof(umenu_atmel[0])); + set_oeminfo_allowed--; break; case NWN: uni_menu(umenu_nwn, sizeof(umenu_nwn) / sizeof(umenu_nwn[0])); @@ -84,11 +79,10 @@ void config_menu() void command_menu() { struct umitems command_umenu_atmel[] = { - {_("Upload"), _("Make current configuration active"), upload, 0}, + {_("Upload"), _("Activate current configuration"), upload, 0}, {_("Defaults"), _("Restore factory default settings"), defaults, 0}, {_("Reset"), - _("Reset AP. All not uploaded configuration will be lost"), - reset, 0}, + _("Reset AP. All not uploaded configuration will be lost"), reset, 0}, {_("TestMode"), _("Put Access Point in test mode"), test, 0}, {"..", MAIN_MENU, NULL, 0}, {0, 0, NULL, 0} @@ -118,8 +112,8 @@ void stat_menu() {_("SysInfo"), MENU_SYSINFO, atmel_sysinfo, 0}, {_("Ethernet"), _("Get ethernet port statistics"), EthStat, 0}, {_("Wireless"), MENU_WIRELESS, WirelessStat, 0}, - {_("Stations"), MENU_STAS, stations, - 0}, + {_("Stations"), MENU_STAS, atmel_stations, 0}, + {_("AP link"), MENU_APLINK, atmel_aplink, 0}, {_("KnownAPs"), _("Get info about known Access Points"), APs, 0}, {"..", MAIN_MENU, NULL, 0}, {0, 0, NULL, 0} @@ -133,7 +127,7 @@ void stat_menu() {0, 0, NULL, 0} }; - switch (ap_type) { + switch (ap_type) { case ATMEL410: case ATMEL12350: uni_menu(umenu_atmel, sizeof(umenu_atmel) / sizeof(umenu_atmel[0])); @@ -146,7 +140,7 @@ void stat_menu() void _auth() { - if(get_opts() == 0) + if (get_opts() == 0) connect_options((unsigned long) NULL, (int) NULL); } @@ -159,11 +153,13 @@ void main_menu() command_menu, 1}, {_("Connect"), MENU_CONNECT, _auth, 0}, {_("Search"), MENU_SEARCH, ap_search, 0}, - {_("About"), MENU_ABOUT, about, 0}, + {_("Polling"), MENU_POLLING, polling_interval, 0}, {_("Shell"), MENU_SHELL, exit_shell, 0}, + {_("About"), MENU_ABOUT, about, 0}, {_("Exit"), MENU_EXIT, exit_program, 0}, {0, 0, NULL, 0} }; + uni_menu(config_umenu, sizeof(config_umenu) / sizeof(config_umenu[0])); } @@ -185,10 +181,19 @@ int main( /*int argc, char **argv */ ) initscr(); if (has_colors()) { start_color(); - init_pair(1, COLOR_BLACK, COLOR_CYAN); - init_pair(2, COLOR_BLACK, COLOR_WHITE); - init_pair(3, COLOR_BLACK, COLOR_GREEN); - init_pair(4, COLOR_WHITE, COLOR_RED); + + /* Never trust that these are defined by default. */ + init_pair (COLOR_RED, COLOR_RED, COLOR_BLACK ); + init_pair (COLOR_GREEN, COLOR_GREEN, COLOR_BLACK); + init_pair (COLOR_YELLOW, COLOR_YELLOW, COLOR_BLACK); + init_pair (COLOR_BLUE, COLOR_BLUE, COLOR_BLACK); + init_pair (COLOR_MAGENTA, COLOR_MAGENTA, COLOR_BLACK); + init_pair (COLOR_CYAN, COLOR_CYAN, COLOR_BLACK); + + init_pair(11, COLOR_BLACK, COLOR_CYAN); + init_pair(12, COLOR_BLACK, COLOR_WHITE); + init_pair(13, COLOR_BLACK, COLOR_GREEN); + init_pair(14, COLOR_WHITE, COLOR_RED); } noraw(); @@ -197,16 +202,17 @@ int main( /*int argc, char **argv */ ) scrollok(stdscr, TRUE); idlok(stdscr, TRUE); keypad(stdscr, TRUE); + snmp_quit_by_keypress = 1; refresh(); /* draw help win */ win_for_help = newwin(1, COLS, LINES - 1, 0); - wattrset(win_for_help, COLOR_PAIR(1)); + wattrset(win_for_help, COLOR_PAIR(11)); print_help(""); /* draw title win */ win_for_title = newwin(1, COLS, 0, 0); - wattrset(win_for_title, COLOR_PAIR(1)); + wattrset(win_for_title, COLOR_PAIR(11)); for (i = 0; i < COLS; i++) waddch(win_for_title, ' '); sprintf(message, _("Wireless Access Point Configurator ver. %s"), @@ -219,7 +225,7 @@ int main( /*int argc, char **argv */ ) sub_for_menu = derwin(win_for_menu, LINES - 5, MCOLS - 2, 2, 1); set_menu_win(NULL, win_for_menu); set_menu_sub(NULL, sub_for_menu); - attrset(COLOR_PAIR(1)); + attrset(COLOR_PAIR(11)); /* íÁÌÀÀ ÒÁÍËÕ */ waddch(win_for_menu, ACS_BSSB); @@ -261,4 +267,3 @@ int main( /*int argc, char **argv */ ) /* Not reachable */ return 0; } -