#define OID_NUM 11
extern WINDOW *main_sub;
+extern char* bridge_modes[6];
+extern int poll_delay;
void atmel_sysinfo()
{
char sysDeviceInfo[] = {
0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x01, 0x01, 0x05, 0x00
};
- /* This one is ATMEL12350 VERNET MIB specific. */
+ char bridgeOperationalMode[] = {
+ 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x1A, 0x01, 0x01, 0x04, 0x01, 0x00
+ };
+ /* This one is ATMEL12350 EZYNET MIB specific. */
char UpTime[] = {
0x2B, 0x06, 0x01, 0x04, 0x01, 0xE0, 0x3E, 0x01, 0x02, 0x09, 0x01, 0x00
};
+char *bridge_modes[6] = {
+ _("Wireless Bridge Point to MultiPoint"),
+ _("Access Point"),
+ _("Access Point client"),
+ _("Wireless Bridge Point to Point"),
+ _("Repeater"),
+ _("unknown")
+};
+
+
char message[200];
int i;
- varbind varbinds[3];
- struct sysDeviceInfo_ATMEL410 str410;
- struct sysDeviceInfo_ATMEL12350 str12350;
+ varbind varbinds[4];
+ struct sysDeviceInfo_128 str128;
+ struct sysDeviceInfo_160 str160;
extern short ap_type, ap_vendorext;
extern int LINES, wait_mode;
extern rdprops regdom_types[];
/*
- * These have to represent used sysDeviceInfo_{ATMEL410,ATMEL12350} members
+ * These have to represent used sysDeviceInfo_{128,160} members
*/
uint32_t ap_sversion;
char *ap_macaddr;
sysDescr[6] = 0x3E;
sysDeviceInfo[5] = 0xE0;
sysDeviceInfo[6] = 0x3E;
+ bridgeOperationalMode[5] = 0xE0;
+ bridgeOperationalMode[6] = 0x3E;
}
print_top(wait_mode == WAIT_TIMEOUT ? POLL_ON : POLL_OFF, SYSINFO);
while (1) {
i = 0;
- varbinds[0].oid = sysDescr;
- varbinds[0].len_oid = sizeof(sysDescr);
- varbinds[0].value = sysDescr;
- varbinds[0].type = NULL_VALUE;
- varbinds[0].len_val = 0;
+ varbinds[i].oid = sysDescr;
+ varbinds[i].len_oid = sizeof(sysDescr);
+ varbinds[i].value = sysDescr;
+ varbinds[i].type = NULL_VALUE;
+ varbinds[i].len_val = 0;
i++;
- varbinds[1].oid = sysDeviceInfo;
- varbinds[1].len_oid = sizeof(sysDeviceInfo);
- varbinds[1].value = sysDeviceInfo;
- varbinds[1].len_val = 0;
- varbinds[1].type = NULL_VALUE;
+ varbinds[i].oid = sysDeviceInfo;
+ varbinds[i].len_oid = sizeof(sysDeviceInfo);
+ varbinds[i].value = sysDeviceInfo;
+ varbinds[i].len_val = 0;
+ varbinds[i].type = NULL_VALUE;
i++;
- if (ap_vendorext == VERNET) {
- varbinds[2].oid = UpTime;
- varbinds[2].len_oid = sizeof(UpTime);
- varbinds[2].value = UpTime;
- varbinds[2].len_val = 0;
- varbinds[2].type = NULL_VALUE;
+ varbinds[i].oid = bridgeOperationalMode;
+ varbinds[i].len_oid = sizeof(bridgeOperationalMode);
+ varbinds[i].value = bridgeOperationalMode;
+ varbinds[i].len_val = 0;
+ varbinds[i].type = NULL_VALUE;
+ i++;
+
+ if (ap_type == ATMEL12350 && ap_vendorext == EZYNET) {
+ varbinds[i].oid = UpTime;
+ varbinds[i].len_oid = sizeof(UpTime);
+ varbinds[i].value = UpTime;
+ varbinds[i].len_val = 0;
+ varbinds[i].type = NULL_VALUE;
i++;
}
if (wait_mode == WAIT_FOREVER)
print_help(WAIT_RET);
- if (snmp(varbinds, i, GET) <= 0) {
+ if (snmp(varbinds, i, GET) < i) {
print_helperr(ERR_RET);
getch();
goto quit;
for (i = 0; i < varbinds[0].len_val && *(varbinds[0].value + i); i++)
mvwaddch(main_sub, 1, i + 1, *(varbinds[0].value + i));
- if (ap_type == ATMEL410) {
- memcpy(&str410, varbinds[1].value,
- sizeof(struct sysDeviceInfo_ATMEL410));
- ap_sversion = str410.StructVersion;
- ap_macaddr = str410.MacAddress;
- ap_regdomain = swap4(str410.RegulatoryDomain);
- ap_prodtype = str410.ProductType;
- ap_oemname = str410.OEMName;
- ap_oemid = str410.OEMID;
- ap_prodname = str410.ProductName;
- ap_hwrev = str410.HardwareRevision;
- } else { /* ATMEL12350 */
- memcpy(&str12350, varbinds[1].value,
- sizeof(struct sysDeviceInfo_ATMEL12350));
- ap_regdomain = str12350.RegulatoryDomain;
- ap_sversion = str12350.StructVersion;
- ap_macaddr = str12350.MacAddress;
- ap_prodtype = str12350.ProductType;
- ap_oemname = str12350.OEMName;
- ap_oemid = str12350.OEMID;
- ap_prodname = str12350.ProductName;
- ap_hwrev = str12350.HardwareRevision;
+ if (varbinds[1].len_val == 92 || varbinds[1].len_val == 128) {
+ memcpy(&str128, varbinds[1].value,
+ sizeof(struct sysDeviceInfo_128));
+ ap_sversion = str128.StructVersion;
+ ap_macaddr = str128.MacAddress;
+ ap_regdomain = swap4(str128.RegulatoryDomain);
+ ap_prodtype = str128.ProductType;
+ ap_oemname = str128.OEMName;
+ ap_oemid = str128.OEMID;
+ ap_prodname = str128.ProductName;
+ ap_hwrev = str128.HardwareRevision;
+ } else { /* varbinds[1].len_val == 160 */
+ memcpy(&str160, varbinds[1].value,
+ sizeof(struct sysDeviceInfo_160));
+ ap_regdomain = str160.RegulatoryDomain;
+ ap_sversion = str160.StructVersion;
+ ap_macaddr = str160.MacAddress;
+ ap_prodtype = str160.ProductType;
+ ap_oemname = str160.OEMName;
+ ap_oemid = str160.OEMID;
+ ap_prodname = str160.ProductName;
+ ap_hwrev = str160.HardwareRevision;
}
+ sprintf(message, _("Operational mode: %s"),
+ bridge_modes[*(varbinds[2].value) - 1]);
+ mvwaddstr(main_sub, 2, 0, message);
+
sprintf(message, "%s%02X%02X%02X%02X%02X%02X", MAC,
ap_macaddr[0] & 0xFF, ap_macaddr[1] & 0xFF,
ap_macaddr[2] & 0xFF, ap_macaddr[3] & 0xFF,
ap_macaddr[4] & 0xFF, ap_macaddr[5] & 0xFF);
- mvwaddstr(main_sub, 2, 0, message);
+ mvwaddstr(main_sub, 3, 0, message);
- mvwaddstr(main_sub, 3, 0, _("Product name:"));
+ mvwaddstr(main_sub, 4, 0, _("Product name: "));
for (i = 0; i < 32 && ap_prodname[i]; i++)
- mvwaddch(main_sub, 3, i + 14, ap_prodname[i]);
+ waddch(main_sub, ap_prodname[i]);
sprintf(message, _("Product type: %u"), swap4(ap_prodtype));
- mvwaddstr(main_sub, 4, 0, message);
+ mvwaddstr(main_sub, 5, 0, message);
- mvwaddstr(main_sub, 5, 0, _("OEM name:"));
+ mvwaddstr(main_sub, 6, 0, _("OEM name: "));
for (i = 0; i < 32 && ap_oemname[i]; i++)
- mvwaddch(main_sub, 5, i + 10, ap_oemname[i]);
+ waddch(main_sub, ap_oemname[i]);
sprintf(message, "OEM ID: %u", swap4(ap_oemid));
- mvwaddstr(main_sub, 6, 0, message);
+ mvwaddstr(main_sub, 7, 0, message);
sprintf(message, _("Hardware revision: %u"), swap4(ap_hwrev));
- mvwaddstr(main_sub, 7, 0, message);
+ mvwaddstr(main_sub, 8, 0, message);
i = regdom_idx(ap_regdomain);
sprintf(message, "Regulatory domain: %s [%d]",
regdom_types[i].desc, ap_regdomain);
- mvwaddstr(main_sub, 8, 0, message);
+ mvwaddstr(main_sub, 9, 0, message);
sprintf(message, _("Info structure version: %u"), swap4(ap_sversion));
- mvwaddstr(main_sub, 9, 0, message);
+ mvwaddstr(main_sub, 10, 0, message);
sprintf(message, _("Manufacturer OUI: %02X %02X %02X (%s)"),
ap_macaddr[0] & 0xFF, ap_macaddr[1] & 0xFF, ap_macaddr[2] & 0xFF,
oui2manufacturer(ap_macaddr));
- mvwaddstr(main_sub, 10, 0, message);
+ mvwaddstr(main_sub, 11, 0, message);
- if (ap_vendorext == VERNET) {
+ if (ap_type == ATMEL12350 && ap_vendorext == EZYNET) {
unsigned int j = 0;
- if (varbinds[2].len_val > 1) {
- for (i = 0; i < varbinds[2].len_val; i++)
- j |= (varbinds[2].value[i]
- << (8 * (varbinds[2].len_val - i - 1)));
+ if (varbinds[3].len_val > 1) {
+ for (i = 0; i < varbinds[3].len_val; i++)
+ j |= (varbinds[3].value[i]
+ << (8 * (varbinds[3].len_val - i - 1)));
} else {
- j = varbinds[2].value[0] & 0x80 ?
- 0xff00 | varbinds[2].value[0] : varbinds[2].value[0];
+ j = varbinds[3].value[0] & 0x80 ?
+ 0xff00 | varbinds[3].value[0] : varbinds[3].value[0];
}
sprintf(message,
_("Uptime: %u days, %02u:%02u:%02u hours:mins:secs"),
j / 60 / 60 / 24, j / 60 / 60 % 24, j / 60 % 60, j % 60);
- mvwaddstr(main_sub, 11, 0, message);
+ mvwaddstr(main_sub, 12, 0, message);
}
wrefresh(main_sub);
- i = wait_key();
+ i = wait_key(poll_delay);
if (i == -1)
goto quit;
if (wait_mode == WAIT_FOREVER)
print_help(WAIT_RET);
- if (snmp(varbinds, OID_NUM - 1, GET) <= 0) {
+ if (snmp(varbinds, OID_NUM - 1, GET) < OID_NUM - 1) {
print_helperr(ERR_RET);
getch();
goto quit;
varbinds[3].type = NULL_VALUE;
varbinds[3].len_val = 0;
- if (snmp(varbinds, 4, GET) <= 0) {
+ if (snmp(varbinds, 4, GET) < 4) {
print_helperr(ERR_RET);
getch();
goto quit;
mvwaddstr(main_sub, 1, 0, message);
wrefresh(main_sub);
- i = wait_key();
+ i = wait_key(poll_delay);
if (i == -1)
goto quit;