spectmgmt.c
Go to the documentation of this file.
00001 /*
00002  * spectrum management
00003  *
00004  * Copyright 2003, Jouni Malinen <jkmaline@cc.hut.fi>
00005  * Copyright 2002-2005, Instant802 Networks, Inc.
00006  * Copyright 2005-2006, Devicescape Software, Inc.
00007  * Copyright 2006-2007  Jiri Benc <jbenc@suse.cz>
00008  * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
00009  * Copyright 2007-2008, Intel Corporation
00010  * Copyright 2008, Johannes Berg <johannes@sipsolutions.net>
00011  *
00012  * This program is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU General Public License version 2 as
00014  * published by the Free Software Foundation.
00015  */
00016 
00017 #include <linux/ieee80211.h>
00018 #include <net/cfg80211.h>
00019 #include <net/mac80211.h>
00020 #include "ieee80211_i.h"
00021 #include "sta_info.h"
00022 #include "wme.h"
00023 
00024 static void ieee80211_send_refuse_measurement_request(struct ieee80211_sub_if_data *sdata,
00025                                         struct ieee80211_msrment_ie *request_ie,
00026                                         const u8 *da, const u8 *bssid,
00027                                         u8 dialog_token)
00028 {
00029         struct ieee80211_local *local = sdata->local;
00030         struct sk_buff *skb;
00031         struct ieee80211_mgmt *msr_report;
00032 
00033         skb = dev_alloc_skb(sizeof(*msr_report) + local->hw.extra_tx_headroom +
00034                                 sizeof(struct ieee80211_msrment_ie));
00035         if (!skb)
00036                 return;
00037 
00038         skb_reserve(skb, local->hw.extra_tx_headroom);
00039         msr_report = (struct ieee80211_mgmt *)skb_put(skb, 24);
00040         memset(msr_report, 0, 24);
00041         memcpy(msr_report->da, da, ETH_ALEN);
00042         memcpy(msr_report->sa, sdata->vif.addr, ETH_ALEN);
00043         memcpy(msr_report->bssid, bssid, ETH_ALEN);
00044         msr_report->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
00045                                                 IEEE80211_STYPE_ACTION);
00046 
00047         skb_put(skb, 1 + sizeof(msr_report->u.action.u.measurement));
00048         msr_report->u.action.category = WLAN_CATEGORY_SPECTRUM_MGMT;
00049         msr_report->u.action.u.measurement.action_code =
00050                                 WLAN_ACTION_SPCT_MSR_RPRT;
00051         msr_report->u.action.u.measurement.dialog_token = dialog_token;
00052 
00053         msr_report->u.action.u.measurement.element_id = WLAN_EID_MEASURE_REPORT;
00054         msr_report->u.action.u.measurement.length =
00055                         sizeof(struct ieee80211_msrment_ie);
00056 
00057         memset(&msr_report->u.action.u.measurement.msr_elem, 0,
00058                 sizeof(struct ieee80211_msrment_ie));
00059         msr_report->u.action.u.measurement.msr_elem.token = request_ie->token;
00060         msr_report->u.action.u.measurement.msr_elem.mode |=
00061                         IEEE80211_SPCT_MSR_RPRT_MODE_REFUSED;
00062         msr_report->u.action.u.measurement.msr_elem.type = request_ie->type;
00063 
00064         ieee80211_tx_skb(sdata, skb);
00065 }
00066 
00067 void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata,
00068                                        struct ieee80211_mgmt *mgmt,
00069                                        size_t len)
00070 {
00071         /*
00072          * Ignoring measurement request is spec violation.
00073          * Mandatory measurements must be reported optional
00074          * measurements might be refused or reported incapable
00075          * For now just refuse
00076          * TODO: Answer basic measurement as unmeasured
00077          */
00078         ieee80211_send_refuse_measurement_request(sdata,
00079                         &mgmt->u.action.u.measurement.msr_elem,
00080                         mgmt->sa, mgmt->bssid,
00081                         mgmt->u.action.u.measurement.dialog_token);
00082 }


ros_rt_wmp
Author(s): Danilo Tardioli, dantard@unizar.es
autogenerated on Mon Oct 6 2014 08:27:11