?? dot11test.c
字號:
{ return dot11TestIoctl(ifNum, WIOCSCHANNEL, (caddr_t)channel); }/****************************************************************************** dot11SecPolSet - Sets the current WPA/RSN security policies* of the indicated interface** This routine is a wrapper function that will call WIOCSSECPOL with the* specified security policies. These are a bitwise OR of the following * parameters (or DOT11_SECPOL_NONE / 0 to disable advanced security) :* DOT11_SECPOL_TSN _BIT(0) 1* DOT11_SECPOL_WPA _BIT(1) 2* DOT11_SECPOL_11i _BIT(2) 4** Note: TSN may only be selected if one of the other modes is enabled.** RETURNS: the results of the IOCTL call, typically OK, ERROR, EINVAL** ERRNO: N/A*/STATUS dot11SecPolSet ( int ifNum, /* Interface number, ie. the '0' in wls0 */ int secPol /* Bitmask of allowed security policies */ ) { return dot11TestIoctl(ifNum, WIOCSSECPOL, (caddr_t)secPol); }/****************************************************************************** dot11AuthPolSet - Sets the current WPA/RSN authentication policy* of the indicated interface** This routine is a wrapper function that will call WIOCSAUTHPOL to set the * allowed authentication policies on the device. Allowed options are one or* both of the following, bitwised OR'd together, or DOT11_AUTHPOL_NONE to * disable advanced security.* DOT11_AUTHPOL_8021X _BIT(0) 1* DOT11_AUTHPOL_PSK _BIT(1) 2*** This parameter should be set to zero if the security policies are set to * zero to avoid an inconsistent system state.** RETURNS: the results of the IOCTL call, typically OK, ERROR, EINVAL** ERRNO: N/A*/STATUS dot11AuthPolSet ( int ifNum, /* Interface number, ie. the '0' in wls0 */ int authPol /* Bitmask of allowed authentication policies */ ) { return dot11TestIoctl(ifNum, WIOCSAUTHPOL, (caddr_t)authPol); }/****************************************************************************** dot11CipherPolSet - Sets the current WPA/RSN cipher policies* of the indicated interface** This routine is a wrapper function that will call WIOCSCIPHERPOL to set the * allowed authentication policies on the device. Allowed options are a bitmask* of the following, OR'd together, or DOT11_CIPHPOL_NONE to disable advanced * security. * DOT11_KEY_TYPE_WEP40 1* DOT11_KEY_TYPE_WEP104 2* DOT11_KEY_TYPE_TKIP 4* DOT11_KEY_TYPE_AES 8*** This parameter should be set to zero if the security policies are set to * zero to avoid an inconsistent system state.** RETURNS: the results of the IOCTL call, typically OK, ERROR, EINVAL** ERRNO: N/A*/STATUS dot11CipherPolSet ( int ifNum, /* Interface number, ie. the '0' in wls0 */ int cipherPol /* bitmask of allowed cipher policies */ ) { return dot11TestIoctl(ifNum, WIOCSCIPHPOL, (caddr_t)cipherPol); }/****************************************************************************** dot11PassphraseSet - Sets the WPA/RSN passphrase for pre-shared key mode** This routine is a wrapper function that will call WIOCSPASSPHRASE with the* specified parameter. This will set the PSK/Passphrase, and if connected to * or acting as an AP, will regenerate the PSK based on this passphrase. <data>* is a pointer to a NULL-terminated, 8-63 byte string.** RETURNS: the results of the IOCTL call, typically OK, ERROR, EINVAL** ERRNO: N/A*/STATUS dot11PassphraseSet ( int ifNum, /* Interface number, ie. the '0' in wls0 */ char * passphrase ) { return dot11TestIoctl(ifNum, WIOCSPASSPHRASE, (caddr_t)passphrase); }/****************************************************************************** dot11PskSet - Sets the pre-shared key** This routine is a wrapper function for WIOCSPSK, which sets the PSK directly.* This overwrites the setting of WIOCSPASSPHRASE. <data> is a pointer to an* array of 64 UINT8 values that contain the PSK directly.** RETURNS: the results of the IOCTL call, typically OK, ERROR, EINVAL** ERRNO: N/A*/STATUS dot11PskSet ( int ifNum, /* Interface number, ie. the '0' in wls0 */ UINT8 *psk /* 64 byte array with new PSK */ ) { return dot11TestIoctl(ifNum, WIOCSPSK, (caddr_t)psk); }/****************************************************************************** dot11WepSet - Change WEP mode.** This routine is a wrapper function that will call WIOCSENCRYPTTYPE with the* specified parameter. This changes the WEP type. It should only be used in* legacy WEP networks, or WPA/RSN networks that have TSN enabled.** <data> is the mode to put WEP in, one of:* DOT11_KEY_TYPE_WEP40 1* DOT11_KEY_TYPE_WEP104 2** Set <data> to DOT11_KEY_TYPE_NONE/0 to disable WEP** RETURNS: the results of the IOCTL call, typically OK, ERROR, EINVAL** ERRNO: N/A*/STATUS dot11WepSet ( int ifNum, /* Interface number, ie. the '0' in wls0 */ int encryptType /* Cipher type for WEP */ ) { return dot11TestIoctl(ifNum, WIOCSENCRYPTTYPE, (caddr_t)encryptType); }/****************************************************************************** dot11WepDefaultKeySet - sets the default Wep key ** This routine is a wrapper function that will call WIOCSWEPDEFAULTKEY * to set the WEP key used to transmit packets. This call is only valid* in legacy WEP mode and WPA/RSN mode ONLY if TSN is enabled. <data> is * a numeric value between 0 and 3.** RETURNS: the results of the IOCTL call, typically OK, ERROR, EINVAL** ERRNO: N/A*/STATUS dot11WepDefaultKeySet ( int ifNum, /* Interface number, ie. the '0' in wls0 */ int keySlot /* Keyslot to use for transmission */ ) { return dot11TestIoctl(ifNum, WIOCSWEPDEFAULTKEY, (caddr_t)keySlot); }/****************************************************************************** dot11WepKeySet - Sets the specified default key** This routine sets the specified WEP key. Currently, only key slots 0-3 * are supported by this command. For WEP key mapping, use WIOCAPAIRWISEKEY.* The WEP key set must be of the type WEP is currently using, as set by* dot11WepSet(). <keySlot> is the keyslot into which to insert the key, and * <keyData> points to an array of a length appropriate for the wep type, * containing the key data.** RETURNS: the results of the IOCTL call, typically OK, ERROR, EINVAL** ERRNO: N/A*/STATUS dot11WepKeySet ( int ifNum, /* Interface number, ie. the '0' in wls0 */ int keySlot, /* keySlot into which to inset the key */ UINT8 * keyData /* key data to put into the keySlot */ ) { DOT11_KEY key; UINT32 keyType; UINT32 keyLen; if (keyData == NULL) { return ERROR; } if (dot11TestIoctl(ifNum, WIOCGENCRYPTTYPE, (caddr_t)&keyType) != OK) { return ERROR; } switch(keyType) { case DOT11_KEY_TYPE_WEP40: keyLen = DOT11_WEP40_KEY_SIZE; break; case DOT11_KEY_TYPE_WEP104: keyLen = DOT11_WEP104_KEY_SIZE; break; case DOT11_KEY_TYPE_TKIP: keyLen = DOT11_TKIP_KEY_SIZE; break; case DOT11_KEY_TYPE_AES: keyLen = DOT11_AES_KEY_SIZE; break; default: return ERROR; } bzero((char *)&key, sizeof(key)); bcopy((char *)keyData, (char *)&key.type.wep40[0], keyLen); key.keyType = keyType; key.keySlot = keySlot; return dot11TestIoctl(ifNum, WIOCSWEPKEY0 + keySlot, (caddr_t)&key); }/****************************************************************************** dot11WepSkSet - turns WEP Shared Key on or off ** This routine is a duplicate for dot11AuthTypeSet() for legacy reasons.** RETURNS: the results of the IOCTL call, typically OK, ERROR, EINVAL** ERRNO: N/A* * \NOMANUAL**/STATUS dot11WepSkSet ( int ifNum, /* Interface number, ie. the '0' in wls0 */ int authType /* Default authentication type */ ) { return dot11TestIoctl(ifNum, WIOCSAUTHTYPE, (caddr_t)authType); }/****************************************************************************** dot11TxPowerScaleSet - Sets the current TX scaling factor** This function calls WIOCSTXPOWERSCALE to set the transmit power scaling* value, which is the amount of the maximum tx power that will be used in all* transmissions. <data> may take on the following values:* DOT11_TXPOWER_MAX 0 Use the maximum TX power for the RD* DOT11_TXPOWER_66 1 Use 66% of the max txPower* DOT11_TXPOWER_50 2 Use 50% of the max txPower* DOT11_TXPOWER_33 3 Use 33% of the max txPower* DOT11_TXPOWER_MIN 4 Use 25% of the max txPower** RETURNS: the results of the IOCTL call, typically OK, ERROR, EINVAL** ERRNO: N/A*/STATUS dot11TxPowerScaleSet ( int ifNum, /* Interface number, ie. the '0' in wls0 */ UINT32 scale /* Tx power scaling factor */ ) { return dot11TestIoctl(ifNum, WIOCSTXPOWERSCALE, (caddr_t)scale); }/****************************************************************************** dot11RateSet - Sets the allowed rates for the station** This routine sets the allowed rates for the station, using the IOCTL* call WIOCSTXRATE. The allowed rates are used to determine which of the rates* supported by this device and that to which it is conected are used in actual* data transmission by this station. <numRates> is the number of rates, * followed by all of the rates in IEEE format (units of 500 kb/s). For* example, to set the card to allow only 1,2,5.5 and 6 Mpbs rates, the call* would look like:* dot11RateSet(0, 4, 2, 4, 11, 12);** A set of zero length, ( dot11RateSet(0,0) ) will reset the allowed rate list* and allow the card to use any rate that is supported by both this station* and the cnnected station.** RETURNS: the results of the IOCTL call, typically OK, ERROR, EINVAL** ERRNO: N/A*/STATUS dot11RateSet ( int ifNum, /* Interface number, ie. the '0' in wls0 */ int numRates, /* Number of rates to follow */ ... /* the rate set, as varargs */ ) { va_list rate_list; DOT11_RATES rates; int i; va_start(rate_list, numRates); rates.length = numRates; for (i=0; i<numRates; i++) { rates.rates[i] = (UINT8)va_arg(rate_list, int); } return dot11TestIoctl(ifNum, WIOCSTXRATE, (caddr_t)&rates); }/****************************************************************************** dot11CtsRtsSet - Sets the CTS/RTS threshold** This routine is a wrapper function that will call WIOCSCTSRTS. * <rtsThreshold> is the packet size above which CTS/RTS is used to transmit* the packet. In areas with a high number of stations and access points, this* can improve the reliability of transmission, at a cost of some bandwidth. * Setting to the maximum value of 2347 bytes will disable this feature, and * setting to the minimum value of 0 will enable CTS/RTS for all sized packets.** RETURNS: the results of the IOCTL call, typically OK, ERROR, EINVAL** ERRNO: N/A*/STATUS dot11CtsRtsSet ( int ifNum, /* Interface number, ie. the '0' in wls0 */ int rtsThreshold /* The packet size above which CTS/RTS is used */ ) { return dot11TestIoctl(ifNum, WIOCSCTSRTS, (caddr_t)rtsThreshold); }/****************************************************************************** dot11FragThreshSet - Set Fragmentation threshold ** This routine is a wrapper function that will call WIOCSFRAGTHRESH. * <rtsThreshold> is the packet size above which transmitted packets are * fragmneted. In areas with a high RF noise, this* can improve the reliability of transmission, at a cost of some bandwidth. * Setting to the maximum value of 2346 bytes will disable this feature, and * setting to the minimum value of 256 will enable fragmentation for most* packets.** RETURNS: the results of the IOCTL call, typically OK, ERROR, EINVAL** ERRNO: N/A*/STATUS dot11FragThreshSet ( int ifNum, /* Interface number, ie. the '0' in wls0 */ int fragThresh /* Size of packet above which to fragment */ ) { return dot11TestIoctl(ifNum, WIOCSFRAGTHRESH, (caddr_t)fragThresh); }/****************************************************************************** dot11RadioModeSet - Sets the current radio mode** This routine sets the current used radio mode of the card. Channels and * rates that do not belong to the radio modes set in this call will not be* used, even if allowed in the current regulatory domain. <radioMode> may * contain any of the following OR'd together. 0 is not a valid parameter.* DOT11_RADIO_11a _BIT(0) (chan 100 and higher, ofdm data rates)* DOT11_RADIO_11b _BIT(1) (chan 1-14, cck data rates )* DOT11_RADIO_11g _BIT(2) (chan 1-14, ofdm data rates)** RETURNS: the results of the IOCTL call, typically OK, ERROR, EINVAL** ERRNO: N/A*/STATUS dot11RadioModeSet ( int ifNum, /* Interface number, ie. the '0' in wls0 */ int radioMode /* Radio modes to allow */ ) { return dot11TestIoctl(ifNum, WIOCSRADIOMODE, (caddr_t)radioMode); }/****************************************************************************** dot11LongRetrySet - Sets the maximum number of long retries** This routine sets the maximum number of times "long" packets will be * retried if they fail transmission the first time. "long" packets are * defined as those larger than the CTS/RTS threshold. Some cards may not* differentiate between long and short packets,* in which case this and dot11ShortRetrySet() will set the same value. Valid * values for <retry> are 0 .. 255.** RETURNS: the results of the IOCTL call, typically OK, ERROR, EINVAL** ERRNO: N/A*/STATUS dot11LongRetrySet ( int ifNum, /* Interface number, ie. the '0' in wls0 */ int retry /* Number of retries for short packets */ ) { return dot11TestIoctl(ifNum, WIOCSLONGRETRY, (caddr_t)retry); }/****************************************************************************** dot11ShortRetrySet - Sets the maximum number of short retries** This routine sets the maximum number of times "short" packets will be * retried if they fail transmission the first time. "short" packets are * defined as those smaller than the CTS/RTS threshold. Some cards may not* differentiate between long and short packets,* in which case this and dot11LongRetrySet() will set the same value. Valid * values for <retry> are 0 .. 255.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -