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

📄 wlc_bsscfg.c

📁 wi-fi sources for asus wl138g v2 pci card
💻 C
字号:
/* * BSS Configuration routines for * Broadcom 802.11abg Networking Device Driver * * Copyright 2005-2006, Broadcom Corporation * All Rights Reserved.                 *                                      * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. * * $Id$ */#include <wlc_cfg.h>#include <typedefs.h>#include <bcmdefs.h>#include <osl.h>#include <sbutils.h>#include <bcmendian.h>#include <bcmutils.h>#include <proto/802.11.h>#include <proto/wpa.h>#include <sbconfig.h>#include <pcicfg.h>#include <bcmsrom.h>#include <wlioctl.h>#include <epivers.h>#include <proto/eapol.h>#include <bcmwpa.h>#include <sbhndpio.h>#include <sbhnddma.h>#include <hnddma.h>#include <d11.h>#include <wlc_rate.h>#include <wlc_rate_sel.h>#include <wlc_key.h>#include <wlc_channel.h>#include <wlc_pub.h>#include <wlc_bsscfg.h>#include <wlc_pio.h>#include <wlc.h>#include <wlc_phy.h>#include <wlc_scb.h>#include <wl_export.h>#include <wlc_channel.h>/* Count the number of bsscfgs (any type) that are enabled */static intwlc_bsscfg_ena_cnt(wlc_info_t *wlc){	int idx, count;	for (count = idx = 0; idx < WLC_MAXBSSCFG; idx++)		if (wlc->bsscfg[idx] && wlc->bsscfg[idx]->enable)			count++;	return count;}/* Check if any bsscfg has settings that should force off txc */boolwlc_bsscfg_notxc(wlc_info_t *wlc){	int idx;	wlc_bsscfg_t *bsscfg;	for (idx = 0; idx < WLC_MAXBSSCFG; idx++) {		if ((bsscfg = wlc->bsscfg[idx]) == NULL)			continue;		if (bsscfg->wsec || bsscfg->eap_restrict)			return TRUE;	}	return FALSE;}wlc_bsscfg_t*wlc_bsscfg_lookup(wlc_info_t *wlc, uchar* ssid, uint ssid_len){	wlc_bsscfg_t* cfg;	int i;	for (i =  0; i < WLC_MAXBSSCFG; i++) {		cfg = wlc->bsscfg[i];		if (WLC_IS_MATCH_SSID(wlc, ssid, cfg->SSID, ssid_len, cfg->SSID_len))			return cfg;	}	return NULL;}intwlc_bsscfg_up(wlc_info_t *wlc, wlc_bsscfg_t *cfg){	int result = 0;	ASSERT(cfg != NULL);	ASSERT(cfg->enable);	cfg->up = TRUE;	if (BSSCFG_STA(cfg)) {		if (wlc->pub.up) {			/* attempt to join a BSS with the requested SSID */			WL_ASSOC(("JOIN: wlc_set_ssid\n"));			wlc_set_ssid(wlc, cfg->SSID, cfg->SSID_len);		} else {			/* no join, mark down (and disabled) again */			cfg->up = FALSE;			cfg->enable = FALSE;			result = BCME_NOTUP;		}	}	return result;}/* Enable: always try to force up */intwlc_bsscfg_enable(wlc_info_t *wlc, wlc_bsscfg_t *bsscfg){	ASSERT(bsscfg != NULL);	if (bsscfg != wlc->bsscfg[0])		return BCME_EPERM;	bsscfg->enable = TRUE;	return wlc_bsscfg_up(wlc, bsscfg);}voidwlc_bsscfg_down(wlc_info_t *wlc, wlc_bsscfg_t *cfg){	ASSERT(cfg != NULL);	if (!cfg->up)		return;	if (BSSCFG_STA(cfg)) {		if (wlc->pub.associated)			wlc_disassociate_client(wlc, TRUE, NULL, NULL);		else if (wlc->assoc_state != AS_IDLE)			wlc_assoc_abort(wlc);		cfg->up = FALSE;	}	/* free probe response block */	if (cfg->prb_resp) {		MFREE(wlc->pub.osh, cfg->prb_resp, BCN_TMPL_LEN);		cfg->prb_resp = NULL;	}}voidwlc_bsscfg_disable(wlc_info_t *wlc, wlc_bsscfg_t *bsscfg){	ASSERT(bsscfg != NULL);	wlc_bsscfg_down(wlc, bsscfg);	ASSERT(!bsscfg->up);	/* make sure we don't retry */	if (BSSCFG_STA(bsscfg)) {		wl_del_timer(wlc->wl, wlc->assoc_timer);	}	bsscfg->enable = FALSE;	/* do a full cleanup of scbs if all configs disabled */	if (wlc_bsscfg_ena_cnt(wlc) == 0)		wlc_scbclear(wlc, FALSE);}/* Get a bsscfg pointer, failing if the bsscfg does not alreay exist. * Sets the bsscfg pointer in any event. * Returns BCME_RANGE if the index is out of range or BCME_NOTFOUND * if the wlc->bsscfg[i] pointer is null */wlc_bsscfg_t*wlc_bsscfg_find(wlc_info_t *wlc, int idx, int *perr){	wlc_bsscfg_t *bsscfg;	if ((idx < 0) || (idx >= WLC_MAXBSSCFG)) {		*perr = BCME_RANGE;		return NULL;	}	bsscfg = wlc->bsscfg[idx];	*perr = bsscfg ? 0 : BCME_NOTFOUND;	return bsscfg;}/* * Get a bsscfg pointer, allocating one if the bsscfg does not alreay exist. * Sets the bsscfg pointer in any event. * Returns NULL if there is an error. * set perr to BCME_RANGE if out of range or BCME_NOMEM * if the wlc->bsscfg[i] pointer is null and the allocation fails. */wlc_bsscfg_t*wlc_bsscfg_get(wlc_info_t *wlc, int idx, int *perr){	if (idx < 0 || idx >= WLC_MAXBSSCFG) {		*perr = BCME_RANGE;		return NULL;	}	/* STA-only code supports just bsscfg #0. Code is under an	 * ifdef to avoid the AP routine wlc_bsscfg_alloc() call.	 */	ASSERT(idx == 0);	*perr = 0;	return &wlc->cfg;}voidwlc_bsscfg_init(wlc_info_t *wlc, wlc_bsscfg_t *bsscfg){	ASSERT(bsscfg != NULL);	bzero(bsscfg, sizeof(wlc_bsscfg_t));	bsscfg->wlcif.type = WLC_IFTYPE_BSS;	bsscfg->wlcif.u.bsscfg = bsscfg;	/* When we have STA support, the primary bsscfg defaults to STA mode,	 * but additional dynamic BSSs default to AP mode	 */	bsscfg->_ap = (bsscfg != &wlc->cfg);	/* initialize security state */	bsscfg->wsec_index = -1;	bsscfg->wsec = 0;	bsscfg->pwsec = 0;	bsscfg->gwsec = 0;	/* Match Wi-Fi default of true for aExcludeUnencrypted,	 * instead of 802.11 default of false.	 */	bsscfg->wsec_restrict = TRUE;	/* Enable rx unencrypted eapols*/	bsscfg->rx_unencrypted_eapol = TRUE;	/* disable 802.1X authentication by default */	bsscfg->eap_restrict = FALSE;	/* disable WPA by default */	bsscfg->WPA_auth = WPA_AUTH_DISABLED;}

⌨️ 快捷键说明

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