本文整理汇总了C++中IEEE80211_LOCK函数的典型用法代码示例。如果您正苦于以下问题:C++ IEEE80211_LOCK函数的具体用法?C++ IEEE80211_LOCK怎么用?C++ IEEE80211_LOCK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IEEE80211_LOCK函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ieee80211_set_tim
/*
* Indicate whether there are frames queued for a station in power-save mode.
*/
static int
ieee80211_set_tim(struct ieee80211_node *ni, int set)
{
struct ieee80211vap *vap = ni->ni_vap;
struct ieee80211com *ic = ni->ni_ic;
uint16_t aid;
int changed;
KASSERT(vap->iv_opmode == IEEE80211_M_HOSTAP ||
vap->iv_opmode == IEEE80211_M_IBSS,
("operating mode %u", vap->iv_opmode));
aid = IEEE80211_AID(ni->ni_associd);
KASSERT(aid < vap->iv_max_aid,
("bogus aid %u, max %u", aid, vap->iv_max_aid));
IEEE80211_LOCK(ic);
changed = (set != (isset(vap->iv_tim_bitmap, aid) != 0));
if (changed) {
if (set) {
setbit(vap->iv_tim_bitmap, aid);
vap->iv_ps_pending++;
} else {
clrbit(vap->iv_tim_bitmap, aid);
vap->iv_ps_pending--;
}
/* NB: we know vap is in RUN state so no need to check */
vap->iv_update_beacon(vap, IEEE80211_BEACON_TIM);
}
IEEE80211_UNLOCK(ic);
return changed;
}
示例2: ieee80211_start_scan
/*
* Start a scan unless one is already going.
*/
int
ieee80211_start_scan(struct ieee80211vap *vap, int flags,
u_int duration, u_int mindwell, u_int maxdwell,
u_int nssid, const struct ieee80211_scan_ssid ssids[])
{
struct ieee80211com *ic = vap->iv_ic;
const struct ieee80211_scanner *scan;
int result;
scan = ieee80211_scanner_get(vap->iv_opmode);
if (scan == NULL) {
IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
"%s: no scanner support for %s mode\n",
__func__, ieee80211_opmode_name[vap->iv_opmode]);
/* XXX stat */
return 0;
}
IEEE80211_LOCK(ic);
result = start_scan_locked(scan, vap, flags, duration,
mindwell, maxdwell, nssid, ssids);
IEEE80211_UNLOCK(ic);
return result;
}
示例3: ieee80211_scan_detach
void
ieee80211_scan_detach(struct ieee80211com *ic)
{
struct ieee80211_scan_state *ss = ic->ic_scan;
if (ss != NULL) {
IEEE80211_LOCK(ic);
SCAN_PRIVATE(ss)->ss_iflags |= ISCAN_ABORT;
scan_signal(ss);
IEEE80211_UNLOCK(ic);
ieee80211_draintask(ic, &SCAN_PRIVATE(ss)->ss_scan_task);
callout_drain(&SCAN_PRIVATE(ss)->ss_scan_timer);
KASSERT((ic->ic_flags & IEEE80211_F_SCAN) == 0,
("scan still running"));
if (ss->ss_ops != NULL) {
ss->ss_ops->scan_detach(ss);
ss->ss_ops = NULL;
}
ic->ic_scan = NULL;
free(SCAN_PRIVATE(ss), M_80211_SCAN);
}
#if defined(__ANTARES__)
ieee80211_scan_sta_uninit();
#endif
}
示例4: cancel_scan
static void
cancel_scan(struct ieee80211vap *vap, int any, const char *func)
{
struct ieee80211com *ic = vap->iv_ic;
struct ieee80211_scan_state *ss = ic->ic_scan;
IEEE80211_LOCK(ic);
if ((ic->ic_flags & IEEE80211_F_SCAN) &&
(any || ss->ss_vap == vap) &&
(SCAN_PRIVATE(ss)->ss_iflags & ISCAN_CANCEL) == 0) {
IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
"%s: cancel %s scan\n", func,
ss->ss_flags & IEEE80211_SCAN_ACTIVE ?
"active" : "passive");
/* clear bg scan NOPICK */
ss->ss_flags &= ~IEEE80211_SCAN_NOPICK;
/* mark cancel request and wake up the scan task */
scan_signal_locked(ss, ISCAN_CANCEL);
} else {
IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
"%s: called; F_SCAN=%d, vap=%s, CANCEL=%d\n",
func,
!! (ic->ic_flags & IEEE80211_F_SCAN),
(ss->ss_vap == vap ? "match" : "nomatch"),
!! (SCAN_PRIVATE(ss)->ss_iflags & ISCAN_CANCEL));
}
IEEE80211_UNLOCK(ic);
}
示例5: ieee80211_vap_detach
/*
* Tear down vap state and reclaim the ifnet.
* The driver is assumed to have prepared for
* this; e.g. by turning off interrupts for the
* underlying device.
*/
void
ieee80211_vap_detach(struct ieee80211vap *vap)
{
struct ieee80211com *ic = vap->iv_ic;
struct ifnet *ifp = vap->iv_ifp;
IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE, "%s: %s parent %s\n",
__func__, ieee80211_opmode_name[vap->iv_opmode],
ic->ic_ifp->if_xname);
/* NB: bpfdetach is called by ether_ifdetach and claims all taps */
ether_ifdetach(ifp);
ieee80211_stop(vap);
/*
* Flush any deferred vap tasks.
*/
ieee80211_draintask(ic, &vap->iv_nstate_task);
ieee80211_draintask(ic, &vap->iv_swbmiss_task);
/* XXX band-aid until ifnet handles this for us */
taskqueue_drain(taskqueue_swi, &ifp->if_linktask);
IEEE80211_LOCK(ic);
KASSERT(vap->iv_state == IEEE80211_S_INIT , ("vap still running"));
TAILQ_REMOVE(&ic->ic_vaps, vap, iv_next);
ieee80211_syncflag_locked(ic, IEEE80211_F_WME);
#ifdef IEEE80211_SUPPORT_SUPERG
ieee80211_syncflag_locked(ic, IEEE80211_F_TURBOP);
#endif
ieee80211_syncflag_locked(ic, IEEE80211_F_PCF);
ieee80211_syncflag_locked(ic, IEEE80211_F_BURST);
ieee80211_syncflag_ht_locked(ic, IEEE80211_FHT_HT);
ieee80211_syncflag_ht_locked(ic, IEEE80211_FHT_USEHT40);
/* NB: this handles the bpfdetach done below */
ieee80211_syncflag_ext_locked(ic, IEEE80211_FEXT_BPF);
ieee80211_syncifflag_locked(ic, IFF_PROMISC);
ieee80211_syncifflag_locked(ic, IFF_ALLMULTI);
IEEE80211_UNLOCK(ic);
ifmedia_removeall(&vap->iv_media);
ieee80211_radiotap_vdetach(vap);
ieee80211_regdomain_vdetach(vap);
ieee80211_scan_vdetach(vap);
#ifdef IEEE80211_SUPPORT_SUPERG
ieee80211_superg_vdetach(vap);
#endif
ieee80211_ht_vdetach(vap);
/* NB: must be before ieee80211_node_vdetach */
ieee80211_proto_vdetach(vap);
ieee80211_crypto_vdetach(vap);
ieee80211_power_vdetach(vap);
ieee80211_node_vdetach(vap);
ieee80211_sysctl_vdetach(vap);
if_free(ifp);
}
示例6: ieee80211_vap_attach
/*
* Activate a vap. State should have been prepared with a
* call to ieee80211_vap_setup and by the driver. On return
* from this call the vap is ready for use.
*/
int
ieee80211_vap_attach(struct ieee80211vap *vap,
ifm_change_cb_t media_change, ifm_stat_cb_t media_stat)
{
struct ifnet *ifp = vap->iv_ifp;
struct ieee80211com *ic = vap->iv_ic;
struct ifmediareq imr;
int maxrate;
IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE,
"%s: %s parent %s flags 0x%x flags_ext 0x%x\n",
__func__, ieee80211_opmode_name[vap->iv_opmode],
ic->ic_ifp->if_xname, vap->iv_flags, vap->iv_flags_ext);
/*
* Do late attach work that cannot happen until after
* the driver has had a chance to override defaults.
*/
ieee80211_node_latevattach(vap);
ieee80211_power_latevattach(vap);
maxrate = ieee80211_media_setup(ic, &vap->iv_media, vap->iv_caps,
vap->iv_opmode == IEEE80211_M_STA, media_change, media_stat);
ieee80211_media_status(ifp, &imr);
/* NB: strip explicit mode; we're actually in autoselect */
ifmedia_set(&vap->iv_media,
imr.ifm_active &~ (IFM_MMASK | IFM_IEEE80211_TURBO));
if (maxrate)
ifp->if_baudrate = IF_Mbps(maxrate);
ether_ifattach(ifp, vap->iv_myaddr);
if (vap->iv_opmode == IEEE80211_M_MONITOR) {
/* NB: disallow transmit */
ifp->if_transmit = null_transmit;
ifp->if_output = null_output;
} else {
/* hook output method setup by ether_ifattach */
vap->iv_output = ifp->if_output;
ifp->if_output = ieee80211_output;
}
/* NB: if_mtu set by ether_ifattach to ETHERMTU */
IEEE80211_LOCK(ic);
TAILQ_INSERT_TAIL(&ic->ic_vaps, vap, iv_next);
ieee80211_syncflag_locked(ic, IEEE80211_F_WME);
#ifdef IEEE80211_SUPPORT_SUPERG
ieee80211_syncflag_locked(ic, IEEE80211_F_TURBOP);
#endif
ieee80211_syncflag_locked(ic, IEEE80211_F_PCF);
ieee80211_syncflag_locked(ic, IEEE80211_F_BURST);
ieee80211_syncflag_ht_locked(ic, IEEE80211_FHT_HT);
ieee80211_syncflag_ht_locked(ic, IEEE80211_FHT_USEHT40);
ieee80211_syncifflag_locked(ic, IFF_PROMISC);
ieee80211_syncifflag_locked(ic, IFF_ALLMULTI);
IEEE80211_UNLOCK(ic);
return 1;
}
示例7: scan_mindwell
/*
* Handle mindwell requirements completed; initiate a channel
* change to the next channel asap.
*/
static void
scan_mindwell(struct ieee80211_scan_state *ss)
{
struct ieee80211com *ic = ss->ss_ic;
IEEE80211_LOCK(ic);
scan_signal(ss);
IEEE80211_UNLOCK(ic);
}
示例8: ieee80211_sysctl_radar
/**
* This function provides control to simulate Radar event
*
* @param
* SYSCTL_HANDLER_ARGS Standard arguments of the Linux sysctl handler
*
* @returns
* 0 on success, or corresponding negative error code on failure
*/
static int
ieee80211_sysctl_radar(SYSCTL_HANDLER_ARGS)
{
struct ieee80211com *ic = ctl->extra1;
IEEE80211_LOCK(ic);
ieee80211_dfs_notify_radar(ic, ic->ic_curchan);
IEEE80211_UNLOCK(ic);
return 0;
}
示例9: scan_signal
static void
scan_signal(struct ieee80211_scan_state *ss, int iflags)
{
struct ieee80211com *ic = ss->ss_ic;
IEEE80211_UNLOCK_ASSERT(ic);
IEEE80211_LOCK(ic);
scan_signal_locked(ss, iflags);
IEEE80211_UNLOCK(ic);
}
示例10: ieee80211_scan_next
/*
* Public access to scan_next for drivers that manage
* scanning themselves (e.g. for firmware-based devices).
*/
void
ieee80211_scan_next(struct ieee80211vap *vap)
{
struct ieee80211com *ic = vap->iv_ic;
struct ieee80211_scan_state *ss = ic->ic_scan;
/* wake up the scan task */
IEEE80211_LOCK(ic);
scan_signal(ss);
IEEE80211_UNLOCK(ic);
}
示例11: ieee80211_scan_done
/*
* Public access to scan_next for drivers that are not able to scan single
* channels (e.g. for firmware-based devices).
*/
void
ieee80211_scan_done(struct ieee80211vap *vap)
{
struct ieee80211com *ic = vap->iv_ic;
struct ieee80211_scan_state *ss;
IEEE80211_LOCK(ic);
ss = ic->ic_scan;
ss->ss_next = ss->ss_last; /* all channels are complete */
scan_signal(ss);
IEEE80211_UNLOCK(ic);
}
示例12: scan_curchan
/*
* Scan curchan. If this is an active scan and the channel
* is not marked passive then send probe request frame(s).
* Arrange for the channel change after maxdwell ticks.
*/
static void
scan_curchan(struct ieee80211_scan_state *ss, unsigned long maxdwell)
{
struct ieee80211vap *vap = ss->ss_vap;
IEEE80211_LOCK(vap->iv_ic);
if (ss->ss_flags & IEEE80211_SCAN_ACTIVE)
ieee80211_probe_curchan(vap, 0);
callout_reset(&SCAN_PRIVATE(ss)->ss_scan_timer,
maxdwell, scan_signal, ss);
IEEE80211_UNLOCK(vap->iv_ic);
}
示例13: ieee80211_check_scan
/*
* Check the scan cache for an ap/channel to use; if that
* fails then kick off a new scan.
*/
int
ieee80211_check_scan(struct ieee80211vap *vap, int flags,
u_int duration, u_int mindwell, u_int maxdwell,
u_int nssid, const struct ieee80211_scan_ssid ssids[])
{
struct ieee80211com *ic = vap->iv_ic;
struct ieee80211_scan_state *ss = ic->ic_scan;
const struct ieee80211_scanner *scan;
int result;
scan = ieee80211_scanner_get(vap->iv_opmode);
if (scan == NULL) {
IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
"%s: no scanner support for %s mode\n",
__func__, vap->iv_opmode);
/* XXX stat */
return 0;
}
/*
* Check if there's a list of scan candidates already.
* XXX want more than the ap we're currently associated with
*/
IEEE80211_LOCK(ic);
IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
"%s: %s scan, %s%s%s%s%s\n"
, __func__
, flags & IEEE80211_SCAN_ACTIVE ? "active" : "passive"
, flags & IEEE80211_SCAN_FLUSH ? "flush" : "append"
, flags & IEEE80211_SCAN_NOPICK ? ", nopick" : ""
, flags & IEEE80211_SCAN_NOJOIN ? ", nojoin" : ""
, flags & IEEE80211_SCAN_PICK1ST ? ", pick1st" : ""
, flags & IEEE80211_SCAN_ONCE ? ", once" : ""
);
if (ss->ss_ops != scan) {
/* XXX re-use cache contents? e.g. adhoc<->sta */
flags |= IEEE80211_SCAN_FLUSH;
}
/*
* XXX TODO: separate things out a bit better.
*/
ieee80211_scan_update_locked(vap, scan);
result = ic->ic_scan_methods->sc_check_scan(scan, vap, flags, duration,
mindwell, maxdwell, nssid, ssids);
IEEE80211_UNLOCK(ic);
return (result);
}
示例14: ieee80211_syncflag_ext
void
ieee80211_syncflag_ext(struct ieee80211vap *vap, int flag)
{
struct ieee80211com *ic = vap->iv_ic;
IEEE80211_LOCK(ic);
if (flag < 0) {
flag = -flag;
vap->iv_flags_ext &= ~flag;
} else
vap->iv_flags_ext |= flag;
ieee80211_syncflag_ext_locked(ic, flag);
IEEE80211_UNLOCK(ic);
}
示例15: ieee80211_sysctl_radar
static int
ieee80211_sysctl_radar(SYSCTL_HANDLER_ARGS)
{
struct ieee80211com *ic = arg1;
int t = 0, error;
error = sysctl_handle_int(oidp, &t, 0, req);
if (error || !req->newptr)
return error;
IEEE80211_LOCK(ic);
ieee80211_dfs_notify_radar(ic, ic->ic_curchan);
IEEE80211_UNLOCK(ic);
return 0;
}