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