📄 dot11test.c
字号:
* ERRNO: N/A*/STATUS dot11SSIDHide ( int ifNum, /* Interface number, ie. the '0' in wls0 */ UINT32 ssidFeatures ) { return dot11TestIoctl(ifNum, WIOCSADVSECURITY, (caddr_t)ssidFeatures); }/****************************************************************************** dot11ScanTypeSet - Sets the currently allowed scan types** This sets the types of scans allowed under normal operation. Specifying * passive scans may be necessary in some regulatory domains, but should not* be used unless necessary, since it will increase network search times by* 10x.* * The available options are the logical OR of:* DOT11_SCANTYPE_ACTIVE _BIT(0)* DOT11_SCANTYPE_PASSIVE _BIT(1)** RETURNS: OK or ERROR** ERRNO: N/A*/STATUS dot11ScanTypeSet ( int ifNum, /* Interface number, ie. the '0' in wls0 */ UINT32 scanType ) { return dot11TestIoctl(ifNum, WIOCSSCANTYPE, (caddr_t)scanType); }/****************************************************************************** dot11ScanTypeGet - Gets the currently allowed scan types** This retrieves the currently set scan type and prints it to the console.** RETURNS: OK or ERROR** ERRNO: N/A*/STATUS dot11ScanTypeGet ( int ifNum /* Interface number, ie. the '0' in wls0 */ ) { UINT32 scanType; if (dot11TestIoctl(ifNum, WIOCGSCANTYPE, (caddr_t)&scanType) != OK) { return ERROR; } printf("Allowed scan types: "); if ((scanType & DOT11_SCANTYPE_ACTIVE) != 0) { printf("ACTIVE "); } if ((scanType & DOT11_SCANTYPE_PASSIVE) != 0) { printf("PASSIVE "); } return OK; }/****************************************************************************** dot11BssSet - Sets the current BSS** This IOCTL sets the current BSS under configuration. This is not * permitted in ESS or IBSS modes.** RETURNS: OK or ERROR** ERRNO: N/A*/STATUS dot11BssSet ( int ifNum, /* Interface number, ie. the '0' in wls0 */ int bssNum ) { return dot11TestIoctl(ifNum, WIOCSBSS, (caddr_t)bssNum); }/****************************************************************************** dot11BssGet - Gets the current BSS** This IOCTL gets the current BSS under configuration. This is not * permitted in ESS or IBSS modes.** RETURNS: ERROR, or the current BSS number (>0)** ERRNO: N/A*/INT32 dot11BssGet ( int ifNum /* Interface number, ie. the '0' in wls0 */ ) { STATUS status; INT32 bssNum = ERROR; status = dot11TestIoctl(ifNum, WIOCGBSS, (caddr_t)&bssNum); if (status == OK) { return bssNum; } else { return status; } }/****************************************************************************** dot11BssAdd - Creates a new BSS** This function creates a new BSS for use with AP mode. Each BSS has a SSID* (usually unique, but not necessarily). The BSS is set to a default * configuration. The number of the new BSS is returned in <data>, which is* a pointer to a UINT32.** RETURNS: OK or ERROR** ERRNO: N/A*/STATUS dot11BssAdd ( int ifNum /* Interface number, ie. the '0' in wls0 */ ) { int bssNum; if (dot11TestIoctl(ifNum, WIOCABSS, (caddr_t)&bssNum) == OK) { return OK; } else { printf("dot11BSSSet: Cannot create new BSS\n"); return ERROR; } }/****************************************************************************** dot11BssAddrBitsSet - Set the offset of the BSS address bits** Sets the place in the MAC address where the BSS address will be inserted. * The BSS number is added to the BSSID starting at a user configurable bit.* For example, for a maximum of four BSSs, two bits are needed and the * default setting of 3 applies the changes to bits 3&4 of the MAC Address. * Thus, if the MAC address of the wireless interface is 00:04:12:3e:60:0f* BSS Number BSSID* BSS0 00:04:12:3e:60:0f* BSS1 06:04:12:3e:60:0f* BSS2 0a:04:12:3e:60:0f* BSS3 0e:04:12:3e:60:0f** RETURNS: OK or ERROR** ERRNO: N/A*/STATUS dot11BssAddrBitsSet ( int ifNum, /* Interface number, ie. the '0' in wls0 */ int bitOffset /* Offset of the mSSID bits in BSSID */ ) { return dot11TestIoctl(ifNum, WIOCSMBSSADDRBITS, (caddr_t)bitOffset); }/****************************************************************************** dot11VlanSet - Sets the current status of VLAN tagging for the device.** This IOCTL enables VLAN support in the driver. If this setting is * disabled, the driver will not be able to understand tagged VLAN packets * and will not add tags to egress packets. ** RETURNS: OK or ERROR** ERRNO: N/A*/STATUS dot11VlanSet ( int ifNum, /* Interface number, ie. the '0' in wls0 */ BOOL vlanStatus /* TRUE to turn on VLAN tagging */ ) { return dot11TestIoctl(ifNum, WIOCSVLAN, (caddr_t)vlanStatus); }/****************************************************************************** dot11VlanAdd - Adds a VLAN to the current BSS** This routines calls the standard END IOCTL that establishes a VLAN * association with the BSS. When used with other END drivers, this IOCTL* will continually add new VLAN associations to the interface until removed * by EIOCVLANLEAVE. The wireless driver, since only one VLAN can exist, * will return ERROR on subsequent calls until EIOCVLANFLUSH or EIOCVLANLEAVE* is called. ** RETURNS: OK or ERROR** ERRNO: N/A*/STATUS dot11VlanAdd ( int ifNum, /* Interface number, ie. the '0' in wls0 */ UINT16 vlan /* TRUE to turn on VLAN tagging */ ) { return dot11TestIoctl(ifNum, EIOCVLANJOIN, (caddr_t)(UINT32)vlan); }/****************************************************************************** dot11VlanDel - Deletes a VLAN from the current BSS** Deletes a VLAN from the current BSS** RETURNS: OK or ERROR** ERRNO: N/A*/STATUS dot11VlanDel ( int ifNum, /* Interface number, ie. the '0' in wls0 */ UINT16 vlan /* TRUE to turn on VLAN tagging */ ) { return dot11TestIoctl(ifNum, EIOCVLANLEAVE, (caddr_t)(UINT32)vlan); }/****************************************************************************** dot11VlanFlush - Deletes all VLANs from the current BSS** This IOCTL leaves all VLANs connected to the interface. In a wireless * driver supporting mSSIDs, it removes all VLANs connected to the current* BSS. It does not take any parameters** RETURNS: OK or ERROR** ERRNO: N/A*/STATUS dot11VlanFlush ( int ifNum /* Interface number, ie. the '0' in wls0 */ ) { return dot11TestIoctl(ifNum, EIOCVLANFLUSH, (caddr_t)NULL); }/****************************************************************************** dot11VlanGet - Returns the current VLAN for the current BSS** This function returns the current VLAN tag assigned to the current BSS. * It will return ERROR if the current BSS is not VLAN enabled.** RETURNS: ERROR or vlanTag** ERRNO: N/A*/INT32 dot11VlanGet ( int ifNum /* Interface number, ie. the '0' in wls0 */ ) { END_VLAN_REQ vlanReq; UINT16 vlan; STATUS status; vlanReq.vlanTagCount = 1; vlanReq.pVlanTagData = &vlan; status = dot11TestIoctl(ifNum, EIOCVLANGET, (caddr_t)&vlanReq); if (status == OK) { printf("Current VLAN = %d\n", vlan); return vlan; } return status; }/****************************************************************************** dot11AclSet - Sets the ACL mode of the AP** This IOCTL, which is only available in AP mode, sets the current ACL mode.* The mode is retained through mode changes. Valid modes are:** DOT11_ACL_DISABLED 0 No ACL* DOT11_ACL_ALLOW 1 ACL specifies allowed stations* DOT11_ACL_DENY 2 ACL specified station NOT allowed** RETURNS: OK or ERROR** ERRNO: N/A*/INT32 dot11AclSet ( int ifNum, /* Interface number, ie. the '0' in wls0 */ int aclMode /* ACL mode */ ) { return dot11TestIoctl(ifNum, WIOCSACLMODE, (caddr_t)aclMode); }/****************************************************************************** dot11AclAdd - Adds an entry to the Access Control List** This function adds a station to the Access Control List. Note that this* setting will not remain when AP mode is exited, and cannot be applied* unless you are in AP mode.** RETURNS: OK or ERROR** ERRNO: N/A*/INT32 dot11AclAdd ( int ifNum, /* Interface number, ie. the '0' in wls0 */ UINT8 * macAddr /* Station to add to ACL */ ) { return dot11TestIoctl(ifNum, WIOCAACLSTA, (caddr_t)macAddr); }/****************************************************************************** dot11AclDel - Removes an entry from the Access Control List** This function removes the specified station from the access control list. ** RETURNS: OK or ERROR** ERRNO: N/A*/INT32 dot11AclDel ( int ifNum, /* Interface number, ie. the '0' in wls0 */ UINT8 * macAddr /* Station to remove from ACL */ ) { return dot11TestIoctl(ifNum, WIOCDACLSTA, (caddr_t)macAddr); }/****************************************************************************** dot11WepKeyMapAdd - Adds an entry to the WEP key mapping table** This function adds an entry to the WEP key mapping table. Note that this* setting will not be preserved if the current mode is exited.** Key type should be either DOT11_KEY_TYPE_WEP40 or DOT11_KEY_TYPE_WEP104.** RETURNS: OK or ERROR** ERRNO: N/A*/INT32 dot11WepKeyMapAdd ( int ifNum, /* Interface number, ie. the '0' in wls0 */ UINT8 * macAddr, /* MAC address of the other station */ UINT32 keyType, /* Type of key to add */ UINT8 * keyData /* The key itself */ ) { DOT11_KEY key; if ((keyType != DOT11_KEY_TYPE_WEP104) && (keyType != DOT11_KEY_TYPE_WEP40)) { printf("dot11WepKeyMapAdd: invalid key type %d\n",keyType); return ERROR; } if ((macAddr == NULL) || (keyData == NULL)) { printf("dot11WepKeyMapAdd: invalid macAddr or keyData\n"); return ERROR; } key.keyType = keyType; /* Magic number that is defined in dot11Lib.h but not dot11UsrLib.h */ key.keySlot = 65536; bcopy ((char *)macAddr, (char *)key.macAddr, DOT11_ADDR_LEN); if (keyType == DOT11_KEY_TYPE_WEP40) { bcopy((char *)keyData, (char *)key.type.wep40, DOT11_WEP40_KEY_SIZE); } else /* must be 104 */ { bcopy((char *)keyData, (char *)key.type.wep104, DOT11_WEP104_KEY_SIZE); } return dot11TestIoctl(ifNum, WIOCAPAIRWISEKEY, (caddr_t)&key); }/****************************************************************************** dot11WepKeyMapDel - Removes an entry from the WEP key mapping table** ** RETURNS: OK or ERROR** ERRNO: N/A*/INT32 dot11WepKeyMapDel ( int ifNum, /* Interface number, ie. the '0' in wls0 */ UINT8 * macAddr /* Address of the other station */ ) { return dot11TestIoctl(ifNum, WIOCDPAIRWISEKEY, (caddr_t)macAddr); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -