repo sync | 90ee0fa | 2012-12-18 10:08:08 -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/attribute_list.h" |
| 6 | |
| 7 | #include <ctype.h> |
| 8 | #include <linux/nl80211.h> |
| 9 | #include <netlink/attr.h> |
| 10 | #include <netlink/netlink.h> |
| 11 | |
| 12 | #include <iomanip> |
| 13 | #include <map> |
| 14 | #include <string> |
| 15 | |
| 16 | #include <base/stl_util.h> |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 17 | #include <base/stringprintf.h> |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 18 | |
| 19 | #include "shill/logging.h" |
| 20 | #include "shill/nl80211_attribute.h" |
| 21 | #include "shill/scope_logger.h" |
| 22 | |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 23 | using base::StringAppendF; |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 24 | using base::WeakPtr; |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 25 | using std::map; |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 26 | using std::string; |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 27 | |
| 28 | namespace shill { |
| 29 | |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 30 | bool AttributeList::CreateAttribute(nl80211_attrs id) { |
| 31 | if (ContainsKey(attributes_, id)) { |
| 32 | LOG(ERROR) << "Trying to re-add attribute: " << id; |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 33 | return false; |
| 34 | } |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 35 | attributes_[id] = AttributePointer(Nl80211Attribute::NewFromName(id)); |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 36 | return true; |
| 37 | } |
| 38 | |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 39 | bool AttributeList::CreateAndInitFromNlAttr(nl80211_attrs id, |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 40 | const nlattr *data) { |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 41 | if (!CreateAttribute(id)) { |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 42 | return false; |
| 43 | } |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 44 | return attributes_[id]->InitFromNlAttr(data); |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 45 | } |
| 46 | |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 47 | string AttributeList::ToString() const { |
| 48 | string output; |
| 49 | map<int, AttributePointer>::const_iterator i; |
| 50 | |
| 51 | for (i = attributes_.begin(); i != attributes_.end(); ++i) { |
| 52 | string attribute_string; |
| 53 | i->second->ToString(&attribute_string); |
| 54 | StringAppendF(&output, " Attr: %s(%d)=%s, Type: %s\n", |
| 55 | i->second->id_string(), |
| 56 | i->second->id(), |
| 57 | attribute_string.c_str(), |
| 58 | i->second->datatype_string()); |
| 59 | } |
| 60 | return output; |
| 61 | } |
| 62 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame^] | 63 | ByteString AttributeList::Encode() const { |
| 64 | ByteString result; |
| 65 | map<int, AttributePointer>::const_iterator i; |
| 66 | |
| 67 | for (i = attributes_.begin(); i != attributes_.end(); ++i) { |
| 68 | result.Append(i->second->Encode()); |
| 69 | } |
| 70 | return result; |
| 71 | } |
| 72 | |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 73 | // U8 Attribute. |
| 74 | |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 75 | bool AttributeList::GetU8AttributeValue(int id, uint8_t *value) const { |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 76 | Nl80211Attribute *attribute = GetAttribute(id); |
| 77 | if (!attribute) |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 78 | return false; |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 79 | return attribute->GetU8Value(value); |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 80 | } |
| 81 | |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 82 | bool AttributeList::CreateU8Attribute(int id, const char *id_string) { |
| 83 | if (ContainsKey(attributes_, id)) { |
| 84 | LOG(ERROR) << "Trying to re-add attribute: " << id; |
| 85 | return false; |
| 86 | } |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 87 | attributes_[id] = AttributePointer( |
| 88 | new Nl80211U8Attribute(id, id_string)); |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 89 | return true; |
| 90 | } |
| 91 | |
| 92 | bool AttributeList::SetU8AttributeValue(int id, uint8_t value) const { |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 93 | Nl80211Attribute *attribute = GetAttribute(id); |
| 94 | if (!attribute) |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 95 | return false; |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 96 | return attribute->SetU8Value(value); |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 97 | } |
| 98 | |
| 99 | |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 100 | // U16 Attribute. |
| 101 | |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 102 | bool AttributeList::GetU16AttributeValue(int id, uint16_t *value) const { |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 103 | Nl80211Attribute *attribute = GetAttribute(id); |
| 104 | if (!attribute) |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 105 | return false; |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 106 | return attribute->GetU16Value(value); |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 107 | } |
| 108 | |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 109 | bool AttributeList::CreateU16Attribute(int id, const char *id_string) { |
| 110 | if (ContainsKey(attributes_, id)) { |
| 111 | LOG(ERROR) << "Trying to re-add attribute: " << id; |
| 112 | return false; |
| 113 | } |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 114 | attributes_[id] = AttributePointer( |
| 115 | new Nl80211U16Attribute(id, id_string)); |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 116 | return true; |
| 117 | } |
| 118 | |
| 119 | bool AttributeList::SetU16AttributeValue(int id, uint16_t value) const { |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 120 | Nl80211Attribute *attribute = GetAttribute(id); |
| 121 | if (!attribute) |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 122 | return false; |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 123 | return attribute->SetU16Value(value); |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 124 | } |
| 125 | |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 126 | // U32 Attribute. |
| 127 | |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 128 | bool AttributeList::GetU32AttributeValue(int id, uint32_t *value) const { |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 129 | Nl80211Attribute *attribute = GetAttribute(id); |
| 130 | if (!attribute) |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 131 | return false; |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 132 | return attribute->GetU32Value(value); |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 133 | } |
| 134 | |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 135 | bool AttributeList::CreateU32Attribute(int id, const char *id_string) { |
| 136 | if (ContainsKey(attributes_, id)) { |
| 137 | LOG(ERROR) << "Trying to re-add attribute: " << id; |
| 138 | return false; |
| 139 | } |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 140 | attributes_[id] = AttributePointer( |
| 141 | new Nl80211U32Attribute(id, id_string)); |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 142 | return true; |
| 143 | } |
| 144 | |
| 145 | bool AttributeList::SetU32AttributeValue(int id, uint32_t value) const { |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 146 | Nl80211Attribute *attribute = GetAttribute(id); |
| 147 | if (!attribute) |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 148 | return false; |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 149 | return attribute->SetU32Value(value); |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 150 | } |
| 151 | |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 152 | // U64 Attribute. |
| 153 | |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 154 | bool AttributeList::GetU64AttributeValue(int id, uint64_t *value) const { |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 155 | Nl80211Attribute *attribute = GetAttribute(id); |
| 156 | if (!attribute) |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 157 | return false; |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 158 | return attribute->GetU64Value(value); |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 159 | } |
| 160 | |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 161 | bool AttributeList::CreateU64Attribute(int id, const char *id_string) { |
| 162 | if (ContainsKey(attributes_, id)) { |
| 163 | LOG(ERROR) << "Trying to re-add attribute: " << id; |
| 164 | return false; |
| 165 | } |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 166 | attributes_[id] = AttributePointer( |
| 167 | new Nl80211U64Attribute(id, id_string)); |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 168 | return true; |
| 169 | } |
| 170 | |
| 171 | bool AttributeList::SetU64AttributeValue(int id, uint64_t value) const { |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 172 | Nl80211Attribute *attribute = GetAttribute(id); |
| 173 | if (!attribute) |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 174 | return false; |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 175 | return attribute->SetU64Value(value); |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 176 | } |
| 177 | |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 178 | // Flag Attribute. |
| 179 | |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 180 | bool AttributeList::GetFlagAttributeValue(int id, bool *value) const { |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 181 | Nl80211Attribute *attribute = GetAttribute(id); |
| 182 | if (!attribute) |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 183 | return false; |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 184 | return attribute->GetFlagValue(value); |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 185 | } |
| 186 | |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 187 | bool AttributeList::CreateFlagAttribute(int id, const char *id_string) { |
| 188 | if (ContainsKey(attributes_, id)) { |
| 189 | LOG(ERROR) << "Trying to re-add attribute: " << id; |
| 190 | return false; |
| 191 | } |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 192 | attributes_[id] = AttributePointer( |
| 193 | new Nl80211FlagAttribute(id, id_string)); |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 194 | return true; |
| 195 | } |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 196 | |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 197 | bool AttributeList::SetFlagAttributeValue(int id, bool value) const { |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 198 | Nl80211Attribute *attribute = GetAttribute(id); |
| 199 | if (!attribute) |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 200 | return false; |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 201 | return attribute->SetFlagValue(value); |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 202 | } |
| 203 | |
| 204 | bool AttributeList::IsFlagAttributeTrue(int id) const { |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 205 | bool flag; |
| 206 | if (!GetFlagAttributeValue(id, &flag)) { |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 207 | return false; |
| 208 | } |
| 209 | return flag; |
| 210 | } |
| 211 | |
| 212 | // String Attribute. |
| 213 | |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 214 | bool AttributeList::GetStringAttributeValue(int id, string *value) const { |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 215 | Nl80211Attribute *attribute = GetAttribute(id); |
| 216 | if (!attribute) |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 217 | return false; |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 218 | return attribute->GetStringValue(value); |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 219 | } |
| 220 | |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 221 | bool AttributeList::CreateStringAttribute(int id, const char *id_string) { |
| 222 | if (ContainsKey(attributes_, id)) { |
| 223 | LOG(ERROR) << "Trying to re-add attribute: " << id; |
| 224 | return false; |
| 225 | } |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 226 | attributes_[id] = AttributePointer( |
| 227 | new Nl80211StringAttribute(id, id_string)); |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 228 | return true; |
| 229 | } |
| 230 | |
| 231 | bool AttributeList::SetStringAttributeValue(int id, string value) const { |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 232 | Nl80211Attribute *attribute = GetAttribute(id); |
| 233 | if (!attribute) |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 234 | return false; |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 235 | return attribute->SetStringValue(value); |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 236 | } |
| 237 | |
| 238 | // Nested Attribute. |
| 239 | |
| 240 | bool AttributeList::GetNestedAttributeValue( |
| 241 | int id, WeakPtr<AttributeList> *value) const { |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 242 | Nl80211Attribute *attribute = GetAttribute(id); |
| 243 | if (!attribute) |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 244 | return false; |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 245 | return attribute->GetNestedValue(value); |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 246 | } |
| 247 | |
| 248 | bool AttributeList::CreateNestedAttribute(int id, const char *id_string) { |
| 249 | if (ContainsKey(attributes_, id)) { |
| 250 | LOG(ERROR) << "Trying to re-add attribute: " << id; |
| 251 | return false; |
| 252 | } |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 253 | attributes_[id] = AttributePointer( |
| 254 | new Nl80211NestedAttribute(id, id_string)); |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 255 | return true; |
| 256 | } |
| 257 | |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 258 | // Raw Attribute. |
| 259 | |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 260 | bool AttributeList::GetRawAttributeValue(int id, |
| 261 | ByteString *output) const { |
| 262 | Nl80211Attribute *attribute = GetAttribute(id); |
| 263 | if (!attribute) |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 264 | return false; |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 265 | |
| 266 | ByteString raw_value; |
| 267 | |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 268 | if (!attribute->GetRawValue(&raw_value)) |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 269 | return false; |
| 270 | |
| 271 | if (output) { |
| 272 | const nlattr *const_data = |
| 273 | reinterpret_cast<const nlattr *>(raw_value.GetConstData()); |
| 274 | // nla_data and nla_len don't change their parameters but don't declare |
| 275 | // them to be const. Hence the cast. |
| 276 | nlattr *data_nlattr = const_cast<nlattr *>(const_data); |
| 277 | *output = ByteString( |
| 278 | reinterpret_cast<unsigned char *>(nla_data(data_nlattr)), |
| 279 | nla_len(data_nlattr)); |
| 280 | } |
| 281 | return true; |
| 282 | } |
| 283 | |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 284 | const Nl80211RawAttribute *AttributeList::GetRawAttribute( |
| 285 | int id) const { |
| 286 | if (!HasRawAttribute(id)) { |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 287 | LOG(ERROR) << "No attribute " << id << " of type kTypeRaw exists."; |
| 288 | return NULL; |
| 289 | } |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 290 | const Nl80211RawAttribute *attr = |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 291 | reinterpret_cast<const Nl80211RawAttribute *>(GetAttribute(id)); |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 292 | return attr; |
| 293 | } |
| 294 | |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 295 | Nl80211Attribute *AttributeList::GetAttribute(int id) const { |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 296 | map<int, AttributePointer>::const_iterator i; |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 297 | i = attributes_.find(id); |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 298 | if (i == attributes_.end()) { |
| 299 | return NULL; |
| 300 | } |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 301 | return i->second.get(); |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 302 | } |
| 303 | |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 304 | bool AttributeList::HasRawAttribute(int id) const { |
| 305 | map<int, AttributePointer>::const_iterator i; |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 306 | i = attributes_.find(id); |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 307 | if (i == attributes_.end()) { |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 308 | LOG(ERROR) << "FALSE - Didn't find id " << id; |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 309 | return false; |
| 310 | } |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 311 | return (i->second->datatype() == Nl80211Attribute::kTypeRaw) ? true : false; |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 312 | } |
| 313 | |
| 314 | |
| 315 | } // namespace shill |