Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "shill/nl80211_attribute.h" |
| 6 | |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 7 | #include <netlink/attr.h> |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 8 | |
Wade Guthrie | f54872f | 2013-04-11 15:11:50 -0700 | [diff] [blame] | 9 | #include <string> |
| 10 | |
| 11 | #include <base/bind.h> |
| 12 | #include <base/format_macros.h> |
| 13 | #include <base/stringprintf.h> |
| 14 | |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 15 | #include "shill/logging.h" |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 16 | |
Wade Guthrie | f54872f | 2013-04-11 15:11:50 -0700 | [diff] [blame] | 17 | using base::Bind; |
| 18 | using base::StringPrintf; |
| 19 | using std::string; |
| 20 | |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 21 | namespace shill { |
| 22 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame] | 23 | const int Nl80211AttributeCookie::kName = NL80211_ATTR_COOKIE; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 24 | const char Nl80211AttributeCookie::kNameString[] = "NL80211_ATTR_COOKIE"; |
| 25 | |
Wade Guthrie | f54872f | 2013-04-11 15:11:50 -0700 | [diff] [blame] | 26 | const int Nl80211AttributeBss::kName = NL80211_ATTR_BSS; |
| 27 | const char Nl80211AttributeBss::kNameString[] = "NL80211_ATTR_BSS"; |
| 28 | const int Nl80211AttributeBss::kChannelsAttributeId = 0x24; |
| 29 | const int Nl80211AttributeBss::kChallengeTextAttributeId = 0x10; |
| 30 | const int Nl80211AttributeBss::kCountryInfoAttributeId = 0x07; |
| 31 | const int Nl80211AttributeBss::kDSParameterSetAttributeId = 0x03; |
| 32 | const int Nl80211AttributeBss::kErpAttributeId = 0x2a; |
| 33 | const int Nl80211AttributeBss::kExtendedRatesAttributeId = 0x32; |
| 34 | const int Nl80211AttributeBss::kHtCapAttributeId = 0x2d; |
| 35 | const int Nl80211AttributeBss::kHtInfoAttributeId = 0x3d; |
| 36 | const int Nl80211AttributeBss::kPowerCapabilityAttributeId = 0x21; |
| 37 | const int Nl80211AttributeBss::kPowerConstraintAttributeId = 0x20; |
| 38 | const int Nl80211AttributeBss::kRequestAttributeId = 0x0a; |
| 39 | const int Nl80211AttributeBss::kRsnAttributeId = 0x30; |
| 40 | const int Nl80211AttributeBss::kSsidAttributeId = 0x00; |
| 41 | const int Nl80211AttributeBss::kSupportedRatesAttributeId = 0x01; |
| 42 | const int Nl80211AttributeBss::kTcpReportAttributeId = 0x23; |
| 43 | const int Nl80211AttributeBss::kVendorSpecificAttributeId = 0xdd; |
| 44 | |
| 45 | static const char kSsidString[] = "SSID"; |
| 46 | static const char kRatesString[] = "Rates"; |
| 47 | |
| 48 | Nl80211AttributeBss::Nl80211AttributeBss() |
| 49 | : NetlinkNestedAttribute(kName, kNameString) { |
| 50 | nested_template_.push_back(NestedData(NLA_U32, "__NL80211_BSS_INVALID", |
| 51 | false)); |
| 52 | nested_template_.push_back(NestedData(NLA_UNSPEC, "NL80211_BSS_BSSID", |
| 53 | false)); |
| 54 | nested_template_.push_back(NestedData(NLA_U32, "NL80211_BSS_FREQUENCY", |
| 55 | false)); |
| 56 | nested_template_.push_back(NestedData(NLA_U64, "NL80211_BSS_TSF", false)); |
| 57 | nested_template_.push_back(NestedData(NLA_U16, "NL80211_BSS_BEACON_INTERVAL", |
| 58 | false)); |
| 59 | nested_template_.push_back(NestedData(NLA_U16, "NL80211_BSS_CAPABILITY", |
| 60 | false)); |
| 61 | nested_template_.push_back(NestedData( |
| 62 | NLA_UNSPEC, "NL80211_BSS_INFORMATION_ELEMENTS", false, |
| 63 | Bind(&Nl80211AttributeBss::ParseInformationElements))); |
| 64 | nested_template_.push_back(NestedData(NLA_U32, "NL80211_BSS_SIGNAL_MBM", |
| 65 | false)); |
| 66 | nested_template_.push_back(NestedData(NLA_U8, "NL80211_BSS_SIGNAL_UNSPEC", |
| 67 | false)); |
| 68 | nested_template_.push_back(NestedData(NLA_U32, "NL80211_BSS_STATUS", |
| 69 | false)); |
| 70 | nested_template_.push_back(NestedData(NLA_U32, "NL80211_BSS_SEEN_MS_AGO", |
| 71 | false)); |
| 72 | nested_template_.push_back(NestedData(NLA_UNSPEC, "NL80211_BSS_BEACON_IES", |
| 73 | false)); |
| 74 | } |
| 75 | |
| 76 | bool Nl80211AttributeBss::ParseInformationElements( |
| 77 | AttributeList *attribute_list, size_t id, const string &attribute_name, |
| 78 | ByteString data) { |
| 79 | if (!attribute_list) { |
| 80 | LOG(ERROR) << "NULL |attribute_list| parameter"; |
| 81 | return false; |
| 82 | } |
| 83 | attribute_list->CreateNestedAttribute(id, attribute_name.c_str()); |
| 84 | |
| 85 | // Now, handle the nested data. |
| 86 | AttributeListRefPtr ie_attribute; |
| 87 | if (!attribute_list->GetNestedAttributeList(id, &ie_attribute) || |
| 88 | !ie_attribute) { |
| 89 | LOG(ERROR) << "Couldn't get attribute " << attribute_name |
| 90 | << " which we just created."; |
| 91 | return false; |
| 92 | } |
| 93 | while (data.GetLength()) { |
| 94 | const uint8_t *sub_attribute = data.GetConstData(); |
| 95 | const size_t kHeaderBytes = 2; |
| 96 | uint8_t type = sub_attribute[0]; |
| 97 | uint8_t payload_bytes = sub_attribute[1]; |
| 98 | const uint8_t *payload = &sub_attribute[kHeaderBytes]; |
| 99 | // See http://dox.ipxe.org/ieee80211_8h_source.html for more info on types |
| 100 | // and data inside information elements. |
| 101 | switch (type) { |
| 102 | case kSsidAttributeId: { |
| 103 | ie_attribute->CreateSsidAttribute(type, kSsidString); |
| 104 | if (payload_bytes == 0) { |
| 105 | ie_attribute->SetStringAttributeValue(type, ""); |
| 106 | } else { |
| 107 | ie_attribute->SetStringAttributeValue(type, string( |
| 108 | reinterpret_cast<const char *>(payload), payload_bytes)); |
| 109 | } |
| 110 | break; |
| 111 | } |
| 112 | case kSupportedRatesAttributeId: |
| 113 | case kExtendedRatesAttributeId: { |
| 114 | ie_attribute->CreateNestedAttribute(type, kRatesString); |
| 115 | AttributeListRefPtr rates_attribute; |
| 116 | if (!ie_attribute->GetNestedAttributeList(type, &rates_attribute) || |
| 117 | !rates_attribute) { |
| 118 | LOG(ERROR) << "Couldn't get attribute " << attribute_name |
| 119 | << " which we just created."; |
| 120 | break; |
| 121 | } |
| 122 | // Extract each rate, add it to the list. |
| 123 | for (size_t i = 0; i < payload_bytes; ++i) { |
| 124 | string rate_name = StringPrintf("Rate-%zu", i); |
| 125 | rates_attribute->CreateU8Attribute(i, rate_name.c_str()); |
| 126 | rates_attribute->SetU8AttributeValue(i, payload[i]); |
| 127 | } |
| 128 | ie_attribute->SetNestedAttributeHasAValue(type); |
| 129 | break; |
| 130 | } |
| 131 | case kDSParameterSetAttributeId: |
| 132 | case kCountryInfoAttributeId: |
| 133 | case kRequestAttributeId: |
| 134 | case kChallengeTextAttributeId: |
| 135 | case kPowerConstraintAttributeId: |
| 136 | case kPowerCapabilityAttributeId: |
| 137 | case kTcpReportAttributeId: |
| 138 | case kChannelsAttributeId: |
| 139 | case kErpAttributeId: |
| 140 | case kHtCapAttributeId: |
| 141 | case kRsnAttributeId: |
| 142 | case kHtInfoAttributeId: |
| 143 | case kVendorSpecificAttributeId: |
| 144 | default: |
| 145 | break; |
| 146 | } |
| 147 | data.RemovePrefix(kHeaderBytes + payload_bytes); |
| 148 | } |
| 149 | attribute_list->SetNestedAttributeHasAValue(id); |
| 150 | return true; |
| 151 | } |
| 152 | |
Wade Guthrie | 1f355e8 | 2013-04-11 15:46:12 -0700 | [diff] [blame] | 153 | const int Nl80211AttributeWiphyBands::kName = NL80211_ATTR_WIPHY_BANDS; |
| 154 | const char Nl80211AttributeWiphyBands::kNameString[] = |
| 155 | "NL80211_ATTR_WIPHY_BANDS"; |
| 156 | |
| 157 | Nl80211AttributeWiphyBands::Nl80211AttributeWiphyBands() |
| 158 | : NetlinkNestedAttribute(kName, kNameString) { |
| 159 | // Frequencies |
| 160 | NestedData freq(NLA_NESTED, "NL80211_BAND_ATTR_FREQ", true); |
| 161 | freq.deeper_nesting.push_back( |
| 162 | NestedData(NLA_U32, "__NL80211_FREQUENCY_ATTR_INVALID", false)); |
| 163 | freq.deeper_nesting.push_back( |
| 164 | NestedData(NLA_U32, "NL80211_FREQUENCY_ATTR_FREQ", false)); |
| 165 | freq.deeper_nesting.push_back( |
| 166 | NestedData(NLA_FLAG, "NL80211_FREQUENCY_ATTR_DISABLED", false)); |
| 167 | freq.deeper_nesting.push_back( |
| 168 | NestedData(NLA_FLAG, "NL80211_FREQUENCY_ATTR_PASSIVE_SCAN", false)); |
| 169 | freq.deeper_nesting.push_back( |
| 170 | NestedData(NLA_FLAG, "NL80211_FREQUENCY_ATTR_NO_IBSS", false)); |
| 171 | freq.deeper_nesting.push_back( |
| 172 | NestedData(NLA_FLAG, "NL80211_FREQUENCY_ATTR_RADAR", false)); |
| 173 | freq.deeper_nesting.push_back( |
| 174 | NestedData(NLA_U32, "NL80211_FREQUENCY_ATTR_MAX_TX_POWER", false)); |
| 175 | |
| 176 | NestedData freqs(NLA_NESTED, "NL80211_BAND_ATTR_FREQS", false); |
| 177 | freqs.deeper_nesting.push_back(freq); |
| 178 | |
| 179 | // Rates |
| 180 | NestedData rate(NLA_NESTED, "NL80211_BAND_ATTR_RATE", true); |
| 181 | rate.deeper_nesting.push_back( |
| 182 | NestedData(NLA_U32, "__NL80211_BITRATE_ATTR_INVALID", false)); |
| 183 | rate.deeper_nesting.push_back( |
| 184 | NestedData(NLA_U32, "NL80211_BITRATE_ATTR_RATE", false)); |
| 185 | rate.deeper_nesting.push_back( |
| 186 | NestedData(NLA_FLAG, "NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE", false)); |
| 187 | |
| 188 | NestedData rates(NLA_NESTED, "NL80211_BAND_ATTR_RATES", true); |
| 189 | rates.deeper_nesting.push_back(rate); |
| 190 | |
| 191 | // Main body of attribute |
| 192 | NestedData bands(NLA_NESTED, "NL80211_ATTR_BANDS", true); |
| 193 | bands.deeper_nesting.push_back( |
| 194 | NestedData(NLA_U32, "__NL80211_BAND_ATTR_INVALID,", false)); |
| 195 | bands.deeper_nesting.push_back(freqs); |
| 196 | bands.deeper_nesting.push_back(rates); |
| 197 | bands.deeper_nesting.push_back( |
| 198 | NestedData(NLA_UNSPEC, "NL80211_BAND_ATTR_HT_MCS_SET", false)); |
| 199 | bands.deeper_nesting.push_back( |
| 200 | NestedData(NLA_U16, "NL80211_BAND_ATTR_HT_CAPA", false)); |
| 201 | bands.deeper_nesting.push_back( |
| 202 | NestedData(NLA_U8, "NL80211_BAND_ATTR_HT_AMPDU_FACTOR", false)); |
| 203 | bands.deeper_nesting.push_back( |
| 204 | NestedData(NLA_U8, "NL80211_BAND_ATTR_HT_AMPDU_DENSITY", false)); |
| 205 | |
| 206 | nested_template_.push_back(bands); |
| 207 | } |
| 208 | |
| 209 | const int Nl80211AttributeCipherSuites::kName = NL80211_ATTR_CIPHER_SUITES; |
| 210 | const char Nl80211AttributeCipherSuites::kNameString[] = |
| 211 | "NL80211_ATTR_CIPHER_SUITES"; |
| 212 | |
| 213 | const int Nl80211AttributeControlPortEthertype::kName = |
| 214 | NL80211_ATTR_CONTROL_PORT_ETHERTYPE; |
| 215 | const char Nl80211AttributeControlPortEthertype::kNameString[] = |
| 216 | "NL80211_ATTR_CONTROL_PORT_ETHERTYPE"; |
| 217 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame] | 218 | const int Nl80211AttributeCqm::kName = NL80211_ATTR_CQM; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 219 | const char Nl80211AttributeCqm::kNameString[] = "NL80211_ATTR_CQM"; |
| 220 | |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 221 | Nl80211AttributeCqm::Nl80211AttributeCqm() |
Wade Guthrie | f1b3641 | 2013-04-11 14:51:31 -0700 | [diff] [blame] | 222 | : NetlinkNestedAttribute(kName, kNameString) { |
| 223 | nested_template_.push_back( |
| 224 | NestedData(NLA_U32, "__NL80211_ATTR_CQM_INVALID", false)); |
| 225 | nested_template_.push_back( |
| 226 | NestedData(NLA_U32, "NL80211_ATTR_CQM_RSSI_THOLD", false)); |
| 227 | nested_template_.push_back( |
| 228 | NestedData(NLA_U32, "NL80211_ATTR_CQM_RSSI_HYST", false)); |
| 229 | nested_template_.push_back( |
| 230 | NestedData(NLA_U32, "NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT", false)); |
| 231 | nested_template_.push_back( |
| 232 | NestedData(NLA_U32, "NL80211_ATTR_CQM_PKT_LOSS_EVENT", false)); |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 233 | } |
| 234 | |
Wade Guthrie | 1f355e8 | 2013-04-11 15:46:12 -0700 | [diff] [blame] | 235 | const int Nl80211AttributeDeviceApSme::kName = NL80211_ATTR_DEVICE_AP_SME; |
| 236 | const char Nl80211AttributeDeviceApSme::kNameString[] = |
| 237 | "NL80211_ATTR_DEVICE_AP_SME"; |
| 238 | |
Wade Guthrie | f1b3641 | 2013-04-11 14:51:31 -0700 | [diff] [blame] | 239 | const int Nl80211AttributeDisconnectedByAp::kName = |
| 240 | NL80211_ATTR_DISCONNECTED_BY_AP; |
| 241 | const char Nl80211AttributeDisconnectedByAp::kNameString[] = |
| 242 | "NL80211_ATTR_DISCONNECTED_BY_AP"; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 243 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame] | 244 | const int Nl80211AttributeDuration::kName = NL80211_ATTR_DURATION; |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 245 | const char Nl80211AttributeDuration::kNameString[] = "NL80211_ATTR_DURATION"; |
| 246 | |
Wade Guthrie | 1f355e8 | 2013-04-11 15:46:12 -0700 | [diff] [blame] | 247 | const int Nl80211AttributeFeatureFlags::kName = NL80211_ATTR_FEATURE_FLAGS; |
| 248 | const char Nl80211AttributeFeatureFlags::kNameString[] = |
| 249 | "NL80211_ATTR_FEATURE_FLAGS"; |
| 250 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame] | 251 | const int Nl80211AttributeFrame::kName = NL80211_ATTR_FRAME; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 252 | const char Nl80211AttributeFrame::kNameString[] = "NL80211_ATTR_FRAME"; |
| 253 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame] | 254 | const int Nl80211AttributeGeneration::kName = NL80211_ATTR_GENERATION; |
Wade Guthrie | f54872f | 2013-04-11 15:11:50 -0700 | [diff] [blame] | 255 | const char Nl80211AttributeGeneration::kNameString[] = |
| 256 | "NL80211_ATTR_GENERATION"; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 257 | |
Wade Guthrie | 1f355e8 | 2013-04-11 15:46:12 -0700 | [diff] [blame] | 258 | const int Nl80211AttributeHtCapabilityMask::kName = |
| 259 | NL80211_ATTR_HT_CAPABILITY_MASK; |
| 260 | const char Nl80211AttributeHtCapabilityMask::kNameString[] = |
| 261 | "NL80211_ATTR_HT_CAPABILITY_MASK"; |
| 262 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame] | 263 | const int Nl80211AttributeIfindex::kName = NL80211_ATTR_IFINDEX; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 264 | const char Nl80211AttributeIfindex::kNameString[] = "NL80211_ATTR_IFINDEX"; |
| 265 | |
Paul Stewart | 2ddf2c6 | 2013-04-16 09:47:34 -0700 | [diff] [blame] | 266 | const int Nl80211AttributeIftype::kName = NL80211_ATTR_IFTYPE; |
| 267 | const char Nl80211AttributeIftype::kNameString[] = "NL80211_ATTR_IFTYPE"; |
| 268 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame] | 269 | const int Nl80211AttributeKeyIdx::kName = NL80211_ATTR_KEY_IDX; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 270 | const char Nl80211AttributeKeyIdx::kNameString[] = "NL80211_ATTR_KEY_IDX"; |
| 271 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame] | 272 | const int Nl80211AttributeKeySeq::kName = NL80211_ATTR_KEY_SEQ; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 273 | const char Nl80211AttributeKeySeq::kNameString[] = "NL80211_ATTR_KEY_SEQ"; |
| 274 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame] | 275 | const int Nl80211AttributeKeyType::kName = NL80211_ATTR_KEY_TYPE; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 276 | const char Nl80211AttributeKeyType::kNameString[] = "NL80211_ATTR_KEY_TYPE"; |
| 277 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame] | 278 | const int Nl80211AttributeMac::kName = NL80211_ATTR_MAC; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 279 | const char Nl80211AttributeMac::kNameString[] = "NL80211_ATTR_MAC"; |
| 280 | |
Wade Guthrie | 1f355e8 | 2013-04-11 15:46:12 -0700 | [diff] [blame] | 281 | const int Nl80211AttributeMaxMatchSets::kName = NL80211_ATTR_MAX_MATCH_SETS; |
| 282 | const char Nl80211AttributeMaxMatchSets::kNameString[] = |
| 283 | "NL80211_ATTR_MAX_MATCH_SETS"; |
| 284 | |
| 285 | const int Nl80211AttributeMaxNumPmkids::kName = NL80211_ATTR_MAX_NUM_PMKIDS; |
| 286 | const char Nl80211AttributeMaxNumPmkids::kNameString[] = |
| 287 | "NL80211_ATTR_MAX_NUM_PMKIDS"; |
| 288 | |
| 289 | const int Nl80211AttributeMaxNumScanSsids::kName = |
| 290 | NL80211_ATTR_MAX_NUM_SCAN_SSIDS; |
| 291 | const char Nl80211AttributeMaxNumScanSsids::kNameString[] = |
| 292 | "NL80211_ATTR_MAX_NUM_SCAN_SSIDS"; |
| 293 | |
| 294 | const int Nl80211AttributeMaxNumSchedScanSsids::kName = |
| 295 | NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS; |
| 296 | const char Nl80211AttributeMaxNumSchedScanSsids::kNameString[] = |
| 297 | "NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS"; |
| 298 | |
| 299 | const int Nl80211AttributeMaxRemainOnChannelDuration::kName = |
| 300 | NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION; |
| 301 | const char Nl80211AttributeMaxRemainOnChannelDuration::kNameString[] = |
| 302 | "NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION"; |
| 303 | |
| 304 | const int Nl80211AttributeMaxScanIeLen::kName = NL80211_ATTR_MAX_SCAN_IE_LEN; |
| 305 | const char Nl80211AttributeMaxScanIeLen::kNameString[] = |
| 306 | "NL80211_ATTR_MAX_SCAN_IE_LEN"; |
| 307 | |
| 308 | const int Nl80211AttributeMaxSchedScanIeLen::kName = |
| 309 | NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN; |
| 310 | const char Nl80211AttributeMaxSchedScanIeLen::kNameString[] = |
| 311 | "NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN"; |
| 312 | |
| 313 | const int Nl80211AttributeOffchannelTxOk::kName = NL80211_ATTR_OFFCHANNEL_TX_OK; |
| 314 | const char Nl80211AttributeOffchannelTxOk::kNameString[] = |
| 315 | "NL80211_ATTR_OFFCHANNEL_TX_OK"; |
| 316 | |
| 317 | const int Nl80211AttributeProbeRespOffload::kName = |
| 318 | NL80211_ATTR_PROBE_RESP_OFFLOAD; |
| 319 | const char Nl80211AttributeProbeRespOffload::kNameString[] = |
| 320 | "NL80211_ATTR_PROBE_RESP_OFFLOAD"; |
| 321 | |
Wade Guthrie | f1b3641 | 2013-04-11 14:51:31 -0700 | [diff] [blame] | 322 | const int Nl80211AttributeReasonCode::kName = |
| 323 | NL80211_ATTR_REASON_CODE; |
| 324 | const char Nl80211AttributeReasonCode::kNameString[] = |
| 325 | "NL80211_ATTR_REASON_CODE"; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 326 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame] | 327 | const int Nl80211AttributeRegAlpha2::kName = NL80211_ATTR_REG_ALPHA2; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 328 | const char Nl80211AttributeRegAlpha2::kNameString[] = "NL80211_ATTR_REG_ALPHA2"; |
| 329 | |
Wade Guthrie | f1b3641 | 2013-04-11 14:51:31 -0700 | [diff] [blame] | 330 | const int Nl80211AttributeRegInitiator::kName = |
| 331 | NL80211_ATTR_REG_INITIATOR; |
| 332 | const char Nl80211AttributeRegInitiator::kNameString[] = |
| 333 | "NL80211_ATTR_REG_INITIATOR"; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 334 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame] | 335 | const int Nl80211AttributeRegType::kName = NL80211_ATTR_REG_TYPE; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 336 | const char Nl80211AttributeRegType::kNameString[] = "NL80211_ATTR_REG_TYPE"; |
| 337 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame] | 338 | const int Nl80211AttributeRespIe::kName = NL80211_ATTR_RESP_IE; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 339 | const char Nl80211AttributeRespIe::kNameString[] = "NL80211_ATTR_RESP_IE"; |
| 340 | |
Wade Guthrie | 1f355e8 | 2013-04-11 15:46:12 -0700 | [diff] [blame] | 341 | const int Nl80211AttributeRoamSupport::kName = NL80211_ATTR_ROAM_SUPPORT; |
| 342 | const char Nl80211AttributeRoamSupport::kNameString[] = |
| 343 | "NL80211_ATTR_ROAM_SUPPORT"; |
| 344 | |
Wade Guthrie | f1b3641 | 2013-04-11 14:51:31 -0700 | [diff] [blame] | 345 | const int Nl80211AttributeScanFrequencies::kName = |
| 346 | NL80211_ATTR_SCAN_FREQUENCIES; |
| 347 | const char Nl80211AttributeScanFrequencies::kNameString[] = |
| 348 | "NL80211_ATTR_SCAN_FREQUENCIES"; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 349 | |
Wade Guthrie | d3dfd6c | 2013-02-28 17:40:36 -0800 | [diff] [blame] | 350 | Nl80211AttributeScanFrequencies::Nl80211AttributeScanFrequencies() |
Wade Guthrie | f1b3641 | 2013-04-11 14:51:31 -0700 | [diff] [blame] | 351 | : NetlinkNestedAttribute(kName, kNameString) { |
| 352 | nested_template_.push_back( |
| 353 | NestedData(NLA_U32, "NL80211_SCAN_FREQ", true)); |
Wade Guthrie | d3dfd6c | 2013-02-28 17:40:36 -0800 | [diff] [blame] | 354 | } |
| 355 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame] | 356 | const int Nl80211AttributeScanSsids::kName = NL80211_ATTR_SCAN_SSIDS; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 357 | const char Nl80211AttributeScanSsids::kNameString[] = "NL80211_ATTR_SCAN_SSIDS"; |
| 358 | |
Wade Guthrie | d3dfd6c | 2013-02-28 17:40:36 -0800 | [diff] [blame] | 359 | Nl80211AttributeScanSsids::Nl80211AttributeScanSsids() |
Wade Guthrie | f1b3641 | 2013-04-11 14:51:31 -0700 | [diff] [blame] | 360 | : NetlinkNestedAttribute(kName, kNameString) { |
| 361 | nested_template_.push_back( |
| 362 | NestedData(NLA_STRING, "NL80211_SCAN_SSID", true)); |
Wade Guthrie | d3dfd6c | 2013-02-28 17:40:36 -0800 | [diff] [blame] | 363 | } |
| 364 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame] | 365 | const int Nl80211AttributeStaInfo::kName = NL80211_ATTR_STA_INFO; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 366 | const char Nl80211AttributeStaInfo::kNameString[] = "NL80211_ATTR_STA_INFO"; |
| 367 | |
Wade Guthrie | d3dfd6c | 2013-02-28 17:40:36 -0800 | [diff] [blame] | 368 | Nl80211AttributeStaInfo::Nl80211AttributeStaInfo() |
Wade Guthrie | f1b3641 | 2013-04-11 14:51:31 -0700 | [diff] [blame] | 369 | : NetlinkNestedAttribute(kName, kNameString) { |
Wade Guthrie | f1b3641 | 2013-04-11 14:51:31 -0700 | [diff] [blame] | 370 | NestedData tx_rates(NLA_NESTED, "NL80211_STA_INFO_TX_BITRATE", false); |
| 371 | tx_rates.deeper_nesting.push_back( |
| 372 | NestedData(NLA_U32, "__NL80211_RATE_INFO_INVALID", false)); |
| 373 | tx_rates.deeper_nesting.push_back( |
| 374 | NestedData(NLA_U16, "NL80211_RATE_INFO_BITRATE", false)); |
| 375 | tx_rates.deeper_nesting.push_back( |
| 376 | NestedData(NLA_U8, "NL80211_RATE_INFO_MCS", false)); |
| 377 | tx_rates.deeper_nesting.push_back( |
| 378 | NestedData(NLA_FLAG, "NL80211_RATE_INFO_40_MHZ_WIDTH", false)); |
| 379 | tx_rates.deeper_nesting.push_back( |
| 380 | NestedData(NLA_FLAG, "NL80211_RATE_INFO_SHORT_GI", false)); |
Wade Guthrie | d3dfd6c | 2013-02-28 17:40:36 -0800 | [diff] [blame] | 381 | |
Wade Guthrie | f1b3641 | 2013-04-11 14:51:31 -0700 | [diff] [blame] | 382 | NestedData rx_rates(NLA_NESTED, "NL80211_STA_INFO_RX_BITRATE", false); |
| 383 | rx_rates.deeper_nesting = tx_rates.deeper_nesting; |
Wade Guthrie | d3dfd6c | 2013-02-28 17:40:36 -0800 | [diff] [blame] | 384 | |
Wade Guthrie | f1b3641 | 2013-04-11 14:51:31 -0700 | [diff] [blame] | 385 | NestedData bss(NLA_NESTED, "NL80211_STA_INFO_BSS_PARAM", false); |
| 386 | bss.deeper_nesting.push_back( |
| 387 | NestedData(NLA_U32, "__NL80211_STA_BSS_PARAM_INVALID", false)); |
| 388 | bss.deeper_nesting.push_back( |
| 389 | NestedData(NLA_FLAG, "NL80211_STA_BSS_PARAM_CTS_PROT", false)); |
| 390 | bss.deeper_nesting.push_back( |
| 391 | NestedData(NLA_FLAG, "NL80211_STA_BSS_PARAM_SHORT_PREAMBLE", |
| 392 | false)); |
| 393 | bss.deeper_nesting.push_back( |
| 394 | NestedData(NLA_FLAG, "NL80211_STA_BSS_PARAM_SHORT_SLOT_TIME", |
| 395 | false)); |
| 396 | bss.deeper_nesting.push_back( |
| 397 | NestedData(NLA_U8, "NL80211_STA_BSS_PARAM_DTIM_PERIOD", false)); |
| 398 | bss.deeper_nesting.push_back( |
| 399 | NestedData(NLA_U16, "NL80211_STA_BSS_PARAM_BEACON_INTERVAL", false)); |
Wade Guthrie | d3dfd6c | 2013-02-28 17:40:36 -0800 | [diff] [blame] | 400 | |
Wade Guthrie | f1b3641 | 2013-04-11 14:51:31 -0700 | [diff] [blame] | 401 | nested_template_.push_back( |
| 402 | NestedData(NLA_U32, "__NL80211_STA_INFO_INVALID", false)); |
| 403 | nested_template_.push_back( |
| 404 | NestedData(NLA_U32, "NL80211_STA_INFO_INACTIVE_TIME", false)); |
| 405 | nested_template_.push_back( |
| 406 | NestedData(NLA_U32, "NL80211_STA_INFO_RX_BYTES", false)); |
| 407 | nested_template_.push_back( |
| 408 | NestedData(NLA_U32, "NL80211_STA_INFO_TX_BYTES", false)); |
| 409 | nested_template_.push_back( |
| 410 | NestedData(NLA_U16, "NL80211_STA_INFO_LLID", false)); |
| 411 | nested_template_.push_back( |
| 412 | NestedData(NLA_U16, "NL80211_STA_INFO_PLID", false)); |
| 413 | nested_template_.push_back( |
| 414 | NestedData(NLA_U8, "NL80211_STA_INFO_PLINK_STATE", false)); |
| 415 | nested_template_.push_back( |
| 416 | NestedData(NLA_U8, "NL80211_STA_INFO_SIGNAL", false)); |
| 417 | nested_template_.push_back(tx_rates); |
| 418 | nested_template_.push_back( |
| 419 | NestedData(NLA_U32, "NL80211_STA_INFO_RX_PACKETS", false)); |
| 420 | nested_template_.push_back( |
| 421 | NestedData(NLA_U32, "NL80211_STA_INFO_TX_PACKETS", false)); |
| 422 | nested_template_.push_back( |
| 423 | NestedData(NLA_U32, "NL80211_STA_INFO_TX_RETRIES", false)); |
| 424 | nested_template_.push_back( |
| 425 | NestedData(NLA_U32, "NL80211_STA_INFO_TX_FAILED", false)); |
| 426 | nested_template_.push_back( |
| 427 | NestedData(NLA_U8, "NL80211_STA_INFO_SIGNAL_AVG", false)); |
| 428 | nested_template_.push_back(rx_rates); |
| 429 | nested_template_.push_back(bss); |
| 430 | nested_template_.push_back( |
| 431 | NestedData(NLA_U32, "NL80211_STA_INFO_CONNECTED_TIME", false)); |
| 432 | nested_template_.push_back( |
| 433 | NestedData(NLA_U64, "NL80211_STA_INFO_STA_FLAGS", false)); |
| 434 | nested_template_.push_back( |
| 435 | NestedData(NLA_U32, "NL80211_STA_INFO_BEACON_LOSS", false)); |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 436 | } |
| 437 | |
Wade Guthrie | f1b3641 | 2013-04-11 14:51:31 -0700 | [diff] [blame] | 438 | const int Nl80211AttributeStatusCode::kName = |
| 439 | NL80211_ATTR_STATUS_CODE; |
| 440 | const char Nl80211AttributeStatusCode::kNameString[] = |
| 441 | "NL80211_ATTR_STATUS_CODE"; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 442 | |
Wade Guthrie | 1f355e8 | 2013-04-11 15:46:12 -0700 | [diff] [blame] | 443 | const int Nl80211AttributeSupportApUapsd::kName = NL80211_ATTR_SUPPORT_AP_UAPSD; |
| 444 | const char Nl80211AttributeSupportApUapsd::kNameString[] = |
| 445 | "NL80211_ATTR_SUPPORT_AP_UAPSD"; |
| 446 | |
| 447 | const int Nl80211AttributeSupportIbssRsn::kName = NL80211_ATTR_SUPPORT_IBSS_RSN; |
| 448 | const char Nl80211AttributeSupportIbssRsn::kNameString[] = |
| 449 | "NL80211_ATTR_SUPPORT_IBSS_RSN"; |
| 450 | |
Wade Guthrie | f1b3641 | 2013-04-11 14:51:31 -0700 | [diff] [blame] | 451 | const int Nl80211AttributeSupportMeshAuth::kName = |
| 452 | NL80211_ATTR_SUPPORT_MESH_AUTH; |
| 453 | const char Nl80211AttributeSupportMeshAuth::kNameString[] = |
| 454 | "NL80211_ATTR_SUPPORT_MESH_AUTH"; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 455 | |
Wade Guthrie | 1f355e8 | 2013-04-11 15:46:12 -0700 | [diff] [blame] | 456 | const int Nl80211AttributeTdlsExternalSetup::kName = |
| 457 | NL80211_ATTR_TDLS_EXTERNAL_SETUP; |
| 458 | const char Nl80211AttributeTdlsExternalSetup::kNameString[] = |
| 459 | "NL80211_ATTR_TDLS_EXTERNAL_SETUP"; |
| 460 | |
| 461 | const int Nl80211AttributeTdlsSupport::kName = NL80211_ATTR_TDLS_SUPPORT; |
| 462 | const char Nl80211AttributeTdlsSupport::kNameString[] = |
| 463 | "NL80211_ATTR_TDLS_SUPPORT"; |
| 464 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame] | 465 | const int Nl80211AttributeTimedOut::kName = NL80211_ATTR_TIMED_OUT; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 466 | const char Nl80211AttributeTimedOut::kNameString[] = "NL80211_ATTR_TIMED_OUT"; |
| 467 | |
Wade Guthrie | 1f355e8 | 2013-04-11 15:46:12 -0700 | [diff] [blame] | 468 | const int Nl80211AttributeWiphyAntennaAvailRx::kName = |
| 469 | NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX; |
| 470 | const char Nl80211AttributeWiphyAntennaAvailRx::kNameString[] = |
| 471 | "NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX"; |
| 472 | |
| 473 | const int Nl80211AttributeWiphyAntennaAvailTx::kName = |
| 474 | NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX; |
| 475 | const char Nl80211AttributeWiphyAntennaAvailTx::kNameString[] = |
| 476 | "NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX"; |
| 477 | |
| 478 | const int Nl80211AttributeWiphyAntennaRx::kName = NL80211_ATTR_WIPHY_ANTENNA_RX; |
| 479 | const char Nl80211AttributeWiphyAntennaRx::kNameString[] = |
| 480 | "NL80211_ATTR_WIPHY_ANTENNA_RX"; |
| 481 | |
| 482 | const int Nl80211AttributeWiphyAntennaTx::kName = NL80211_ATTR_WIPHY_ANTENNA_TX; |
| 483 | const char Nl80211AttributeWiphyAntennaTx::kNameString[] = |
| 484 | "NL80211_ATTR_WIPHY_ANTENNA_TX"; |
| 485 | |
| 486 | const int Nl80211AttributeWiphyCoverageClass::kName = |
| 487 | NL80211_ATTR_WIPHY_COVERAGE_CLASS; |
| 488 | const char Nl80211AttributeWiphyCoverageClass::kNameString[] = |
| 489 | "NL80211_ATTR_WIPHY_COVERAGE_CLASS"; |
| 490 | |
| 491 | const int Nl80211AttributeWiphyFragThreshold::kName = |
| 492 | NL80211_ATTR_WIPHY_FRAG_THRESHOLD; |
| 493 | const char Nl80211AttributeWiphyFragThreshold::kNameString[] = |
| 494 | "NL80211_ATTR_WIPHY_FRAG_THRESHOLD"; |
| 495 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame] | 496 | const int Nl80211AttributeWiphyFreq::kName = NL80211_ATTR_WIPHY_FREQ; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 497 | const char Nl80211AttributeWiphyFreq::kNameString[] = "NL80211_ATTR_WIPHY_FREQ"; |
| 498 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame] | 499 | const int Nl80211AttributeWiphy::kName = NL80211_ATTR_WIPHY; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 500 | const char Nl80211AttributeWiphy::kNameString[] = "NL80211_ATTR_WIPHY"; |
| 501 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame] | 502 | const int Nl80211AttributeWiphyName::kName = NL80211_ATTR_WIPHY_NAME; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 503 | const char Nl80211AttributeWiphyName::kNameString[] = "NL80211_ATTR_WIPHY_NAME"; |
| 504 | |
Wade Guthrie | 1f355e8 | 2013-04-11 15:46:12 -0700 | [diff] [blame] | 505 | const int Nl80211AttributeWiphyRetryLong::kName = NL80211_ATTR_WIPHY_RETRY_LONG; |
| 506 | const char Nl80211AttributeWiphyRetryLong::kNameString[] = |
| 507 | "NL80211_ATTR_WIPHY_RETRY_LONG"; |
| 508 | |
| 509 | const int Nl80211AttributeWiphyRetryShort::kName = |
| 510 | NL80211_ATTR_WIPHY_RETRY_SHORT; |
| 511 | const char Nl80211AttributeWiphyRetryShort::kNameString[] = |
| 512 | "NL80211_ATTR_WIPHY_RETRY_SHORT"; |
| 513 | |
| 514 | const int Nl80211AttributeWiphyRtsThreshold::kName = |
| 515 | NL80211_ATTR_WIPHY_RTS_THRESHOLD; |
| 516 | const char Nl80211AttributeWiphyRtsThreshold::kNameString[] = |
| 517 | "NL80211_ATTR_WIPHY_RTS_THRESHOLD"; |
| 518 | |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 519 | } // namespace shill |