FreeBSD/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_sys.c
/*
 * Sanity checks for the wlanIfaceConfigTable.
 */
Sanity checks for the wlanIfaceConfigTable.
Sanity checks for the wlanIfaceConfigTable .
static int
wlan_config_check(struct wlan_iface *wif, int op)
{
	switch (op) {
	case IEEE80211_IOC_BURST:
		if ((wif->drivercaps & (0x1 << WlanDriverCaps_burst)) == 0) {
			wif->packet_burst = TruthValue_false;
			return (-1);
		}
		break;
	case IEEE80211_IOC_DFS:
		if ((wif->drivercaps & (0x1 << WlanDriverCaps_dfs)) == 0) {
			wif->dyn_frequency = TruthValue_false;
			return (-1);
		}
		break;
	case IEEE80211_IOC_FF:
		if ((wif->drivercaps & (0x1 << WlanDriverCaps_athFastFrames))
		    == 0) {
			wif->fast_frames = TruthValue_false;
			return (-1);
		}
		break;
	case IEEE80211_IOC_TURBOP:
		if ((wif->drivercaps & (0x1 << WlanDriverCaps_athTurbo)) == 0) {
			wif->dturbo = TruthValue_false;
			return (-1);
		}
		break;
	case IEEE80211_IOC_TXPOWER:
		if ((wif->drivercaps & (0x1 << WlanDriverCaps_txPmgt)) == 0) {
			wif->tx_power = 0;
			return (-1);
		}
		break;
	case IEEE80211_IOC_FRAGTHRESHOLD:
		if ((wif->drivercaps & (0x1 << WlanDriverCaps_txFrag)) == 0) {
			wif->frag_threshold = IEEE80211_FRAG_MAX;
			return (-1);
		}
		break;
	case IEEE80211_IOC_DWDS:
		if ((wif->drivercaps & (0x1 << WlanDriverCaps_wds)) == 0) {
			wif->dynamic_wds = TruthValue_false;
			return (-1);
		}
		break;
	case IEEE80211_IOC_POWERSAVE:
		if ((wif->drivercaps & (0x1 << WlanDriverCaps_pmgt)) == 0) {
			wif->power_save = TruthValue_false;
			return (-1);
		}
		break;
	case IEEE80211_IOC_BEACON_INTERVAL:
		if (wif->mode != WlanIfaceOperatingModeType_hostAp &&
		    wif->mode != WlanIfaceOperatingModeType_meshPoint &&
		    wif->mode != WlanIfaceOperatingModeType_ibss) {
			wif->beacon_interval = 100; 
			return (-1);
		}
		break;
	case IEEE80211_IOC_DTIM_PERIOD:
		if (wif->mode != WlanIfaceOperatingModeType_hostAp &&
		    wif->mode != WlanIfaceOperatingModeType_meshPoint &&
		    wif->mode != WlanIfaceOperatingModeType_ibss) {
			wif->dtim_period = 1; 
			return (-1);
		}
		break;
	case IEEE80211_IOC_PUREN:
		if ((wif->htcaps & (0x1 << WlanHTCaps_htcHt)) == 0) {
			wif->dot11n_pure = TruthValue_false;
			return (-1);
		}
		break;
	case IEEE80211_IOC_AMPDU:
		if ((wif->htcaps & (0x1 << WlanHTCaps_htcAmpdu)) == 0) {
			wif->ampdu = WlanIfaceDot11nPduType_disabled;
			return (-1);
		}
		break;
	case IEEE80211_IOC_AMSDU:
		if ((wif->htcaps & (0x1 << WlanHTCaps_htcAmsdu)) == 0) {
			wif->amsdu = WlanIfaceDot11nPduType_disabled;
			return (-1);
		}
		break;
	case IEEE80211_IOC_RIFS:
		if ((wif->htcaps & (0x1 << WlanHTCaps_htcRifs)) == 0) {
			wif->rifs = TruthValue_false;
			return (-1);
		}
		break;
	case IEEE80211_IOC_SHORTGI:
		if ((wif->htcaps & (0x1 << WlanHTCaps_shortGi20 |
		    0x1 << WlanHTCaps_shortGi40)) == 0) {
			wif->short_gi = TruthValue_false;
			return (-1);
		}
		break;
	case IEEE80211_IOC_SMPS:
		if ((wif->htcaps & (0x1 << WlanHTCaps_htcSmps)) == 0) {
			wif->smps_mode = wlanIfaceDot11nSMPSMode_disabled;
			return (-1);
		}
		break;
	case IEEE80211_IOC_TDMA_SLOT:
		if ((wif->drivercaps & (0x1 << WlanDriverCaps_tdma)) == 0) {
			wif->tdma_slot = 0;
			return (-1);
		}
		break;
	case IEEE80211_IOC_TDMA_SLOTCNT:
		if ((wif->drivercaps & (0x1 << WlanDriverCaps_tdma)) == 0) {
			wif->tdma_slot_count = 0;
			return (-1);
		}
		break;
	case IEEE80211_IOC_TDMA_SLOTLEN:
		if ((wif->drivercaps & (0x1 << WlanDriverCaps_tdma)) == 0) {
			wif->tdma_slot_length = 0;
			return (-1);
		}
		break;
	case IEEE80211_IOC_TDMA_BINTERVAL:
		if ((wif->drivercaps & (0x1 << WlanDriverCaps_tdma)) == 0) {
			wif->tdma_binterval = 0;
			return (-1);
		}
		break;
	default:
		break;
	}
	return (0);
}
static int wlan_config_check ( struct wlan_iface * wif , int op ) { switch ( op ) { case IEEE80211_IOC_BURST : if ( ( wif -> drivercaps & ( 0x1 << WlanDriverCaps_burst ) ) == 0 ) { wif -> packet_burst = TruthValue_false ; return ( -1 ) ; } break ; case IEEE80211_IOC_DFS : if ( ( wif -> drivercaps & ( 0x1 << WlanDriverCaps_dfs ) ) == 0 ) { wif -> dyn_frequency = TruthValue_false ; return ( -1 ) ; } break ; case IEEE80211_IOC_FF : if ( ( wif -> drivercaps & ( 0x1 << WlanDriverCaps_athFastFrames ) ) == 0 ) { wif -> fast_frames = TruthValue_false ; return ( -1 ) ; } break ; case IEEE80211_IOC_TURBOP : if ( ( wif -> drivercaps & ( 0x1 << WlanDriverCaps_athTurbo ) ) == 0 ) { wif -> dturbo = TruthValue_false ; return ( -1 ) ; } break ; case IEEE80211_IOC_TXPOWER : if ( ( wif -> drivercaps & ( 0x1 << WlanDriverCaps_txPmgt ) ) == 0 ) { wif -> tx_power = 0 ; return ( -1 ) ; } break ; case IEEE80211_IOC_FRAGTHRESHOLD : if ( ( wif -> drivercaps & ( 0x1 << WlanDriverCaps_txFrag ) ) == 0 ) { wif -> frag_threshold = IEEE80211_FRAG_MAX ; return ( -1 ) ; } break ; case IEEE80211_IOC_DWDS : if ( ( wif -> drivercaps & ( 0x1 << WlanDriverCaps_wds ) ) == 0 ) { wif -> dynamic_wds = TruthValue_false ; return ( -1 ) ; } break ; case IEEE80211_IOC_POWERSAVE : if ( ( wif -> drivercaps & ( 0x1 << WlanDriverCaps_pmgt ) ) == 0 ) { wif -> power_save = TruthValue_false ; return ( -1 ) ; } break ; case IEEE80211_IOC_BEACON_INTERVAL : if ( wif -> mode != WlanIfaceOperatingModeType_hostAp && wif -> mode != WlanIfaceOperatingModeType_meshPoint && wif -> mode != WlanIfaceOperatingModeType_ibss ) { wif -> beacon_interval = 100 ; return ( -1 ) ; } break ; case IEEE80211_IOC_DTIM_PERIOD : if ( wif -> mode != WlanIfaceOperatingModeType_hostAp && wif -> mode != WlanIfaceOperatingModeType_meshPoint && wif -> mode != WlanIfaceOperatingModeType_ibss ) { wif -> dtim_period = 1 ; return ( -1 ) ; } break ; case IEEE80211_IOC_PUREN : if ( ( wif -> htcaps & ( 0x1 << WlanHTCaps_htcHt ) ) == 0 ) { wif -> dot11n_pure = TruthValue_false ; return ( -1 ) ; } break ; case IEEE80211_IOC_AMPDU : if ( ( wif -> htcaps & ( 0x1 << WlanHTCaps_htcAmpdu ) ) == 0 ) { wif -> ampdu = WlanIfaceDot11nPduType_disabled ; return ( -1 ) ; } break ; case IEEE80211_IOC_AMSDU : if ( ( wif -> htcaps & ( 0x1 << WlanHTCaps_htcAmsdu ) ) == 0 ) { wif -> amsdu = WlanIfaceDot11nPduType_disabled ; return ( -1 ) ; } break ; case IEEE80211_IOC_RIFS : if ( ( wif -> htcaps & ( 0x1 << WlanHTCaps_htcRifs ) ) == 0 ) { wif -> rifs = TruthValue_false ; return ( -1 ) ; } break ; case IEEE80211_IOC_SHORTGI : if ( ( wif -> htcaps & ( 0x1 << WlanHTCaps_shortGi20 | 0x1 << WlanHTCaps_shortGi40 ) ) == 0 ) { wif -> short_gi = TruthValue_false ; return ( -1 ) ; } break ; case IEEE80211_IOC_SMPS : if ( ( wif -> htcaps & ( 0x1 << WlanHTCaps_htcSmps ) ) == 0 ) { wif -> smps_mode = wlanIfaceDot11nSMPSMode_disabled ; return ( -1 ) ; } break ; case IEEE80211_IOC_TDMA_SLOT : if ( ( wif -> drivercaps & ( 0x1 << WlanDriverCaps_tdma ) ) == 0 ) { wif -> tdma_slot = 0 ; return ( -1 ) ; } break ; case IEEE80211_IOC_TDMA_SLOTCNT : if ( ( wif -> drivercaps & ( 0x1 << WlanDriverCaps_tdma ) ) == 0 ) { wif -> tdma_slot_count = 0 ; return ( -1 ) ; } break ; case IEEE80211_IOC_TDMA_SLOTLEN : if ( ( wif -> drivercaps & ( 0x1 << WlanDriverCaps_tdma ) ) == 0 ) { wif -> tdma_slot_length = 0 ; return ( -1 ) ; } break ; case IEEE80211_IOC_TDMA_BINTERVAL : if ( ( wif -> drivercaps & ( 0x1 << WlanDriverCaps_tdma ) ) == 0 ) { wif -> tdma_binterval = 0 ; return ( -1 ) ; } break ; default : break ; } return ( 0 ) ; }
Sanity checks for the wlanIfaceConfigTable.
Sanity checks for the wlanIfaceConfigTable .
/* XXX */ /* XXX */