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 | #ifndef SHILL_NLATTRIBUTE_H_ |
| 6 | #define SHILL_NLATTRIBUTE_H_ |
| 7 | |
| 8 | #include <linux/nl80211.h> |
Wade Guthrie | 8343f7f | 2012-12-04 13:52:32 -0800 | [diff] [blame] | 9 | #include <netlink/attr.h> |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 10 | #include <netlink/netlink.h> |
| 11 | |
| 12 | #include <map> |
| 13 | #include <string> |
| 14 | |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 15 | #include <base/memory/weak_ptr.h> |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 16 | |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 17 | #include "shill/attribute_list.h" |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 18 | #include "shill/byte_string.h" |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 19 | #include "shill/logging.h" |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 20 | |
| 21 | struct nlattr; |
| 22 | |
| 23 | namespace shill { |
| 24 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 25 | // NetlinkAttribute is an abstract base class that describes an attribute in a |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 26 | // netlink-80211 message. Child classes are type-specific and will define |
| 27 | // Get*Value and Set*Value methods (where * is the type). A second-level of |
| 28 | // child classes exist for each individual attribute type. |
| 29 | // |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 30 | // An attribute has an id (which is really an enumerated value), a data type, |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 31 | // and a value. In an nlattr (the underlying format for an attribute in a |
| 32 | // message), the data is stored as a blob without type information; the writer |
| 33 | // and reader of the attribute must agree on the data type. |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 34 | class NetlinkAttribute { |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 35 | public: |
| 36 | enum Type { |
| 37 | kTypeU8, |
| 38 | kTypeU16, |
| 39 | kTypeU32, |
| 40 | kTypeU64, |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 41 | kTypeFlag, |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 42 | kTypeString, |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 43 | kTypeNested, |
| 44 | kTypeRaw, |
| 45 | kTypeError |
| 46 | }; |
| 47 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 48 | NetlinkAttribute(int id, const char *id_string, |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 49 | Type datatype, const char *datatype_string); |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 50 | virtual ~NetlinkAttribute() {} |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 51 | |
| 52 | virtual bool InitFromNlAttr(const nlattr *data); |
| 53 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 54 | // Static factory generates the appropriate NetlinkAttribute object from the |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 55 | // raw nlattr data. |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 56 | static NetlinkAttribute *NewFromId(int id); |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 57 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 58 | // Accessors for the attribute's id and datatype information. |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 59 | int id() const { return id_; } |
| 60 | virtual const char *id_string() const { return id_string_; } |
| 61 | Type datatype() const { return datatype_; } |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 62 | const char *datatype_string() const { return datatype_string_; } |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 63 | |
| 64 | // TODO(wdg): Since |data| is used, externally, to support |nla_parse_nested|, |
| 65 | // make it protected once all functionality has been brought inside the |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 66 | // NetlinkAttribute classes. |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 67 | // |
| 68 | // |data_| contains an 'nlattr *' but it's been stored as a ByteString. |
| 69 | // This returns a pointer to the data in the form that is intended. |
| 70 | const nlattr *data() const { |
| 71 | return reinterpret_cast<const nlattr *>(data_.GetConstData()); |
| 72 | } |
| 73 | |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 74 | virtual bool GetU8Value(uint8_t *value) const; |
| 75 | virtual bool SetU8Value(uint8_t new_value); |
| 76 | |
| 77 | virtual bool GetU16Value(uint16_t *value) const; |
| 78 | virtual bool SetU16Value(uint16_t value); |
| 79 | |
| 80 | virtual bool GetU32Value(uint32_t *value) const; |
| 81 | virtual bool SetU32Value(uint32_t value); |
| 82 | |
| 83 | virtual bool GetU64Value(uint64_t *value) const; |
| 84 | virtual bool SetU64Value(uint64_t value); |
| 85 | |
| 86 | virtual bool GetFlagValue(bool *value) const; |
| 87 | virtual bool SetFlagValue(bool value); |
| 88 | |
| 89 | virtual bool GetStringValue(std::string *value) const; |
| 90 | virtual bool SetStringValue(const std::string value); |
| 91 | |
| 92 | virtual bool GetNestedValue(base::WeakPtr<AttributeList> *value); |
| 93 | |
| 94 | virtual bool GetRawValue(ByteString *value) const; |
| 95 | |
Wade Guthrie | 8e27861 | 2013-02-26 10:32:34 -0800 | [diff] [blame] | 96 | // Prints the attribute info -- for debugging. |
| 97 | virtual void Print(int log_level, int indent) const; |
| 98 | |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 99 | // Fill a string with characters that represents the value of the attribute. |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 100 | // If no attribute is found or if the datatype isn't trivially stringizable, |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 101 | // this method returns 'false' and |value| remains unchanged. |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 102 | virtual bool ToString(std::string *value) const = 0; |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 103 | |
| 104 | // Writes the raw attribute data to a string. For debug. |
| 105 | std::string RawToString() const; |
| 106 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 107 | // Encodes the attribute suitably for the attributes in the payload portion |
| 108 | // of a netlink message suitable for Sockets::Send. Return value is empty on |
| 109 | // failure. |
| 110 | virtual ByteString Encode() const = 0; |
| 111 | |
Wade Guthrie | 3af8b4d | 2013-01-10 08:39:30 -0800 | [diff] [blame] | 112 | bool has_a_value() const { return has_a_value_; } |
| 113 | |
Wade Guthrie | 8343f7f | 2012-12-04 13:52:32 -0800 | [diff] [blame] | 114 | // Note that |nla_get_*| don't change their arguments but don't declare |
| 115 | // themselves as 'const', either. These methods wrap the const castness. |
| 116 | static char *NlaGetString(const nlattr *input) { |
| 117 | return nla_get_string(const_cast<nlattr *>(input)); |
| 118 | } |
| 119 | static uint8_t NlaGetU8(const nlattr *input) { |
| 120 | return nla_get_u8(const_cast<nlattr *>(input)); |
| 121 | } |
| 122 | static uint16_t NlaGetU16(const nlattr *input) { |
| 123 | return nla_get_u16(const_cast<nlattr *>(input)); |
| 124 | } |
| 125 | static uint32_t NlaGetU32(const nlattr *input) { |
| 126 | return nla_get_u32(const_cast<nlattr *>(input)); |
| 127 | } |
| 128 | static uint64_t NlaGetU64(const nlattr *input) { |
| 129 | return nla_get_u64(const_cast<nlattr *>(input)); |
| 130 | } |
| 131 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 132 | // Static factories generate the appropriate attribute object from the |
| 133 | // raw nlattr data. |
| 134 | static NetlinkAttribute *NewControlAttributeFromId(int id); |
| 135 | static NetlinkAttribute *NewNl80211AttributeFromId(int id); |
| 136 | |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 137 | protected: |
Wade Guthrie | 8e27861 | 2013-02-26 10:32:34 -0800 | [diff] [blame] | 138 | // Builds a string to precede a printout of this attribute. |
| 139 | std::string HeaderToPrint(int indent) const; |
| 140 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 141 | // Encodes the attribute suitably for the attributes in the payload portion |
| 142 | // of a netlink message suitable for Sockets::Send. Return value is empty on |
| 143 | // failure. |
| 144 | virtual ByteString EncodeGeneric(const unsigned char *data, int bytes) const; |
| 145 | |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 146 | // Raw data corresponding to the value in any of the child classes. |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 147 | // TODO(wdg): When 'data()' is removed, move this to the NetlinkRawAttribute |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 148 | // class. |
| 149 | ByteString data_; |
| 150 | |
Wade Guthrie | 3af8b4d | 2013-01-10 08:39:30 -0800 | [diff] [blame] | 151 | // True if a value has been assigned to the attribute; false, otherwise. |
| 152 | bool has_a_value_; |
| 153 | |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 154 | private: |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 155 | int id_; |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 156 | const char *id_string_; |
| 157 | Type datatype_; |
| 158 | const char *datatype_string_; |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 159 | }; |
| 160 | |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 161 | // U8. |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 162 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 163 | class NetlinkU8Attribute : public NetlinkAttribute { |
Wade Guthrie | 8343f7f | 2012-12-04 13:52:32 -0800 | [diff] [blame] | 164 | public: |
| 165 | static const char kMyTypeString[]; |
| 166 | static const Type kType; |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 167 | NetlinkU8Attribute(int id, const char *id_string) |
| 168 | : NetlinkAttribute(id, id_string, kType, kMyTypeString) {} |
Wade Guthrie | 8343f7f | 2012-12-04 13:52:32 -0800 | [diff] [blame] | 169 | bool InitFromNlAttr(const nlattr *data); |
| 170 | bool GetU8Value(uint8_t *value) const; |
| 171 | bool SetU8Value(uint8_t new_value); |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 172 | bool ToString(std::string *value) const; |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 173 | virtual ByteString Encode() const; |
Wade Guthrie | 8343f7f | 2012-12-04 13:52:32 -0800 | [diff] [blame] | 174 | |
| 175 | private: |
| 176 | uint8_t value_; |
| 177 | }; |
| 178 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 179 | class Nl80211AttributeKeyIdx : public NetlinkU8Attribute { |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 180 | public: |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 181 | static const int kName; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 182 | static const char kNameString[]; |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 183 | Nl80211AttributeKeyIdx() : NetlinkU8Attribute(kName, kNameString) {} |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 184 | }; |
| 185 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 186 | class Nl80211AttributeRegType : public NetlinkU8Attribute { |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 187 | public: |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 188 | static const int kName; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 189 | static const char kNameString[]; |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 190 | Nl80211AttributeRegType() : NetlinkU8Attribute(kName, kNameString) {} |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 191 | }; |
| 192 | |
| 193 | // U16. |
| 194 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 195 | class NetlinkU16Attribute : public NetlinkAttribute { |
Wade Guthrie | 8343f7f | 2012-12-04 13:52:32 -0800 | [diff] [blame] | 196 | public: |
| 197 | static const char kMyTypeString[]; |
| 198 | static const Type kType; |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 199 | NetlinkU16Attribute(int id, const char *id_string) |
| 200 | : NetlinkAttribute(id, id_string, kType, kMyTypeString) {} |
Wade Guthrie | 8343f7f | 2012-12-04 13:52:32 -0800 | [diff] [blame] | 201 | bool InitFromNlAttr(const nlattr *data); |
| 202 | bool GetU16Value(uint16_t *value) const; |
| 203 | bool SetU16Value(uint16_t new_value); |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 204 | bool ToString(std::string *value) const; |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 205 | virtual ByteString Encode() const; |
Wade Guthrie | 8343f7f | 2012-12-04 13:52:32 -0800 | [diff] [blame] | 206 | |
| 207 | private: |
| 208 | uint16_t value_; |
| 209 | }; |
| 210 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 211 | class Nl80211AttributeReasonCode : public NetlinkU16Attribute { |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 212 | public: |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 213 | static const int kName; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 214 | static const char kNameString[]; |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 215 | Nl80211AttributeReasonCode() : NetlinkU16Attribute(kName, kNameString) {} |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 216 | }; |
| 217 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 218 | class Nl80211AttributeStatusCode : public NetlinkU16Attribute { |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 219 | public: |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 220 | static const int kName; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 221 | static const char kNameString[]; |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 222 | Nl80211AttributeStatusCode() : NetlinkU16Attribute(kName, kNameString) {} |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 223 | }; |
| 224 | |
| 225 | // U32. |
| 226 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 227 | class NetlinkU32Attribute : public NetlinkAttribute { |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 228 | public: |
| 229 | static const char kMyTypeString[]; |
| 230 | static const Type kType; |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 231 | NetlinkU32Attribute(int id, const char *id_string) |
| 232 | : NetlinkAttribute(id, id_string, kType, kMyTypeString) {} |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 233 | bool InitFromNlAttr(const nlattr *data); |
| 234 | bool GetU32Value(uint32_t *value) const; |
| 235 | bool SetU32Value(uint32_t new_value); |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 236 | bool ToString(std::string *value) const; |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 237 | virtual ByteString Encode() const; |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 238 | |
| 239 | private: |
| 240 | uint32_t value_; |
| 241 | }; |
| 242 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 243 | class Nl80211AttributeDuration : public NetlinkU32Attribute { |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 244 | public: |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 245 | static const int kName; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 246 | static const char kNameString[]; |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 247 | Nl80211AttributeDuration() : NetlinkU32Attribute(kName, kNameString) {} |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 248 | }; |
| 249 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 250 | class Nl80211AttributeGeneration : public NetlinkU32Attribute { |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 251 | public: |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 252 | static const int kName; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 253 | static const char kNameString[]; |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 254 | Nl80211AttributeGeneration() : NetlinkU32Attribute(kName, kNameString) {} |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 255 | }; |
| 256 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 257 | class Nl80211AttributeIfindex : public NetlinkU32Attribute { |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 258 | public: |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 259 | static const int kName; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 260 | static const char kNameString[]; |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 261 | Nl80211AttributeIfindex() : NetlinkU32Attribute(kName, kNameString) {} |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 262 | }; |
| 263 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 264 | class Nl80211AttributeKeyType : public NetlinkU32Attribute { |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 265 | public: |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 266 | static const int kName; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 267 | static const char kNameString[]; |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 268 | Nl80211AttributeKeyType() : NetlinkU32Attribute(kName, kNameString) {} |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 269 | }; |
| 270 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 271 | class Nl80211AttributeRegInitiator : public NetlinkU32Attribute { |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 272 | public: |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 273 | static const int kName; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 274 | static const char kNameString[]; |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 275 | Nl80211AttributeRegInitiator() : NetlinkU32Attribute(kName, kNameString) {} |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 276 | }; |
| 277 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 278 | class Nl80211AttributeWiphy : public NetlinkU32Attribute { |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 279 | public: |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 280 | static const int kName; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 281 | static const char kNameString[]; |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 282 | Nl80211AttributeWiphy() : NetlinkU32Attribute(kName, kNameString) {} |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 283 | }; |
| 284 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 285 | class Nl80211AttributeWiphyFreq : public NetlinkU32Attribute { |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 286 | public: |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 287 | static const int kName; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 288 | static const char kNameString[]; |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 289 | Nl80211AttributeWiphyFreq() : NetlinkU32Attribute(kName, kNameString) {} |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 290 | }; |
| 291 | |
| 292 | // U64. |
| 293 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 294 | class NetlinkU64Attribute : public NetlinkAttribute { |
Wade Guthrie | 8343f7f | 2012-12-04 13:52:32 -0800 | [diff] [blame] | 295 | public: |
| 296 | static const char kMyTypeString[]; |
| 297 | static const Type kType; |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 298 | NetlinkU64Attribute(int id, const char *id_string) |
| 299 | : NetlinkAttribute(id, id_string, kType, kMyTypeString) {} |
Wade Guthrie | 8343f7f | 2012-12-04 13:52:32 -0800 | [diff] [blame] | 300 | bool InitFromNlAttr(const nlattr *data); |
| 301 | bool GetU64Value(uint64_t *value) const; |
| 302 | bool SetU64Value(uint64_t new_value); |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 303 | bool ToString(std::string *value) const; |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 304 | virtual ByteString Encode() const; |
Wade Guthrie | 8343f7f | 2012-12-04 13:52:32 -0800 | [diff] [blame] | 305 | |
| 306 | private: |
| 307 | uint64_t value_; |
| 308 | }; |
| 309 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 310 | class Nl80211AttributeCookie : public NetlinkU64Attribute { |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 311 | public: |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 312 | static const int kName; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 313 | static const char kNameString[]; |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 314 | Nl80211AttributeCookie() : NetlinkU64Attribute(kName, kNameString) {} |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 315 | }; |
| 316 | |
| 317 | // Flag. |
| 318 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 319 | class NetlinkFlagAttribute : public NetlinkAttribute { |
Wade Guthrie | 8343f7f | 2012-12-04 13:52:32 -0800 | [diff] [blame] | 320 | public: |
| 321 | static const char kMyTypeString[]; |
| 322 | static const Type kType; |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 323 | NetlinkFlagAttribute(int id, const char *id_string) |
| 324 | : NetlinkAttribute(id, id_string, kType, kMyTypeString) {} |
Wade Guthrie | 8343f7f | 2012-12-04 13:52:32 -0800 | [diff] [blame] | 325 | bool InitFromNlAttr(const nlattr *data); |
| 326 | bool GetFlagValue(bool *value) const; |
| 327 | bool SetFlagValue(bool new_value); |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 328 | bool ToString(std::string *value) const; |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 329 | virtual ByteString Encode() const; |
Wade Guthrie | 8343f7f | 2012-12-04 13:52:32 -0800 | [diff] [blame] | 330 | |
| 331 | private: |
| 332 | bool value_; |
| 333 | }; |
| 334 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 335 | class Nl80211AttributeDisconnectedByAp : public NetlinkFlagAttribute { |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 336 | public: |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 337 | static const int kName; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 338 | static const char kNameString[]; |
| 339 | Nl80211AttributeDisconnectedByAp() : |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 340 | NetlinkFlagAttribute(kName, kNameString) {} |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 341 | }; |
| 342 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 343 | class Nl80211AttributeSupportMeshAuth : public NetlinkFlagAttribute { |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 344 | public: |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 345 | static const int kName; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 346 | static const char kNameString[]; |
| 347 | Nl80211AttributeSupportMeshAuth() : |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 348 | NetlinkFlagAttribute(kName, kNameString) {} |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 349 | }; |
| 350 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 351 | class Nl80211AttributeTimedOut : public NetlinkFlagAttribute { |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 352 | public: |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 353 | static const int kName; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 354 | static const char kNameString[]; |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 355 | Nl80211AttributeTimedOut() : NetlinkFlagAttribute(kName, kNameString) {} |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 356 | }; |
| 357 | |
| 358 | // String. |
| 359 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 360 | class NetlinkStringAttribute : public NetlinkAttribute { |
Wade Guthrie | 8343f7f | 2012-12-04 13:52:32 -0800 | [diff] [blame] | 361 | public: |
| 362 | static const char kMyTypeString[]; |
| 363 | static const Type kType; |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 364 | NetlinkStringAttribute(int id, const char *id_string) |
| 365 | : NetlinkAttribute(id, id_string, kType, kMyTypeString) {} |
Wade Guthrie | 8343f7f | 2012-12-04 13:52:32 -0800 | [diff] [blame] | 366 | bool InitFromNlAttr(const nlattr *data); |
| 367 | bool GetStringValue(std::string *value) const; |
| 368 | bool SetStringValue(const std::string new_value); |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 369 | bool ToString(std::string *value) const; |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 370 | virtual ByteString Encode() const; |
Wade Guthrie | 8343f7f | 2012-12-04 13:52:32 -0800 | [diff] [blame] | 371 | |
| 372 | private: |
| 373 | std::string value_; |
| 374 | }; |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 375 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 376 | class Nl80211AttributeRegAlpha2 : public NetlinkStringAttribute { |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 377 | public: |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 378 | static const int kName; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 379 | static const char kNameString[]; |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 380 | Nl80211AttributeRegAlpha2() : NetlinkStringAttribute(kName, kNameString) {} |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 381 | }; |
| 382 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 383 | class Nl80211AttributeWiphyName : public NetlinkStringAttribute { |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 384 | public: |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 385 | static const int kName; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 386 | static const char kNameString[]; |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 387 | Nl80211AttributeWiphyName() : NetlinkStringAttribute(kName, kNameString) {} |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 388 | }; |
| 389 | |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 390 | // Nested. |
| 391 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 392 | class NetlinkNestedAttribute : public NetlinkAttribute { |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 393 | public: |
| 394 | static const char kMyTypeString[]; |
| 395 | static const Type kType; |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 396 | NetlinkNestedAttribute(int id, const char *id_string); |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 397 | bool InitFromNlAttr(const nlattr *data) { |
| 398 | LOG(FATAL) << "Try initializing a _specific_ nested type, instead."; |
| 399 | return false; |
| 400 | } |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 401 | bool GetNestedValue(base::WeakPtr<AttributeList> *value); |
| 402 | bool ToString(std::string *value) const { |
Wade Guthrie | 3af8b4d | 2013-01-10 08:39:30 -0800 | [diff] [blame] | 403 | return false; // TODO(wdg): Actually generate a string, here. |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 404 | } |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 405 | virtual ByteString Encode() const { |
| 406 | return ByteString(); // TODO(wdg): Actually encode the attribute. |
| 407 | } |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 408 | |
| 409 | protected: |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 410 | AttributeList value_; |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 411 | }; |
| 412 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 413 | class Nl80211AttributeCqm : public NetlinkNestedAttribute { |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 414 | public: |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 415 | static const int kName; |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 416 | static const char kNameString[]; |
| 417 | Nl80211AttributeCqm(); |
| 418 | bool InitFromNlAttr(const nlattr *data); |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 419 | bool ToString(std::string *value) const { |
Wade Guthrie | 3af8b4d | 2013-01-10 08:39:30 -0800 | [diff] [blame] | 420 | return false; // TODO(wdg): Need |ToString|. |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 421 | } |
| 422 | }; |
| 423 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 424 | class Nl80211AttributeStaInfo : public NetlinkNestedAttribute { |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 425 | public: |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 426 | static const int kName; |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 427 | static const char kNameString[]; |
| 428 | explicit Nl80211AttributeStaInfo() : |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 429 | NetlinkNestedAttribute(kName, kNameString) {} |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 430 | bool InitFromNlAttr(const nlattr *const_data); |
Wade Guthrie | 3af8b4d | 2013-01-10 08:39:30 -0800 | [diff] [blame] | 431 | bool ToString(std::string *value) const { |
| 432 | return false; // TODO(wdg): Need |ToString|. |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 433 | } |
| 434 | }; |
| 435 | |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 436 | // Raw. |
| 437 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 438 | class NetlinkRawAttribute : public NetlinkAttribute { |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 439 | public: |
| 440 | static const char kMyTypeString[]; |
| 441 | static const Type kType; |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 442 | NetlinkRawAttribute(int id, const char *id_string) |
| 443 | : NetlinkAttribute(id, id_string, kType, kMyTypeString) {} |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 444 | bool InitFromNlAttr(const nlattr *data); |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 445 | bool GetRawValue(ByteString *value) const; |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 446 | // Not supporting 'set' for raw data. This type is a "don't know" type to |
| 447 | // be used for user-bound massages (via InitFromNlAttr). The 'set' method |
| 448 | // is intended for building kernel-bound messages and shouldn't be used with |
| 449 | // raw data. |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 450 | bool ToString(std::string *value) const; |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 451 | virtual ByteString Encode() const { |
| 452 | return ByteString(); // TODO(wdg): Actually encode the attribute. |
| 453 | } |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 454 | }; |
| 455 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 456 | class Nl80211AttributeFrame : public NetlinkRawAttribute { |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 457 | public: |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 458 | static const int kName; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 459 | static const char kNameString[]; |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 460 | Nl80211AttributeFrame() : NetlinkRawAttribute(kName, kNameString) {} |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 461 | }; |
| 462 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 463 | class NetlinkAttributeGeneric : public NetlinkRawAttribute { |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 464 | public: |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 465 | explicit NetlinkAttributeGeneric(int id); |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 466 | const char *id_string() const; |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 467 | |
| 468 | private: |
repo sync | 12cca80 | 2012-12-19 17:34:22 -0800 | [diff] [blame] | 469 | std::string id_string_; |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 470 | }; |
| 471 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 472 | class Nl80211AttributeKeySeq : public NetlinkRawAttribute { |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 473 | public: |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 474 | static const int kName; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 475 | static const char kNameString[]; |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 476 | Nl80211AttributeKeySeq() : NetlinkRawAttribute(kName, kNameString) {} |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 477 | }; |
| 478 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 479 | class Nl80211AttributeMac : public NetlinkRawAttribute { |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 480 | public: |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 481 | static const int kName; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 482 | static const char kNameString[]; |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 483 | Nl80211AttributeMac() : NetlinkRawAttribute(kName, kNameString) {} |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 484 | }; |
| 485 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 486 | class Nl80211AttributeRespIe : public NetlinkRawAttribute { |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 487 | public: |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 488 | static const int kName; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 489 | static const char kNameString[]; |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 490 | Nl80211AttributeRespIe() : NetlinkRawAttribute(kName, kNameString) {} |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 491 | }; |
| 492 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 493 | class Nl80211AttributeScanFrequencies : public NetlinkRawAttribute { |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 494 | public: |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 495 | static const int kName; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 496 | static const char kNameString[]; |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 497 | Nl80211AttributeScanFrequencies() : NetlinkRawAttribute(kName, kNameString) {} |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 498 | }; |
| 499 | |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 500 | class Nl80211AttributeScanSsids : public NetlinkRawAttribute { |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 501 | public: |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 502 | static const int kName; |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 503 | static const char kNameString[]; |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame^] | 504 | Nl80211AttributeScanSsids() : NetlinkRawAttribute(kName, kNameString) {} |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 505 | }; |
| 506 | |
Wade Guthrie | 25cdb38 | 2012-12-04 14:04:05 -0800 | [diff] [blame] | 507 | |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 508 | } // namespace shill |
| 509 | |
| 510 | #endif // SHILL_NLATTRIBUTE_H_ |