#include <unistd.h>
#include <sys/types.h>
#include "ap-utils.h"
-#include "ap-curses.h"
#define ESSID _("[E] ESSID: ")
#define AP_NAME _("[N] AP name: ")
#define INT_ROAMING _("[I] International roaming: ")
#define BEACON_PER _("[B] Beacon period (msec): ")
#define DTIM_I _("[D] DTIM sending interval (beacons): ")
+#define SIFS_T _("[T] SIFS time (2nd+ interframe spacing, usec): ")
#define WLAN_HELP _("[key] - set option; W - write conf; Q - quit to menu")
-extern short ap_type;
+extern short ap_type, ap_vendorext;
void atmel_wireless()
{
- char sysDeviceInfo[] =
- { 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x01, 0x01, 0x05,
- 0x00
- };
- char operEthernetAddress[] =
- { 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x01, 0x02, 0x03,
- 0x00
+ char sysDeviceInfo[] = {
+ 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x01, 0x01, 0x05, 0x00
};
- char operChannelID[] =
- { 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x02, 0x01, 0x01,
- 0x00
+ char operChannelID[] = {
+ 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x02, 0x01, 0x01, 0x00
};
- char operESSIDLength[] =
- { 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x02, 0x01, 0x02,
- 0x00
+ char operESSIDLength[] = {
+ 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x02, 0x01, 0x02, 0x00
};
- char operESSID[] =
- { 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x02, 0x01, 0x03,
- 0x00
+ char operESSID[] = {
+ 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x02, 0x01, 0x03, 0x00
};
- char operRTSThreshold[] =
- { 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x02, 0x01, 0x04,
- 0x00
+ char operRTSThreshold[] = {
+ 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x02, 0x01, 0x04, 0x00
};
- char operFragmentationThreshold[] =
- { 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x02, 0x01, 0x05,
- 0x00
+ char operFragmentationThreshold[] = {
+ 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x02, 0x01, 0x05, 0x00
};
- char operPreambleType[] =
- { 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x02, 0x01, 0x06,
- 0x00
+ char operPreambleType[] = {
+ 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x02, 0x01, 0x06, 0x00
};
- char operAuthenticationType[] =
- { 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x02, 0x01, 0x07,
- 0x00
+ char operAuthenticationType[] = {
+ 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x02, 0x01, 0x07, 0x00
};
- char operBasicRates[] =
- { 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x02, 0x01, 0x08,
- 0x00
+ char operBasicRates[] = {
+ 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x02, 0x01, 0x08, 0x00
};
- char operAutoRateFallBack[] =
- { 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x02, 0x01, 0x09,
- 0x00
+ char operAutoRateFallBack[] = {
+ 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x02, 0x01, 0x09, 0x00
};
- char operAccessPointName[] =
- { 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x02, 0x01, 0x0A,
- 0x00
+ char operAccessPointName[] = {
+ 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x02, 0x01, 0x0A, 0x00
};
- char operSSIDBroadcasting[] =
- { 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x02, 0x01, 0x0B,
- 0x00
+ char operSSIDBroadcasting[] = {
+ 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x02, 0x01, 0x0B, 0x00
};
/* This one is ATMEL12350 MIB specific. */
- char operInterRoaming[] =
- { 0x2B, 0x06, 0x01, 0x04, 0x01, 0xE0, 0x3E, 0x01, 0x02, 0x01, 0x0D,
- 0x00
+ char operInterRoaming[] = {
+ 0x2B, 0x06, 0x01, 0x04, 0x01, 0xE0, 0x3E, 0x01, 0x02, 0x01, 0x0D, 0x00
+ };
+ /* These two are ATMEL12350 GEMTEK MIB specific. */
+ char operBeaconPeriod[] = {
+ 0x2B, 0x06, 0x01, 0x04, 0x01, 0xE0, 0x3E, 0x01, 0x02, 0x01, 0x0E, 0x00
};
- /* These two are ATMEL12350 TELLUS MIB specific. */
- char operBeaconPeriod[] =
- { 0x2B, 0x06, 0x01, 0x04, 0x01, 0xE0, 0x3E, 0x01, 0x02, 0x01, 0x0E,
- 0x00
+ char operDTIM[] = {
+ 0x2B, 0x06, 0x01, 0x04, 0x01, 0xE0, 0x3E, 0x01, 0x02, 0x01, 0x0F, 0x00
};
- char operDTIM[] =
- { 0x2B, 0x06, 0x01, 0x04, 0x01, 0xE0, 0x3E, 0x01, 0x02, 0x01, 0x0F,
- 0x00
+ /* This one is ATMEL12350 EZYNET MIB specific. */
+ char operSIFSTIME[] = {
+ 0x2B, 0x06, 0x01, 0x04, 0x01, 0xE0, 0x3E, 0x01, 0x02, 0x01, 0x10, 0x00
};
extern WINDOW *main_sub;
- varbind varbinds[15];
+ extern rdprops regdom_types[];
+ extern char *channels[];
+ varbind varbinds[16];
unsigned short int RTSThreshold, FragmentationThreshold,
- InterRoaming, m_basic_rates = 0, first_channel = 1;
- unsigned int BeaconPeriod = 0;
+ InterRoaming, m_basic_rates = 0, BeaconPeriod = 0, sifs = 0;
unsigned char dtim, ch;
char *AuthenticationTypes[3] = { OSYS, SH_KEY, BOTH_TYPE },
- message[1024],
- oui_tellus[3] = { 0x00, 0x04, 0xDB },
- IS_ATMEL12350_TELLUS = 0; /* ATMEL12350 Tellus uses different MIB */
- char domain[32], basic_rates[4], AutoRateFallBack, SSIDBroadcasting,
- ap_name[32], ch_num = 0, PreambleType, AuthenticationType, channel;
+ message[1024];
+ char domain[33], basic_rates[4], AutoRateFallBack, SSIDBroadcasting,
+ ap_name[33], PreambleType, AuthenticationType, channel;
char m_channel = 0, m_essid = 0, m_broadcast = 0, m_rts = 0,
m_fragment = 0, m_auth = 0, m_ap_name = 0, m_preambule = 0,
- m_auto_rate = 0, m_inter_roaming = 0, m_beacon = 0, m_dtim = 0;
- char *item_name[14], *rates[3] = { ON, OFF, BASIC }, *preambules[2] = {
+ m_auto_rate = 0, m_inter_roaming = 0, m_beacon = 0, m_dtim = 0,
+ m_sifs = 0;
+ char *rates[3] = { ON, OFF, BASIC }, *preambules[2] = {
_("Short"), _("Long")};
short __rates[4] = { 2, 4, 11, 22 };
- int i, c = 0;
+ int i, c = 0, rd_idx;
unsigned short ap_regdomain;
- struct SysDeviceInfo_ATMEL410 ptr410;
- struct SysDeviceInfo_ATMEL12350 ptr12350;
+ struct sysDeviceInfo_128 str128;
+ struct sysDeviceInfo_160 str160;
+
-
if (ap_type == ATMEL12350) {
sysDeviceInfo[5] = 0xE0;
sysDeviceInfo[6] = 0x3E;
- operEthernetAddress[5] = 0xE0;
- operEthernetAddress[6] = 0x3E;
operChannelID[5] = 0xE0;
operChannelID[6] = 0x3E;
operESSIDLength[5] = 0xE0;
operSSIDBroadcasting[6] = 0x3E;
}
-
- /* Find out whether the device uses enhanced ATMEL12350 TELLUS MIB. */
- varbinds[0].type = NULL_VALUE;
- varbinds[0].oid = operEthernetAddress;
- varbinds[0].len_oid = sizeof(operEthernetAddress);
- varbinds[0].len_val = 0;
-
- print_help(WAIT_RET);
- if (snmp(varbinds, 1, GET) <= 0) {
- print_helperr(ERR_RET);
- goto exit;
- }
-
- if (ap_type == ATMEL12350 && (memcmp(oui_tellus, varbinds[0].value, 3) ==0))
- IS_ATMEL12350_TELLUS = 1;
-
-
- for (i = 1; i < 15; i++) {
+ for (i = 0; i < 16; i++) {
varbinds[i].type = NULL_VALUE;
varbinds[i].len_val = 0;
varbinds[i].len_oid = sizeof(operChannelID);
varbinds[i++].oid = sysDeviceInfo;
if (ap_type == ATMEL12350) {
varbinds[i++].oid = operInterRoaming;
- if (IS_ATMEL12350_TELLUS) {
+ if (ap_vendorext == GEMTEK || ap_vendorext == EZYNET) {
varbinds[i++].oid = operBeaconPeriod;
varbinds[i++].oid = operDTIM;
}
+ if (ap_vendorext == EZYNET)
+ varbinds[i++].oid = operSIFSTIME;
}
- if (snmp(varbinds, i, GET) <= 0) {
+ print_help(WAIT_RET);
+ if (snmp(varbinds, i, GET) < i) {
print_helperr(ERR_RET);
goto exit;
}
channel = *(varbinds[0].value);
c = *(varbinds[1].value);
memcpy(domain, varbinds[2].value, 32);
+ domain[32] = '\0';
SSIDBroadcasting = *(varbinds[3].value);
memcpy(basic_rates, varbinds[4].value, 4);
AutoRateFallBack = *(varbinds[5].value);
PreambleType = *(varbinds[8].value);
AuthenticationType = *(varbinds[9].value);
memcpy(ap_name, varbinds[10].value, 32);
+ ap_name[32] = '\0';
if (ap_type == ATMEL12350) {
InterRoaming = *(varbinds[12].value);
- if (IS_ATMEL12350_TELLUS) {
- for (i = 0; i < varbinds[13].len_val;
- BeaconPeriod += varbinds[13].value[i] *
- (1 << ((varbinds[13].len_val - i - 1) * 8)), i++);
+ if (ap_vendorext == GEMTEK || ap_vendorext == EZYNET) {
+ BeaconPeriod = varbinds[13].len_val == 2 ?
+ (varbinds[13].value[0] << 8) | varbinds[13].value[1] :
+ varbinds[13].value[0] < 0x80 ?
+ varbinds[13].value[0] : 0xff00 | varbinds[13].value[0];
dtim = *(varbinds[14].value);
}
+ if (ap_vendorext == EZYNET)
+ sifs = varbinds[15].len_val == 2 ?
+ (varbinds[15].value[0] << 8) | varbinds[15].value[1] :
+ varbinds[15].value[0] < 0x80 ?
+ varbinds[15].value[0] : 0xff00 | varbinds[15].value[0];
}
- if (ap_type == ATMEL12350) {
- memcpy(&ptr12350, varbinds[11].value, sizeof(struct SysDeviceInfo_ATMEL12350));
- ap_regdomain=ptr12350.RegulationDomain;
- } else /* ATMEL410 */{
- memcpy(&ptr410, varbinds[11].value, sizeof(struct SysDeviceInfo_ATMEL410));
- ap_regdomain = swap4(ptr410.RegulationDomain);
- }
-
- if ((ch_num = ch_list(ap_regdomain, item_name)) == 0) {
- print_helperr(ERR_RET);
- goto exit;
+ if (varbinds[11].len_val == 160) {
+ memcpy(&str160, varbinds[11].value,
+ sizeof(struct sysDeviceInfo_160));
+ ap_regdomain = str160.RegulatoryDomain;
+ } else { /* varbinds[11].len_val == 92 || varbinds[11].len_val == 128 */
+ memcpy(&str128, varbinds[11].value,
+ sizeof(struct sysDeviceInfo_128));
+ ap_regdomain = swap4(str128.RegulatoryDomain);
}
- if (ap_regdomain == 0x31 || ap_regdomain == 0x32)
- first_channel=10;
- print_title(_("Wireless Settings"));
+ rd_idx = regdom_idx(ap_regdomain);
+
+ print_top(NULL, _("Wireless Settings"));
sprintf(message, "%s%02u (%u MHz)", CHANNEL, channel, 2407 + 5 * channel);
mvwaddstr(main_sub, 0, 0, message);
if (ap_type == ATMEL12350) {
sprintf(message, "%s%s", INT_ROAMING, (InterRoaming == 1) ? ON : OFF);
mvwaddstr(main_sub, 15, 0, message);
- if (IS_ATMEL12350_TELLUS) {
+ if (ap_vendorext == GEMTEK || ap_vendorext == EZYNET) {
sprintf(message, "%s%u", BEACON_PER, BeaconPeriod);
mvwaddstr(main_sub, 16, 0, message);
sprintf(message, "%s%u", DTIM_I, dtim);
mvwaddstr(main_sub, 17, 0, message);
}
+ if (ap_vendorext == EZYNET) {
+ sprintf(message, "%s%u", SIFS_T, sifs);
+ mvwaddstr(main_sub, 18, 0, message);
+ }
}
wrefresh(main_sub);
break;
case 'C':
case 'c':
- channel = menu_choose(0, strlen(CHANNEL), item_name, ch_num)
- + first_channel;
+ channel = menu_choose(0, strlen(CHANNEL),
+#ifndef NO_REG_DOMAIN
+ channels + regdom_types[rd_idx].first_ch - 1,
+ regdom_types[rd_idx].chans) + regdom_types[rd_idx].first_ch;
+#else
+ channels, 14) + 1;
+#endif
sprintf(message, "%02u (%u MHz)", channel, 2407 + 5 * channel);
print_menusel(0, 0, CHANNEL, message);
m_channel = 1;
continue;
case 'N':
case 'n':
-// make_field(2, strlen(AP_NAME), 32);
- get_value(ap_name, 2, strlen(AP_NAME), 32, ANY_STRING, 0, 0, NULL);
+// make_field(2, strlen(AP_NAME), 33);
+ get_value(ap_name, 2, strlen(AP_NAME), -33, ANY_STRING, 0, 0, NULL);
m_ap_name = 1;
continue;
case 'E':
case 'e':
-// make_field(1, strlen(ESSID), 32);
- get_value(domain, 1, strlen(ESSID), 32, ANY_STRING, 0, 0, NULL);
+// make_field(1, strlen(ESSID), 33);
+ get_value(domain, 1, strlen(ESSID), 33, ANY_STRING, 0, 0, NULL);
m_essid = 1;
continue;
case 'F':
case 'f':
// make_field(4, strlen(FRG_TR), 6);
- get_value(message, 4, strlen(FRG_TR), 6, INT_STRING, 256, 2346,
+ get_value(message, 4, strlen(FRG_TR), 5, INT_STRING, 256, 2346,
WLAN_HELP);
FragmentationThreshold = atoi(message);
m_fragment = 1;
case 'R':
case 'r':
// make_field(3, strlen(RTS_TR), 6);
- get_value(message, 3, strlen(RTS_TR), 6, INT_STRING, 0, 2347,
+ get_value(message, 3, strlen(RTS_TR), 5, INT_STRING, 0, 2347,
WLAN_HELP);
RTSThreshold = atoi(message);
m_rts = 1;
continue;
case 'B':
case 'b':
- if (!IS_ATMEL12350_TELLUS)
+ if (ap_vendorext != GEMTEK && ap_vendorext != EZYNET)
continue;
get_value(message, 16, strlen(BEACON_PER), 6, INT_STRING, 0, 65535,
WLAN_HELP);
continue;
case 'D':
case 'd':
- if (!IS_ATMEL12350_TELLUS)
+ if (ap_vendorext != GEMTEK && ap_vendorext != EZYNET)
continue;
get_value(message, 17, strlen(DTIM_I), 4, INT_STRING, 0, 255,
WLAN_HELP);
dtim = atoi(message);
m_dtim = 1;
continue;
+ case 'T':
+ case 't':
+ if (ap_vendorext != EZYNET)
+ continue;
+ get_value(message, 18, strlen(SIFS_T), 6, INT_STRING, 0, 65535,
+ WLAN_HELP);
+ sifs = atoi(message);
+ m_sifs = 1;
+ continue;
case 'w':
case 'W':
i = 0;
i++;
}
if (m_beacon) {
- int len_val;
-
- len_val = (BeaconPeriod > 0x7fff) ? 3 :
- (BeaconPeriod > 0x7f) ? 2 : 1;
varbinds[i].oid = operBeaconPeriod;
varbinds[i].len_oid = sizeof(operBeaconPeriod);
+ BeaconPeriod = htons(BeaconPeriod);
varbinds[i].value = (char *) &BeaconPeriod;
- varbinds[i].len_val = len_val;
- varbinds[i].type = STRING_VALUE;
+ varbinds[i].len_val = 2;
+ varbinds[i].type = INT_VALUE;
i++;
}
if (m_dtim) {
varbinds[i].type = INT_VALUE;
i++;
}
+ if (m_sifs) {
+ varbinds[i].oid = operSIFSTIME;
+ varbinds[i].len_oid = sizeof(operSIFSTIME);
+ sifs = htons(sifs);
+ varbinds[i].value = (char *) &sifs;
+ varbinds[i].len_val = 2;
+ varbinds[i].type = INT_VALUE;
+ i++;
+ }
print_help(WAIT_SET);
if (snmp(varbinds, i, SET) <= 0) {
print_helperr(ERR_SET);
goto exit;
}
+ wbkgd(main_sub, A_NORMAL);
+ wrefresh(main_sub);
print_help(DONE_SET);
goto exit;
}
exit:
getch();
quit:
- /* free memory allocated for channel list */
- for (i = 0; i < ch_num; i++)
- free(item_name[i]);
-
- print_title("");
+ print_top(NULL, NULL);
clear_main(0);
}
void nwn_wireless()
{
- char *item_name[14];
-
- char oid_dot11SupportedAntenna[][11] = {
- {0x2a, 0x86, 0x48, 0xce, 0x34, 0x04, 0x08, 0x01, 0x02, 0x01, 0x01},
- {0x2a, 0x86, 0x48, 0xce, 0x34, 0x04, 0x08, 0x01, 0x02, 0x01, 0x02},
- {0x2a, 0x86, 0x48, 0xce, 0x34, 0x04, 0x08, 0x01, 0x03, 0x01, 0x01},
- {0x2a, 0x86, 0x48, 0xce, 0x34, 0x04, 0x08, 0x01, 0x03, 0x01, 0x02},
- {0x2a, 0x86, 0x48, 0xce, 0x34, 0x04, 0x08, 0x01, 0x04, 0x01, 0x01},
- {0x2a, 0x86, 0x48, 0xce, 0x34, 0x04, 0x08, 0x01, 0x04, 0x01, 0x02}
- };
-
- char ChannelPref[] =
- { 0x2b, 0x06, 0x01, 0x04, 0x01, 0x87, 0x29, 0x03, 0x01, 0x02, 0x01,
- 0x06, 0x00
- };
- char operChannelID[] =
- { 0x2a, 0x86, 0x48, 0xce, 0x34, 0x04, 0x05, 0x01, 0x01, 0x01 };
- char sysTrapSwitch[] =
- { 0x2B, 0x06, 0x01, 0x02, 0x01, 0x0b, 0x1e, 0x00 };
-
char operESSID[] =
{ 0x2a, 0x86, 0x48, 0xce, 0x34, 0x01, 0x01, 0x01, 0x09, 0x01 };
-
+ char operBasicRates[] =
+ { 0x2a, 0x86, 0x48, 0xce, 0x34, 0x01, 0x01, 0x01, 0x0b, 0x01 };
+ char OpenSystem[] =
+ { 0x2a, 0x86, 0x48, 0xce, 0x34, 0x01, 0x02, 0x01, 0x03, 0x01, 0x01 };
+ char SharedKey[] =
+ { 0x2a, 0x86, 0x48, 0xce, 0x34, 0x01, 0x02, 0x01, 0x03, 0x01, 0x02 };
char operRTSThreshold[] =
{ 0x2a, 0x86, 0x48, 0xce, 0x34, 0x02, 0x01, 0x01, 0x02, 0x01 };
char operFragmentationThreshold[] =
{ 0x2a, 0x86, 0x48, 0xce, 0x34, 0x02, 0x01, 0x01, 0x05, 0x01 };
- char OpenSystem[] =
- { 0x2a, 0x86, 0x48, 0xce, 0x34, 0x01, 0x02, 0x01, 0x03, 0x01,
- 0x01
- };
- char SharedKey[] =
- { 0x2a, 0x86, 0x48, 0xce, 0x34, 0x01, 0x02, 0x01, 0x03, 0x01,
- 0x02
+ char operChannelID[] =
+ { 0x2a, 0x86, 0x48, 0xce, 0x34, 0x04, 0x05, 0x01, 0x01, 0x01 };
+ char oid_dot11SupportedAntenna[][11] = {
+ { 0x2a, 0x86, 0x48, 0xce, 0x34, 0x04, 0x08, 0x01, 0x02, 0x01, 0x01 },
+ { 0x2a, 0x86, 0x48, 0xce, 0x34, 0x04, 0x08, 0x01, 0x02, 0x01, 0x02 },
+ { 0x2a, 0x86, 0x48, 0xce, 0x34, 0x04, 0x08, 0x01, 0x03, 0x01, 0x01 },
+ { 0x2a, 0x86, 0x48, 0xce, 0x34, 0x04, 0x08, 0x01, 0x03, 0x01, 0x02 },
+ { 0x2a, 0x86, 0x48, 0xce, 0x34, 0x04, 0x08, 0x01, 0x04, 0x01, 0x01 },
+ { 0x2a, 0x86, 0x48, 0xce, 0x34, 0x04, 0x08, 0x01, 0x04, 0x01, 0x02 }
};
- char operBasicRates[] =
- { 0x2a, 0x86, 0x48, 0xce, 0x34, 0x01, 0x01, 0x01, 0xb, 0x01 };
- char operAccessPointName[] =
- { 0x2b, 0x06, 0x01, 0x02, 0x01, 0x01, 0x05, 0x00 };
char operAccessPointContact[] =
{ 0x2b, 0x06, 0x01, 0x02, 0x01, 0x01, 0x04, 0x00 };
+ char operAccessPointName[] =
+ { 0x2b, 0x06, 0x01, 0x02, 0x01, 0x01, 0x05, 0x00 };
char operAccessPointLocation[] =
{ 0x2b, 0x06, 0x01, 0x02, 0x01, 0x01, 0x06, 0x00 };
+ char sysTrapSwitch[] =
+ { 0x2b, 0x06, 0x01, 0x02, 0x01, 0x0b, 0x1e, 0x00 };
+ char ChannelPref[] =
+ { 0x2b, 0x06, 0x01, 0x04, 0x01, 0x87, 0x29, 0x03, 0x01, 0x02, 0x01,
+ 0x06, 0x00 };
unsigned short int i, RTSThreshold, FragmentationThreshold,
m_basic_rates = 0, authi;
antenna[6],
channel_pref[2] = { 0, 0 };
extern WINDOW *main_sub;
+ extern rdprops regdom_types[];
+ extern char *channels[];
char *domain, basic_rates[] =
{ 0, 0, 0, 0 }, *ap_name, ap_location[32], ap_contact[32],
m_ap_contact = 0, m_ap_location = 0;
char m_channel = 0, m_essid = 0, m_rts = 0, m_fragment = 0, m_auth =
0, m_ap_name = 0, channel, traps, m_traps = 0;
varbind varbinds[11];
- int c=0, ch_num = 0, first_channel=1, reg_domain=0;
+ int c = 0, reg_domain = 0, rd_idx;
short __rates[4] = { 2, 4, 11, 22};
domain = (char *) calloc(32, 1);
varbinds[7].oid = operAccessPointName;
varbinds[7].len_oid = sizeof(operAccessPointName);
print_help(WAIT_RET);
- if (snmp(varbinds, 8, GET) <= 0) {
+ if (snmp(varbinds, 8, GET) < 8) {
print_helperr(ERR_RET);
goto exit;
}
basic(basic_rates[i]));
mvwaddstr(main_sub, 11+i, 2, message);
}
-
+
reg_domain = get_RegDomain();
- if ((ch_num = ch_list(reg_domain, item_name)) == 0) {
- print_helperr(ERR_RET);
- goto exit;
- }
+ rd_idx = regdom_idx(reg_domain);
- if(reg_domain == 0x31 || reg_domain == 0x32)
- first_channel = 10;
-
for (i = 0; i < 9; i++) {
varbinds[i].len_val = 0;
varbinds[i].type = NULL_VALUE;
varbinds[8].oid = operAccessPointLocation;
varbinds[8].len_oid = sizeof(operAccessPointLocation);
- if (snmp(varbinds, 9, GET) <= 0) {
+ if (snmp(varbinds, 9, GET) < 9) {
print_helperr(ERR_RET);
goto exit;
}
ANTENNA_DV_RIGHT, (antenna[5] == 1) ? ON : OFF);
mvwaddstr(main_sub, 19, 1, message);
- print_title(_("General Options"));
+ print_top(NULL, _("General Options"));
print_help(_
("UIOPTY - antenna; SCANLEDFR1234 - options; W - write conf; Q - quit to menu"));
wrefresh(main_sub);
break;
case 'C':
case 'c':
- channel = menu_choose(0, strlen(CHANNEL), item_name, ch_num)
- + first_channel;
+ channel = menu_choose(0, strlen(CHANNEL),
+#ifndef NO_REG_DOMAIN
+ channels + regdom_types[rd_idx].first_ch - 1,
+ regdom_types[rd_idx].chans) + regdom_types[rd_idx].first_ch;
+#else
+ channels, 14) + 1;
+#endif
sprintf(message, "%02u (%u MHz)", channel, 2407 + 5 * channel);
print_menusel(0, 0, CHANNEL, message);
m_channel = 1;
continue;
case 'F':
case 'f':
- get_value(message, 4, strlen(FRG_TR), 6, INT_STRING, 256, 2346,
+ get_value(message, 4, strlen(FRG_TR), 5, INT_STRING, 256, 2346,
WLAN_HELP);
FragmentationThreshold = atoi(message);
m_fragment = 1;
continue;
case 'R':
case 'r':
- get_value(message, 3, strlen(RTS_TR), 6, INT_STRING, 0, 2347,
+ get_value(message, 3, strlen(RTS_TR), 5, INT_STRING, 0, 2347,
WLAN_HELP);
RTSThreshold = atoi(message);
m_rts = 1;
varbinds[i].type = 0x02;
i++;
}
-
if (m_basic_rates) {
varbinds[i].oid = operBasicRates;
varbinds[i].len_oid = sizeof(operBasicRates);
i++;
}
- print_help(WAIT_SET);
- if (snmp(varbinds, i, SET) <= 0) {
- print_helperr(ERR_SET);
- goto exit;
- }
- i = 0;
+ print_help(WAIT_SET);
+
+ if (snmp(varbinds, i, SET) <= 0) {
+ print_helperr(ERR_SET);
+ goto exit;
+ }
+ i = 0;
if (m_auth) {
m_auth = (authi == 1) ? 2 : 1;
m_basic_rates = (authi == 0) ? 2 : 1;
varbinds[i].type = INT_VALUE;
i++;
}
- print_help(WAIT_SET);
- if (snmp(varbinds, i, SET) <= 0) {
- print_helperr(ERR_SET);
- goto exit;
- }
- i = 0;
+ if (snmp(varbinds, i, SET) <= 0) {
+ print_helperr(ERR_SET);
+ goto exit;
+ }
+
+ i = 0;
if (m_ap_name) {
c = strlen(ap_name);
varbinds[i].oid = operAccessPointName;
varbinds[i].type = STRING_VALUE;
i++;
}
-
if (m_ap_location) {
c = strlen(ap_location);
varbinds[i].oid = operAccessPointLocation;
i++;
}
- print_help(WAIT_SET);
- if (snmp(varbinds, i, SET) <= 0) {
- print_helperr(ERR_SET);
- goto exit;
- }
+ if (snmp(varbinds, i, SET) <= 0) {
+ print_helperr(ERR_SET);
+ goto exit;
+ }
i = 0;
if (m_ap_contact) {
varbinds[i].type = 0x02;
i++;
}
- print_help(WAIT_SET);
- if (snmp(varbinds, i, SET) <= 0) {
- print_helperr(ERR_SET);
- goto exit;
- }
+
+ if (snmp(varbinds, i, SET) <= 0) {
+ print_helperr(ERR_SET);
+ goto exit;
+ }
+
c = 0;
for (i = 0; i < 4; i++)
if (m_antenna[i]) {
varbinds[c].type = INT_VALUE;
c++;
}
- print_help(WAIT_SET);
- if (snmp(varbinds, c, SET) <= 0) {
- print_helperr(ERR_SET);
- goto exit;
- }
+
+ if (snmp(varbinds, c, SET) <= 0) {
+ print_helperr(ERR_SET);
+ goto exit;
+ }
+
c = 0;
for (i = i; i < 6; i++)
if (m_antenna[i]) {
varbinds[c].type = INT_VALUE;
c++;
}
- print_help(WAIT_SET);
- if (snmp(varbinds, c, SET) <= 0) {
- print_helperr(ERR_SET);
- goto exit;
+
+ if (snmp(varbinds, c, SET) <= 0) {
+ print_helperr(ERR_SET);
+ goto exit;
}
+
i = 0;
if (m_essid) {
c = strlen(domain);
varbinds[i].type = 0x04;
i++;
}
- print_help(WAIT_SET);
- if (snmp(varbinds, i, SET) <= 0) {
- print_helperr(ERR_SET);
- goto exit;
- }
+ if (snmp(varbinds, i, SET) <= 0) {
+ print_helperr(ERR_SET);
+ goto exit;
+ }
+
+ wbkgd(main_sub, A_NORMAL);
+ wrefresh(main_sub);
print_help(DONE_SET);
goto exit;
default:
exit:
getch();
quit:
- print_title("");
+ print_top(NULL, NULL);
- /* free memory allocated for channel list */
- for (i = 0; i < ch_num; i++)
- free(item_name[i]);
free(domain);
free(ap_name);
clear_main(0);