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

📄 intprismioctl.c

📁 vworks 下wlan的实现代码
💻 C
📖 第 1 页 / 共 5 页
字号:
                    case WLAN_CARDTYPE_INTERSIL_2:                    case WLAN_CARDTYPE_INTERSIL_2_5:                    case WLAN_CARDTYPE_INTERSIL_3:                        if (intPrismRIDWordRead(pWlanDev, WLAN_RID_PORT_TYPE) ==                                              WLAN_PORT_IBSS)                            {                            *(UINT16*)data = 1;                            }                        else                            {                            *(UINT16*)data = 0;                            }                        break;                    case WLAN_CARDTYPE_3COM:                        if (intPrismRIDWordRead(pWlanDev, WLAN_RID_PORT_TYPE) ==                                             THREECOM_PORT_IBSS)                            {                            *(UINT16*)data = 1;                            }                        else                            {                            *(UINT16*)data = 0;                            }                        break;                    default:                        WLAN_DEBUG(DEBUG_ERROR, ("intPrismManage: Unknown "                                                 "cardtype\n"));                        break;                    }                break;                        case EIOCSAUTHCALLBACK:        /* Register authentication callback */            WLAN_DEBUG(DEBUG_INFO, ("intPrismIoctl: Setting auth. callback "                                    " to %08x\n", (UINT32)data));            pWlanDev->pAuthCallback = (FUNCPTR)data;            break;                    case EIOCS802DOT1XMODE:        /* Set 802.1x mode */            if (pWlanDev->cardType == WLAN_CARDTYPE_WAVELAN)                {                WLAN_DEBUG(DEBUG_ERROR, ("intPrismIoctl: 802.1x mode not "                                         "support on Lucent Wavelan\n"));                break;                }            WLAN_DEBUG(DEBUG_INFO, ("intPrismIoctl: 802.1x mode %s\n",                                    ((UINT16)(UINT32)data == 0)?"OFF":"ON"));                        if ((UINT16)(UINT32)data == 0)                {                /* Check if WEP is enabled */                if ((intPrismRIDWordRead(pWlanDev,                                          INTERSIL_RID_WEP_FLAGS) & 0x01) == 0x01)                    {                    /* WEP is still enabled, go to normal WEP mode. */                    intPrismRIDWordWrite(pWlanDev, INTERSIL_RID_WEP_FLAGS,                                          0x0003);                    }                pWlanDev->oneXMode = ONEX_MODE_DISABLED;                }            else                {                 /* Check if WEP is enabled */                if ((intPrismRIDWordRead(pWlanDev,                                          INTERSIL_RID_WEP_FLAGS) & 0x01) != 0x01)                   {                    WLAN_DEBUG(DEBUG_ERROR, ("intPrismIoctl: 802.1x mode "                                             "cannot be enabled unless WEP "                                             "is enabled\n"));                    status = ERROR;                    break;                    }                                /* Set the Encryption on bit (bit 0) but do not set the                 "deny non-encryted" bit (bit 1) */                intPrismRIDWordWrite(pWlanDev, INTERSIL_RID_WEP_FLAGS, 0x0001);                pWlanDev->oneXMode = ONEX_MODE_ENABLED;                }                        break;        case EIOCG802DOT1XMODE:        /* Get 802.1x mode status */            WLAN_DEBUG(DEBUG_INFO, ("intPrismIoctl: 802.1x mode %s\n",                                    (pWlanDev->oneXMode == 0)?"OFF":"ON"));            if (data == NULL)                {                WLAN_DEBUG(DEBUG_ERROR, ("intPrismIoctl: NULL data to "                                          "EIOCG802DOT1XMODE\n"));                status = ERROR;                break;                }            *(UINT16*)data = pWlanDev->oneXMode;            break;        case EIOCSBEACONRATE:            if ( (pWlanDev->cardType != WLAN_CARDTYPE_INTERSIL_2) &&                 (pWlanDev->cardType != WLAN_CARDTYPE_INTERSIL_2_5) &&                 (pWlanDev->cardType != WLAN_CARDTYPE_INTERSIL_3))                {                WLAN_DEBUG(DEBUG_ERROR, ("intPrismIoctl: BEACONRATE only valid "                                         "for Intersil cards\n"));                status = ERROR;                break;                }            WLAN_DEBUG(DEBUG_INFO, ("intPrismIoctl: Setting beacon rate "                                    "to %d\n", (INT32)data));            status = intPrismRIDWordWrite((WLAN_DEV *)pWlanDev,                                          INTERSIL_RID_BEACON_INT,                                          (INT32)data);            status |= intPrismReset((WLAN_DEV *)pWlanDev);            break;        case EIOCGBEACONRATE:            if (data == NULL)                {                WLAN_DEBUG(DEBUG_ERROR, ("intPrismIoctl: NULL <data> in"                                         " EIOCGBEACONRATE\n"));                status = ERROR;                }            else                {                if ( (pWlanDev->cardType != WLAN_CARDTYPE_INTERSIL_2) &&                     (pWlanDev->cardType != WLAN_CARDTYPE_INTERSIL_2_5) &&                     (pWlanDev->cardType != WLAN_CARDTYPE_INTERSIL_3))                    {                    WLAN_DEBUG(DEBUG_ERROR, ("intPrismIoctl: BEACONRATE only val"                                             "id for Intersil cards\n"));                    status = ERROR;                    break;                    }                *(INT16 *)data = intPrismRIDWordRead((WLAN_DEV *)pWlanDev,                                                      INTERSIL_RID_BEACON_INT);                }            break;        case EIOCGMIBAP:        case EIOCSMIBAP:        case EIOCGMIB2STA:        case EIOCSMIB2STA:            status = intPrismMibIoctl(pWlanDev, cmd, data);             break;        case EIOCSCTSRTS:           /* Set CTS/RTS */            WLAN_DEBUG(DEBUG_INFO, ("intPrismIoctl: Setting CTS/RTS threshold "                                    "to %d\n", (INT32)data));            status = intPrismRIDWordWrite((WLAN_DEV *)pWlanDev,                                          WLAN_RID_RTS_THRESH,                                          (INT32)data);            /* This is a "dynamic" configuration parameter, so a reset is not            required */            break;        case EIOCGCTSRTS:           /* Get CTS/RTS */            if (data == NULL)                {                WLAN_DEBUG(DEBUG_ERROR, ("intPrismIoctl: NULL <data> in"                                        " EIOCGRTSCTS\n"));                status = ERROR;                }            else                {                *(INT16 *)data = intPrismRIDWordRead((WLAN_DEV *)pWlanDev,                                                      WLAN_RID_RTS_THRESH);                }            break;        case EIOCSFRAGTHRESH:       /* Set Fragmentation threshold */            WLAN_DEBUG(DEBUG_INFO, ("intPrismIoctl: Setting fragmentation "                                    "threshold to %d\n", (INT32)data));            status = intPrismRIDWordWrite((WLAN_DEV *)pWlanDev,                                          WLAN_RID_FRAG_THRESH,                                          (INT32)data);            /* This is a "dynamic" configuration parameter, so a reset is not            required */            break;        case EIOCGFRAGTHRESH:       /* Get Fragmentation threshold */            if (data == NULL)                {                WLAN_DEBUG(DEBUG_ERROR, ("intPrismIoctl: NULL <data> in"                                        " EIOCGFRAGTHRESH\n"));                status = ERROR;                }            else                {                *(INT16 *)data = intPrismRIDWordRead((WLAN_DEV *)pWlanDev,                                                      WLAN_RID_FRAG_THRESH);                }            break;        case EIOCSPREAMBLE:         /* Set preamble length */            if ( (pWlanDev->cardType != WLAN_CARDTYPE_INTERSIL_2) &&                 (pWlanDev->cardType != WLAN_CARDTYPE_INTERSIL_2_5) &&                 (pWlanDev->cardType != WLAN_CARDTYPE_INTERSIL_3))                {                WLAN_DEBUG(DEBUG_ERROR, ("intPrismIoctl: SPREAMBLE only valid "                                         "for Intersil cards\n"));                status = ERROR;                break;                }            WLAN_DEBUG(DEBUG_INFO, ("intPrismIoctl: Setting preamble  "                                    "to %04x\n", (INT32)data));            status = intPrismRIDWordWrite((WLAN_DEV *)pWlanDev,                                          INTERSIL_RID_PREAMBLE,                                          (INT32)data);            status |= intPrismReset((WLAN_DEV *)pWlanDev);            break;        case EIOCGPREAMBLE:         /* Get preamble length */            if (data == NULL)                {                WLAN_DEBUG(DEBUG_ERROR, ("intPrismIoctl: NULL <data> in"                                         " EIOCGPREAMBLE\n"));                status = ERROR;                }            else                {                if ( (pWlanDev->cardType != WLAN_CARDTYPE_INTERSIL_2) &&                     (pWlanDev->cardType != WLAN_CARDTYPE_INTERSIL_2_5) &&                     (pWlanDev->cardType != WLAN_CARDTYPE_INTERSIL_3))                    {                    WLAN_DEBUG(DEBUG_ERROR, ("intPrismIoctl: PREAMBLE only val"                                             "id for Intersil cards\n"));                    status = ERROR;                    break;                    }                *(UINT16 *)data = intPrismRIDWordRead((WLAN_DEV *)pWlanDev,                                                      INTERSIL_RID_PREAMBLE);                }            break;        case EIOCSAUTHRESPTO:       /* Set Authentication response timeout */            if ( (pWlanDev->cardType != WLAN_CARDTYPE_INTERSIL_2) &&                 (pWlanDev->cardType != WLAN_CARDTYPE_INTERSIL_2_5) &&                 (pWlanDev->cardType != WLAN_CARDTYPE_INTERSIL_3))                {                WLAN_DEBUG(DEBUG_ERROR, ("intPrismIoctl: SAUTHRESPTO only "                                         "valid for Intersil cards\n"));                status = ERROR;                break;                }            WLAN_DEBUG(DEBUG_INFO, ("intPrismIoctl: Setting authrespto  "                                    "to %04x\n", (INT32)data));            status = intPrismRIDWordWrite((WLAN_DEV *)pWlanDev,                                          INTERSIL_RID_AUTH_RESP_TO,                                          (INT32)data);            status |= intPrismReset((WLAN_DEV *)pWlanDev);            break;        case EIOCGAUTHRESPTO:       /* Get Authentication response timeout */            if (data == NULL)                {                WLAN_DEBUG(DEBUG_ERROR, ("intPrismIoctl: NULL <data> in"                                         " EIOCGAUTHRESPTO\n"));                status = ERROR;                }            else                {                if ( (pWlanDev->cardType != WLAN_CARDTYPE_INTERSIL_2) &&                     (pWlanDev->cardType != WLAN_CARDTYPE_INTERSIL_2_5) &&                     (pWlanDev->cardType != WLAN_CARDTYPE_INTERSIL_3))                    {                    WLAN_DEBUG(DEBUG_ERROR, ("intPrismIoctl: AUTHRESPTO only"                                             " valid for Intersil cards\n"));                    status = ERROR;                    break;                    }                *(UINT16 *)data = intPrismRIDWordRead((WLAN_DEV *)pWlanDev,                                                  INTERSIL_RID_AUTH_RESP_TO);                }            break;        case EIOCSMULTICASTKEYNUM:    /* Set multicast key slot */            pWlanDev->broadcastKey = ((UINT16)(UINT32)data & 0x0003);            break;        case EIOCGMULTICASTKEYNUM:    /* Get multicast key slot */            if (data == NULL)                {                WLAN_DEBUG(DEBUG_ERROR, ("intPrismIoctl: NULL <data> in"                                         " EIOCGMULTICASTKEYNUM\n"));                status = ERROR;                }            else                {                *(UINT16 *)data = pWlanDev->broadcastKey;                }            break;        case EIOCSUNICASTKEYNUM:  /* Set unicast key slot */            pWlanDev->defaultKey = (UINT16)(UINT32)data;            switch(pWlanDev->cardType)                {                case WLAN_CARDTYPE_WAVELAN:                    status = intPrismRIDWordWrite(pWlanDev,                                                   WVLAN_RID_TX_CRYPT_KEY,                                                  (UINT16)(INT32)data);                    break;                case WLAN_CARDTYPE_INTERSIL_2:                case WLAN_CARDTYPE_INTERSIL_2_5:                case WLAN_CARDTYPE_INTERSIL_3:                case WLAN_CARDTYPE_3COM:                    status = intPrismRIDWordWrite(pWlanDev,                                               INTERSIL_RID_WEP_DEFAULT_KEY_ID,                                               (UINT16)(INT32)data);                    break;                default:                    WLAN_DEBUG(DEBUG_ERROR, ("EIOCSUNICASTKEYNUM: Unknown card"                                             " type\n"));                    break;                }            if (pWlanDev->oneXMode != ONEX_MODE_ENABLED)                {                status |= intPrismReset(pWlanDev);                }            break;        case EIOCGUNICASTKEYNUM:  /* Get unicast key slot */            if (data == NULL)         

⌨️ 快捷键说明

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