📄 intprismioctl.c
字号:
if (intPrismTertApInit( ((AP_PARAMS*) data)->cardType, ((AP_PARAMS*) data)->apName, ((AP_PARAMS*) data)->apChannel, ((AP_PARAMS*) data)->apInterfaceNum, ((AP_PARAMS*) data)->wiredDevName, ((AP_PARAMS*) data)->wiredDevNum) == ERROR) { status = ERROR; } else if (intPrismTertApStart(((AP_PARAMS*)data)->pTertiaryBuffer, ((AP_PARAMS*) data)->numBytes) == ERROR) { status = ERROR; } } else { status = ERROR; } break; case EIOCASTA: status = intPrismApStationAdd(((UINT16*) data)[0], ((UINT16*) data)[1], ((UINT16*) data)[2], (UINT8) ((UINT16*) data)[3]); break; case EIOCDSTA: status = intPrismApStationRemove(((UINT16*) data)[0], ((UINT16*) data)[1], ((UINT16*) data)[2], (UINT8)((UINT16*) data)[3]); break; case EIOCGCHANNEL: /* Get channel used to create IBSS */ if (data == NULL) { WLAN_DEBUG(DEBUG_ERROR, ("intPrismIoctl: NULL data in " "EIOCGCHANNEL\n")); status = ERROR; break; } *(UINT16 *)data = intPrismRIDWordRead (pWlanDev, WLAN_RID_OWN_CHANNEL); break; case EIOCSCHANNEL: /* Set channel used to create IBSS */ /* Verify that the selected channel is valid in the set region */ sysWlanCfgParamGet(WLAN_REGION,(INT32) ®ion); if (( (1 << ((UINT32)data-1)) & region) == 0) { WLAN_DEBUG(DEBUG_ERROR, ("intPrismIoctl: Channel %d is not " "allowed in this regulatory region\n", (INT32)data)); status = ERROR; break; } status = intPrismRIDWordWrite (pWlanDev, WLAN_RID_OWN_CHANNEL, (UINT16)(INT32)data); status |= intPrismReset(pWlanDev); break; case EIOCGWEPTYPE: /* Get WEP type - 64 bit or 128 bit */ if (data == NULL) { WLAN_DEBUG(DEBUG_ERROR, ("intPrismIoctl: NULL data in " "EIOCGWEPTYPE\n")); status = ERROR; break; } if (pWlanDev->keySize == 5) { *(UINT16*)data = 64; } else if (pWlanDev->keySize == 13) { *(UINT16*)data = 128; } else { WLAN_DEBUG(DEBUG_ERROR, ("intPrismManage: BAD keysize in device" " structure (%d)\n", pWlanDev->keySize)); status = ERROR; } break; case EIOCSWEPTYPE: /* Set WEP type - 64 bit or 128 bit */ if ((UINT16)(INT32)data == 64) { pWlanDev->keySize = 5; } else if ((UINT16)(INT32)data == 128) { pWlanDev->keySize = 13; } else { WLAN_DEBUG(DEBUG_ERROR, ("intPrismManage: Invalid WEP type %d.\n" " Valid values are 64, " "128\n", (INT32)data)); status = ERROR; } break; case EIOCGAUTHTYPE: /* Get authentication protocol */ if (data == NULL) { WLAN_DEBUG(DEBUG_ERROR, ("intPrismIoctl: NULL data in " "EIOCGAUTHTYPE\n")); break; } if ((pWlanDev->cardType == WLAN_CARDTYPE_INTERSIL_2) || (pWlanDev->cardType == WLAN_CARDTYPE_INTERSIL_2_5) || (pWlanDev->cardType == WLAN_CARDTYPE_INTERSIL_3) || (pWlanDev->cardType == WLAN_CARDTYPE_3COM)) { auth = intPrismRIDWordRead (pWlanDev, INTERSIL_RID_AUTH_MASK); if (auth == 1) { *(UINT16 *) data = WLAN_AUTHENTICATION_OPEN; } else if (auth == 2) { *(UINT16 *) data = WLAN_AUTHENTICATION_SKEY; } else if (auth == 3) { *(UINT16 *) data = WLAN_AUTHENTICATION_ANY; } else { WLAN_DEBUG(DEBUG_ERROR, ("intPrismManage: Unknown authenti" "cation protocols detected\n")); status = ERROR; } } else { *(UINT16 *)data = WLAN_AUTHENTICATION_OPEN; WLAN_DEBUG(DEBUG_INFO, ("intPrismManage: EIOCGAUTHTYPE only su" "pported on Intersil or 3com-based " "cards\n")); status = ERROR; } break; case EIOCSAUTHTYPE: /* Set authentication protocol */ if ((pWlanDev->cardType == WLAN_CARDTYPE_INTERSIL_2) || (pWlanDev->cardType == WLAN_CARDTYPE_INTERSIL_2_5) || (pWlanDev->cardType == WLAN_CARDTYPE_INTERSIL_3) || (pWlanDev->cardType == WLAN_CARDTYPE_3COM)) { if ((INT32)data == WLAN_AUTHENTICATION_OPEN) { status = intPrismRIDWordWrite(pWlanDev, INTERSIL_RID_AUTH_MASK, 1); } else if ((INT32)data == WLAN_AUTHENTICATION_SKEY) { status = intPrismRIDWordWrite(pWlanDev, INTERSIL_RID_AUTH_MASK, 2); } else if ((INT32)data == WLAN_AUTHENTICATION_ANY) { if (pWlanDev->cardMode == WLAN_CARDMODE_STA) { status = ERROR; WLAN_DEBUG(DEBUG_ERROR,("intPrismManage:WLAN_AUTHTYPE_" "BOTH available only in AP " "mode")); } else { status = intPrismRIDWordWrite(pWlanDev, INTERSIL_RID_AUTH_MASK, 3); } } else { WLAN_DEBUG(DEBUG_ERROR,("intPrismManage:Invalid authentica" "tion type %d. Values are: 1 " "(Open System), 2 (Shared Key)\n", (int)data)); status = ERROR; } } else { WLAN_DEBUG(DEBUG_ERROR,("intPrismManage:EIOCSAUTHTYPE only sup" "ported on Intersil or 3Com-based " "cards\n")); status = ERROR; } break; case EIOCGCONNECTEDBSSID: /* Get connected BSSID */ if (data == NULL) { WLAN_DEBUG(DEBUG_ERROR, ("intPrismIoctl: NULL data in " "EIOCGCONNECTEDBSSID\n")); break; } ltv.type = WLAN_RID_CURRENT_BSSID; if (intPrismLTVRead(pWlanDev, <v) != OK) { WLAN_DEBUG(DEBUG_ERROR, ("intPrismManage: Error reading " "BSSID\n")); status = ERROR; } else { bcopyswap((UINT8 *)<v.data[0], (UINT8 *)data, 6); } break; case EIOCSIBSSMODE: if ((UINT16)(INT32)data == 1) /* IBSS Mode */ { switch(pWlanDev->cardType) { case WLAN_CARDTYPE_WAVELAN: /* There is no change in the WaveLAN card. */ break; case WLAN_CARDTYPE_INTERSIL_2: case WLAN_CARDTYPE_INTERSIL_2_5: case WLAN_CARDTYPE_INTERSIL_3: if (intPrismRIDWordWrite(pWlanDev, WLAN_RID_PORT_TYPE, WLAN_PORT_IBSS) != OK) { WLAN_DEBUG(DEBUG_ERROR, ("intPrismManage: Error " "setting Intersil to " "IBSS\n")); status = ERROR; } break; case WLAN_CARDTYPE_3COM: if (intPrismRIDWordWrite(pWlanDev, WLAN_RID_PORT_TYPE, THREECOM_PORT_IBSS) != OK) { WLAN_DEBUG(DEBUG_ERROR, ("intPrismManage: Error " "setting 3COM to IBSS" "\n")); status = ERROR; } break; default: WLAN_DEBUG(DEBUG_ERROR, ("intPrismManage: Unknown " "cardtype\n")); break; } } else /* ESS Mode */ { switch(pWlanDev->cardType) { case WLAN_CARDTYPE_WAVELAN: /* There is no change in the WaveLAN card. */ break; case WLAN_CARDTYPE_3COM: case WLAN_CARDTYPE_INTERSIL_2: case WLAN_CARDTYPE_INTERSIL_2_5: case WLAN_CARDTYPE_INTERSIL_3: if (intPrismRIDWordWrite(pWlanDev, WLAN_RID_PORT_TYPE, WLAN_PORT_ESS) != OK) { WLAN_DEBUG(DEBUG_ERROR, ("intPrismManage: Error " "setting Intersil to " "IBSS\n")); status = ERROR; } break; default: WLAN_DEBUG(DEBUG_ERROR, ("intPrismManage: Unknown " "cardtype\n")); break; } } intPrismReset(pWlanDev); break; case EIOCGIBSSMODE: if (data == NULL) { WLAN_DEBUG(DEBUG_ERROR, ("intPrismIoctl: NULL data in " "EIOCGIBSSMODE\n")); break; } switch(pWlanDev->cardType) { case WLAN_CARDTYPE_WAVELAN: /* Since there's no change to the port type RID, we use the port status RID to get the status instead*/ if (intPrismRIDWordRead(pWlanDev, WLAN_RID_PORT_STAT) == WLAN_PORTSTAT_CONNECTED_IBSS) { *(UINT16*)data = 1; } else { *(UINT16*)data = 0; } break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -