📄 cisaironetshow.c
字号:
/* cisAironetShow.c - Show routines for the Cisco Aironet 340/350 WLAN card *//* Copyright 2001-2003 Wind River Systems, Inc. *//*modification history--------------------01n,08may03,rb Made cisAironetShowInit NOMANUAL01m,26feb03,ss Fixed diab compiler warnings01l,09may02,dxb Removed CIS_AIRONET_SLEEP and CIS_AIRONET_WAKEUP.01k,05may02,dxb Updated header comments.01j,23apr02,eja Added support to fix Tlb error on Mips and display the current Association Status from the status Rid.01i,22apr02,dxb Endian fixes to cisAironetShow.01h,15apr02,dxb Added bad WEP key warning message to cisAironetShow().01g,08apr02,dxb Updated capabilities RID show routine.01f,08apr02,eja code clean up for FCS.01e,08mar02,eja Added new power save macro.01d,14feb02,eja Got rid of references to DOT11.01c,04feb02,eja Changed stats from 16 bit to 32 bit to adher to ieee 802.11 spec.01b,22nov01,eja Added show init routine.01a,07nov01,eja Fix header path error.*//*DESCRIPTIONThis module provides the diagnostic show routines for the Cisco Aironet340/350 wireless 802.11b driver. These show routines are included by default in the vxWorks image with the INCLUDE_AIRONET_SHOW macro inconfigWlan.h. INCLUDE FILES: cisAironet.h, wlanEnd.hSEE ALSO: cisAironetHw,c, cisAironetShow.c, configWlan.h*/#include <vxWorks.h>#include <ioLib.h>#include <stdio.h>#include <logLib.h>#include "wrn/wlan/cisAironet.h"#include "wrn/wlan/wlanEnd.h"/**************************************************************************** NOMANUAL* cisAironetShowInit - Initializes the show routines.* * RETURNS : OK** ERRNO : N/A** SEE ALSO: Cisco Aironet 340/350 Driver Programmer's Manual*/STATUS cisAironetShowInit (void) { return (OK); }/**************************************************************************** cisAironetShow - Displays overall card status/config information.* * Displays overall card status/config information.** RETURNS : OK if successful or ERROR on NULL pointer passed as parameter.** ERRNO : N/A** SEE ALSO: Cisco Aironet 340/350 Driver Programmer's Manual*/STATUS cisAironetShow (void) { CAP_RID_T cap; CAP_RID_T * pCap = (CAP_RID_T *) ∩ /* capabilities RID */ CARD_CTRL_T * pDriver = (CARD_CTRL_T *) cisAironetHwDrvIDGet (); char bssName[WLAN_BSS_NAME_MAX]; UINT16 signal; UINT16 wepStatus; UINT16 ibssMode; UINT16 authType; UINT16 txRate; UINT16 linkStat; UINT16 powerMode; BOOL driverInstance = FALSE; char manufacturer[32]; char product[16]; char version[8]; /* sanity check */ if (pDriver == NULL) { ANET_DEBUG(DEBUG_ERROR, ("cisAironetShow: error - " "Cisco Aironet device may not be installed\n")); return (ERROR); } /* Init the driver instance */ driverInstance = TRUE; /* output the status of one or more available Cisco 340/350 cards */ while (driverInstance == TRUE) { /* Read the Capabilities RID */ if ( cisAironetHwRidCapGet (pDriver, (void *) pCap) == ERROR ) { ANET_DEBUG(DEBUG_ERROR, ("cisAironetShow: Error reading CAP RID\n")); return (ERROR); } /* Get manufacturer, model and version info */ cisAironetBcopy (pDriver, (const UINT8 *) pCap->manName, (UINT8 *) manufacturer, NELEMENTS(pCap->manName)); cisAironetBcopy (pDriver, (const UINT8 *) pCap->prodName, (UINT8 *) product, NELEMENTS(pCap->prodName)); cisAironetBcopy (pDriver, (const UINT8 *) pCap->prodVer, (UINT8 *) version, NELEMENTS(pCap->prodVer)); printf("\n%s%d status:\n", ANET_IFNAME, pDriver->unitNum); printf(" CardType = %s %s\n", manufacturer, product); printf(" Station Firmware Version : %s\n", version); printf(" IntMask = 0x%04x\n", pDriver->intMask); printf(" Card mode = "); /* Determine if in BSS or IBSS mode */ cisAironetHwIoctlExt(pDriver, EIOCGIBSSMODE, (caddr_t)&ibssMode); /* Get desired SSID */ cisAironetHwIoctlExt(pDriver, EIOCGDESIREDSSID, (caddr_t)&bssName); if (ibssMode == 1) { printf(" Wireless Station, IBSS Mode\n"); printf(" Desired SSID = \"%s\"\n", bssName); } else { printf(" Wireless Station, ESS Mode\n"); printf(" Desired SSID: \"%s\"\n", bssName); } /* Get connected SSID */ cisAironetHwIoctlExt(pDriver, EIOCGCONNECTEDSSID, (caddr_t)bssName); printf(" Connected SSID: \"%s\"\n", bssName); /* Get WEP status */ cisAironetHwIoctlExt(pDriver, EIOCGWEPSTATUS, (caddr_t)&wepStatus); if (wepStatus == TRUE) { printf(" WEP Enabled\n"); } else { cisAironetHwIoctlExt(pDriver, EIOCGWEPAVAIL, (caddr_t)&wepStatus); if (wepStatus == TRUE) { printf(" WEP is available but disabled\n"); } else { printf(" WEP is not available\n"); } }#if 0 /* optional 802.1X features - to be implemented if desired */ /* Get 802.1X configuration */ if (pDriver->oneXMode == ONEX_MODE_ENABLED) { printf(" 802.1x Mode enabled\n"); } /* Get 802.1X authentication callback location */ if (pDriver->pAuthCallback != NULL) { printf(" Authentication callback registered at 0x%08x\n", (UINT32)pDriver->pAuthCallback); }#endif /* Get authentication mode */ cisAironetHwIoctlExt(pDriver, EIOCGAUTHTYPE, (caddr_t)&authType); if (authType != WLAN_AUTHENTICATION_ANY) { printf(" %s authentication\n", (authType == WLAN_AUTHENTICATION_OPEN)?"Open system": "Shared Key"); } else { printf(" Both Open System and Shared Key authentication\n"); } /* Get link status */ cisAironetHwIoctlExt(pDriver, EIOCGLINKSTAT, (caddr_t)&linkStat); printf(" Link status: "); switch (linkStat) { case 2: printf("Searching for initial connection\n"); break; case 3: printf("Connected to IBSS\n"); break; case 4: printf("Connected to ESS\n"); break; default: printf("0x%x\n", linkStat); break; } /* Get signal level */ cisAironetHwIoctlExt(pDriver, EIOCGCOMMQUAL, (caddr_t)&signal); printf(" Signal strength = %d\n", signal); /* Get current Tx rate */ cisAironetHwIoctlExt(pDriver, EIOCGTXRATE, (caddr_t)&txRate); printf(" Last TX rate = "); if (txRate == WLAN_1_MBIT) { printf("1 Mbits/s\n"); } else if (txRate == WLAN_2_MBIT) { printf("2 Mbits/s\n"); } else if (txRate == WLAN_5_MBIT) { printf("5.5 Mbits/s\n"); } else if (txRate == WLAN_11_MBIT) { printf("11 Mbits/s\n"); } else { printf("Unknown\n"); } /* Get power mode */ cisAironetHwIoctlExt(pDriver, EIOCGPWRMAN, (caddr_t)&powerMode); if (powerMode == WLAN_PMANAGE_ENABLED) { printf(" Power Management Status: Enabled\n"); } else { printf(" Power Management Status: Disabled\n"); } /* Get tx/rx statistics */ cisAironetHwIoctlExt(pDriver, EIOCGSTATS, (caddr_t)NULL); printf(" **************************************************" "*****\n"); printf(" Rx " " Tx\n"); printf(" Unicast Frames %8d %8d\n", pDriver->stats.RxUnicastFrames, pDriver->stats.TxUnicastFrames); printf(" Multicast Frames %8d %8d\n", pDriver->stats.RxMulticastFrames, pDriver->stats.TxMulticastFrames); printf(" Fragments %8d %8d\n", pDriver->stats.RxFragments, pDriver->stats.TxFragments); printf(" Unicast Octets\n"); /* Octet stats not available */ printf(" Multicast Octets\n"); /* Octet stats not available */ printf(" Deferred Transmissions %8d\n", pDriver->stats.TxDeferredTransmissions); printf(" Single Retry Frames %8d\n", pDriver->stats.TxSingleRetryFrames); printf(" Multiple Retry Frames %8d\n", pDriver->stats.TxMultipleRetryFrames); printf(" Retry limit exceeded %8d\n", pDriver->stats.TxRetryLimitExceeded); printf(" Discards %8d\n", pDriver->stats.TxDiscards); printf(" FCS Errors %8d \n", pDriver->stats.RxFCSErrors); printf(" Discards: No Buffer %8d \n", pDriver->stats.RxDiscardsNoBuffer); printf(" Discards: Wrong SA %8d\n", pDriver->stats.TxDiscardsWrongSA); printf(" Discards: Bad WEP Key %8d \n", pDriver->stats.RxDiscardsWEPUndecryptable); printf(" Message IN\n"); /* Message stats not available */ printf(" Message IN BAD\n"); /* Message stats not available */ /* print warning message if bad WEP key packets > 10 */ if (pDriver->stats.RxDiscardsWEPUndecryptable > 10) { printf(" Note: A high number of 'Bad WEP key' packets\n"); printf(" have been observed. If you are experiencing\n"); printf(" connectivity problems, you may have an invalid\n"); printf(" WEP key for the current wireless network.\n"); printf(" Please check your network settings.\n"); } /* print warning message if wrong SA packets are used */ if (pDriver->stats.TxDiscardsWrongSA > 0) { printf(" Warning: 'Wrong SA (Source Address) Discards'\n"); printf(" detected. These are generated when a STA tries\n"); printf(" to send a packet with a source address that is\n"); printf(" not that of the STA. If this functionality is\n"); printf(" required, you must use Access Point mode.\n"); } printf(" **************************************************" "*****\n"); /* Advance to next card struct */ if (pDriver->pNext == NULL) { driverInstance = FALSE; } else { pDriver = pDriver->pNext; } } /* return - status */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -