⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 intprismmibioctl.c

📁 vworks 下wlan的实现代码
💻 C
📖 第 1 页 / 共 3 页
字号:
/* intPrismMibIoctl.c - Driver specific MIB functionality *//* Copyright 2001-2003 Wind River Systems, Inc. *//*modification history--------------------02r,17sep03,rb  Fixed bug with some portions of delayed reset still present02q,29aug03,rb  Fix for SPR 90210 - MIB walk crashes02p,09may03,rb  Removed warnings caused by IPv6 integration02o,31mar03,rb  Minor fixes to match new MIB02n,26feb03,ss  Fixed diab compiler warnings01o,17may02,rb  Removed debugging code01n,15may02,eja  Got rid of reference to FTP group for access point mode.01m,14may02,eja  Added fix when setting wep key.01l,07may02,rb  Implemented default keys and remaining MIB leafs01k,06may02,eja  Got rid of mib leafs that are not being used and enabled                 setting of default wep keys.01j,06may02,rb  Removed functions from refgen01i,25arp02,rb  Added WEP key support01h,08apr02,ss  Updated to use pWlanDev everywhere01g,04apr02,dxb  Added Prism 3 support.01f,20mar02,dxb  Removed compiler warnings.01e,19mar02,eja  Added fix for setting Mib variables.01d,18mar02,ss  Updated to use WLAN_CARDTYPE_INTERSIL_2 and _2_5 constants01c,12mar02,rb  Debugged station MIB, added delated reset feature to fix                  connectivity problems when setting static RID variables01b,28feb02,rb  Added more support for MIBs01a,28feb01,rb  Created, original data copied from intPrismIocl.c and                        intPrismHostAp.c*//*DESCRIPTIONThis file contains the routines to service MIB requests.  The MIB calls thegeneric IOCTL routine with the commands EIOCSMIB2STA, EIOCSMIBAP, EIOCGMIB2STA,EIOCGMIBAP.  The IOCTL handler (intPrismManage()) passes these calls the theappropriate MIB IOCTL handler, intPrismMibIoctl() SEE ALSOintPrismIoctl.c */#include <vxWorks.h>#include <string.h>#include <cacheLib.h>#include <semLib.h>#include <logLib.h>#include <netLib.h> #include <stdio.h>#include <sysLib.h> #include <memLib.h>#include <iosLib.h>#include <end.h>			/* Common END structures. */#include <endLib.h>#include <etherMultiLib.h>		/* multicast stuff. */#include <intLib.h>#include <taskLib.h>/* Custom header files */#include "wrn/wlan/wlanEnd.h"#include "wrn/wlan/intPrismHw.h"#include "wrn/wlan/snmp802dot11.h"#define VXBOOL_TO_DOT11BOOL(truthVal) (truthVal = ((truthVal == TRUE) ? DOT11_TRUE : DOT11_FALSE))#define DOT11BOOL_TO_VXBOOL(truthVal) (truthVal = ((truthVal == DOT11_TRUE) ? TRUE : FALSE))#define INTERSIL_RID_ENH_SEC         0xfc43/****************************************************************************** NOMANUAL* intPrismMibIoctl - Handles IOCTL calls for the MIB**** RETURNS: OK, EINVAL or ERROR ** ERRNO: N/A*/int intPrismMibIoctl(WLAN_DEV * pWlanDev, int cmd, caddr_t data)    {    INT32 status;    PDOT11_IOCTL_PARAM_T pCmdObj;    INT16 mibGroup;    INT16 mibLeaf;    INT16 temp;    PDOT11_MIB2_T pMib = NULL;    LTV_RECORD ltv;    int i;     if ((pWlanDev == NULL) || (data == NULL))        {        WLAN_DEBUG(DEBUG_ERROR, ("intPrismMibIoctl: NULL parameters!\n"));        return ERROR;        }        if ((cmd != EIOCGMIB2STA) && (cmd != EIOCSMIB2STA))        {        /* Somehow, we got passed an IOCTL call we can't deal with */        WLAN_DEBUG(DEBUG_ERROR, ("intPrismMibIoctl: Unknown cmd = %x\n",                                  cmd));        return ERROR;        }    status = OK;    pCmdObj = (PDOT11_IOCTL_PARAM_T)data;        /* Extract the mib group */    mibGroup = (INT16)(pCmdObj->cmdCall >> 16);    /* Extract the mib leaf */    mibLeaf  = (INT16)pCmdObj->cmdCall;    /* Extract the Station point mib structure */    pMib = (PDOT11_MIB2_T) pCmdObj->pData;        /* Debug message */    WLAN_DEBUG(DEBUG_INFO, ("intPrismMibIoctl: CMD=%x group=%04x leaf=%04x"                            "\n", (UINT32)cmd, mibGroup, mibLeaf));    switch (mibGroup)        {        /* Smt group */        case STATION_CONFIG_ENTRY:            {            /* Set up the variable where we return results, if it's a get, or               get info from if it's a put */            PSTATION_CONFIG_ENTRY_T  pInfo =                 (PSTATION_CONFIG_ENTRY_T) &pMib->dot11Smt.cnfgEntry;                        switch(mibLeaf)                {                case SMT_STATION_ID:                    if (cmd == EIOCGMIB2STA)                        {                        bcopy((char *) pWlanDev->MACAddr,                               (char *) pInfo->dot11StationID,                               WLAN_ENET_ADDR_LEN);                        }                    else /* Must be EIOCSMIB2STA */                        {                        WLAN_DEBUG(DEBUG_ERROR, ("intPrismMibIoctl: Cannot set"                                                 " station MAC addr\n"));                        status = ERROR;                        }                    break;                case SMT_CF_POLLABLE:                               if (cmd == EIOCGMIB2STA)                        {                        ltv.type = WLAN_RID_CF_POLL;                        /* This will probably fail on non-PRISM 2+ cards,                         indicating it's not CFPOLLABLE */                        if (intPrismLTVRead(pWlanDev, &ltv) == ERROR)                                {                                status = ERROR;                                break;                                }                        temp = ltv.data[0];                        VXBOOL_TO_DOT11BOOL(temp);                                                pInfo->dot11CFPollable = temp;                            }                                        else /* Must be a SET */                        {                        status = ERROR;                        }                    break;                case SMT_MEDIUM_OCCUPANCY_LIMIT:                case SMT_CFP_PERIOD:                            case SMT_CFP_MAX_DURATION:                          /* These commands only work for access points and                     pure-PRISM ones at that.  And they're read-only*/                    if ( (pWlanDev->cardMode == WLAN_CARDMODE_STA) ||                          (cmd == EIOCSMIB2STA) ||                          ( (pWlanDev->cardType != WLAN_CARDTYPE_INTERSIL_2) &&                           (pWlanDev->cardType != WLAN_CARDTYPE_INTERSIL_2_5)&&                           (pWlanDev->cardType != WLAN_CARDTYPE_INTERSIL_3)))                        {                        status = ERROR;                        break;                        }                                        ltv.type = INTERSIL_RID_AP_PCF;                    if (intPrismLTVRead(pWlanDev, &ltv) != OK)                        {                        status = ERROR;                        break;                        }                                        pInfo->dot11MediumOccupancyLimit = ltv.data[0];                    pInfo->dot11CFPPeriod = ltv.data[1];                    pInfo->dot11CFPMaxDuration = ltv.data[2];                    break;                case SMT_AUTH_RESP_TOUT:                            if (cmd == EIOCGMIB2STA)                        {                        if ((pWlanDev->cardType == WLAN_CARDTYPE_INTERSIL_2) ||                             (pWlanDev->cardType == WLAN_CARDTYPE_INTERSIL_2_5)||                            (pWlanDev->cardType == WLAN_CARDTYPE_INTERSIL_3))                            {                            ltv.type = INTERSIL_RID_AUTH_RESP_TO;                            status = intPrismLTVRead(pWlanDev, &ltv);                            temp = ltv.data[0];                            }                        else                            {                            temp = 0;                            status = ERROR;                            }                                                pInfo->dot11AuthenticationResponseTimeOut = temp;                        }                    else /* Must be EIOCSMIB2STA */                        {                        if ((pWlanDev->cardType == WLAN_CARDTYPE_INTERSIL_2) ||                             (pWlanDev->cardType == WLAN_CARDTYPE_INTERSIL_2_5)||                            (pWlanDev->cardType == WLAN_CARDTYPE_INTERSIL_3))                            {                            status = intPrismRIDWordWrite(pWlanDev,                                     INTERSIL_RID_AUTH_RESP_TO,                                    pInfo->dot11AuthenticationResponseTimeOut);                            }                        else                            {                            status = ERROR;                            WLAN_DEBUG(DEBUG_ERROR, ("intPrismMIBIoctl: Cannot"                                                     " set AUTHTO for non-Int"                                                     "ersil cards\n"));                            }                        }                    break;                case SMT_PRIV_OPT_IMPL:                             if (cmd == EIOCGMIB2STA)                        {                        status = intPrismIoctl((END_OBJ *)pWlanDev,                                                EIOCGWEPAVAIL, (caddr_t)&temp);                        VXBOOL_TO_DOT11BOOL(temp);                        pInfo->dot11PrivacyOptionImplemented = temp;                        }                    else /* Must be EIOCSMIB2STA */                        {                        /* Read only value */                        WLAN_DEBUG(DEBUG_ERROR, ("intPrismMibIoctl: Privacy opt"                                                 " is a read-only field\n"));                        status = ERROR;                        }                    break;                case SMT_PWR_MGR_MODE:                              if (cmd == EIOCGMIB2STA)                        {                        status = intPrismIoctl((END_OBJ *)pWlanDev, EIOCGPWRMAN,                                               (caddr_t)&temp);                        temp = !(BOOL)temp;                        VXBOOL_TO_DOT11BOOL(temp);                        pInfo->dot11PowerManagementMode = temp;                        }                    else /* Must be EIOCSMIB2STA */                        {                        temp = pInfo->dot11PowerManagementMode;                        DOT11BOOL_TO_VXBOOL(temp);                        temp = !(BOOL)temp;                        status = intPrismIoctl((END_OBJ *)pWlanDev, EIOCSPWRMAN,                                               (caddr_t)(INT32)temp);                        }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -