Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [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 | |
Wade Guthrie | 89e6cb3 | 2013-03-07 08:03:45 -0800 | [diff] [blame] | 5 | #ifndef SHILL_NL80211_MESSAGE_H_ |
| 6 | #define SHILL_NL80211_MESSAGE_H_ |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 7 | |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 8 | #include <map> |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 9 | #include <string> |
Wade Guthrie | 8343f7f | 2012-12-04 13:52:32 -0800 | [diff] [blame] | 10 | #include <vector> |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 11 | |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 12 | #include <base/lazy_instance.h> |
Wade Guthrie | 89e6cb3 | 2013-03-07 08:03:45 -0800 | [diff] [blame] | 13 | |
repo sync | 1538d44 | 2012-12-20 15:24:35 -0800 | [diff] [blame] | 14 | #include "shill/byte_string.h" |
Wade Guthrie | 0ae4b8e | 2013-04-10 16:49:15 -0700 | [diff] [blame] | 15 | #include "shill/generic_netlink_message.h" |
Wade Guthrie | 1619624 | 2012-11-20 15:53:52 -0800 | [diff] [blame] | 16 | |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 17 | struct nlmsghdr; |
| 18 | |
| 19 | namespace shill { |
| 20 | |
Wade Guthrie | f48a195 | 2013-03-04 17:33:47 -0800 | [diff] [blame] | 21 | // Class for messages received from the mac80211 drivers by way of the |
| 22 | // cfg80211 kernel module. |
| 23 | class Nl80211Message : public GenericNetlinkMessage { |
| 24 | public: |
| 25 | static const char kMessageTypeString[]; |
| 26 | static const unsigned int kEthernetAddressBytes; |
| 27 | static const char kBogusMacAddress[]; |
| 28 | |
| 29 | Nl80211Message(uint8 command, const char *command_string) |
| 30 | : GenericNetlinkMessage(nl80211_message_type_, command, command_string) {} |
| 31 | virtual ~Nl80211Message() {} |
| 32 | |
Paul Stewart | 2ddf2c6 | 2013-04-16 09:47:34 -0700 | [diff] [blame^] | 33 | // Gets the family_id / message_type for all Nl80211 messages. |
| 34 | static uint16_t GetMessageType(); |
| 35 | |
Wade Guthrie | bee87c2 | 2013-03-06 11:00:46 -0800 | [diff] [blame] | 36 | // Sets the family_id / message_type for all Nl80211 messages. |
| 37 | static void SetMessageType(uint16_t message_type); |
| 38 | |
Wade Guthrie | f48a195 | 2013-03-04 17:33:47 -0800 | [diff] [blame] | 39 | virtual bool InitFromNlmsg(const nlmsghdr *msg); |
| 40 | |
| 41 | uint8 command() const { return command_; } |
| 42 | const char *command_string() const { return command_string_; } |
| 43 | uint16_t message_type() const { return message_type_; } |
| 44 | uint32_t sequence_number() const { return sequence_number_; } |
| 45 | void set_sequence_number(uint32_t seq) { sequence_number_ = seq; } |
| 46 | |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 47 | // TODO(wdg): This needs to be moved to AttributeMac. |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 48 | // Helper function to provide a string for a MAC address. If no attribute |
| 49 | // is found, this method returns 'false'. On any error with a non-NULL |
| 50 | // |value|, this method sets |value| to a bogus MAC address. |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame] | 51 | bool GetMacAttributeString(int id, std::string *value) const; |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 52 | |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 53 | // TODO(wdg): This needs to be moved to AttributeScanFrequencies. |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 54 | // Helper function to provide a vector of scan frequencies for attributes |
| 55 | // that contain them (such as NL80211_ATTR_SCAN_FREQUENCIES). |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame] | 56 | bool GetScanFrequenciesAttribute(int id, std::vector<uint32_t> *value) const; |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 57 | |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 58 | // TODO(wdg): This needs to be moved to AttributeScanSSids. |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 59 | // Helper function to provide a vector of SSIDs for attributes that contain |
| 60 | // them (such as NL80211_ATTR_SCAN_SSIDS). |
Wade Guthrie | 68da97c | 2013-02-26 13:09:35 -0800 | [diff] [blame] | 61 | bool GetScanSsidsAttribute(int id, std::vector<std::string> *value) const; |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 62 | |
repo sync | 90ee0fa | 2012-12-18 10:08:08 -0800 | [diff] [blame] | 63 | // TODO(wdg): This needs to be moved to AttributeMac. |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 64 | // Stringizes the MAC address found in 'arg'. If there are problems (such |
| 65 | // as a NULL |arg|), |value| is set to a bogus MAC address. |
| 66 | static std::string StringFromMacAddress(const uint8_t *arg); |
| 67 | |
Wade Guthrie | d4977f2 | 2012-08-22 12:37:54 -0700 | [diff] [blame] | 68 | // Returns a string representing the passed-in |status| or |reason|, the |
| 69 | // value of which has been acquired from libnl (for example, from the |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 70 | // NL80211_ATTR_STATUS_CODE or NL80211_ATTR_REASON_CODE attribute). |
Wade Guthrie | d4977f2 | 2012-08-22 12:37:54 -0700 | [diff] [blame] | 71 | static std::string StringFromReason(uint16_t reason); |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 72 | static std::string StringFromStatus(uint16_t status); |
| 73 | |
Wade Guthrie | 12f113a | 2013-03-12 17:15:46 -0700 | [diff] [blame] | 74 | // Message factory for all types of Nl80211 message. |
| 75 | static NetlinkMessage *CreateMessage(const nlmsghdr *const_msg); |
| 76 | |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 77 | private: |
Wade Guthrie | d4977f2 | 2012-08-22 12:37:54 -0700 | [diff] [blame] | 78 | static std::map<uint16_t, std::string> *reason_code_string_; |
| 79 | static std::map<uint16_t, std::string> *status_code_string_; |
Wade Guthrie | f48a195 | 2013-03-04 17:33:47 -0800 | [diff] [blame] | 80 | static uint16_t nl80211_message_type_; |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 81 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 82 | DISALLOW_COPY_AND_ASSIGN(Nl80211Message); |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 83 | }; |
| 84 | |
| 85 | class Nl80211Frame { |
| 86 | public: |
| 87 | enum Type { |
| 88 | kAssocResponseFrameType = 0x10, |
| 89 | kReassocResponseFrameType = 0x30, |
| 90 | kAssocRequestFrameType = 0x00, |
| 91 | kReassocRequestFrameType = 0x20, |
| 92 | kAuthFrameType = 0xb0, |
| 93 | kDisassocFrameType = 0xa0, |
| 94 | kDeauthFrameType = 0xc0, |
| 95 | kIllegalFrameType = 0xff |
| 96 | }; |
| 97 | |
repo sync | d316eb7 | 2012-12-10 15:48:47 -0800 | [diff] [blame] | 98 | explicit Nl80211Frame(const ByteString &init); |
Wade Guthrie | d4977f2 | 2012-08-22 12:37:54 -0700 | [diff] [blame] | 99 | bool ToString(std::string *output) const; |
| 100 | bool IsEqual(const Nl80211Frame &other) const; |
| 101 | uint16_t reason() const { return reason_; } |
| 102 | uint16_t status() const { return status_; } |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 103 | |
| 104 | private: |
| 105 | static const uint8_t kMinimumFrameByteCount; |
| 106 | static const uint8_t kFrameTypeMask; |
| 107 | |
| 108 | std::string mac_from_; |
| 109 | std::string mac_to_; |
| 110 | uint8_t frame_type_; |
Wade Guthrie | d4977f2 | 2012-08-22 12:37:54 -0700 | [diff] [blame] | 111 | uint16_t reason_; |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 112 | uint16_t status_; |
Wade Guthrie | 8343f7f | 2012-12-04 13:52:32 -0800 | [diff] [blame] | 113 | ByteString frame_; |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 114 | |
| 115 | DISALLOW_COPY_AND_ASSIGN(Nl80211Frame); |
| 116 | }; |
| 117 | |
| 118 | // |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 119 | // Specific Nl80211Message types. |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 120 | // |
| 121 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 122 | class AssociateMessage : public Nl80211Message { |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 123 | public: |
| 124 | static const uint8_t kCommand; |
| 125 | static const char kCommandString[]; |
| 126 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 127 | AssociateMessage() : Nl80211Message(kCommand, kCommandString) {} |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 128 | |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 129 | private: |
| 130 | DISALLOW_COPY_AND_ASSIGN(AssociateMessage); |
| 131 | }; |
| 132 | |
| 133 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 134 | class AuthenticateMessage : public Nl80211Message { |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 135 | public: |
| 136 | static const uint8_t kCommand; |
| 137 | static const char kCommandString[]; |
| 138 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 139 | AuthenticateMessage() : Nl80211Message(kCommand, kCommandString) {} |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 140 | |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 141 | private: |
| 142 | DISALLOW_COPY_AND_ASSIGN(AuthenticateMessage); |
| 143 | }; |
| 144 | |
| 145 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 146 | class CancelRemainOnChannelMessage : public Nl80211Message { |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 147 | public: |
| 148 | static const uint8_t kCommand; |
| 149 | static const char kCommandString[]; |
| 150 | |
Christopher Wiley | 764538d | 2012-11-09 10:58:23 -0800 | [diff] [blame] | 151 | CancelRemainOnChannelMessage() |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 152 | : Nl80211Message(kCommand, kCommandString) {} |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 153 | |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 154 | private: |
| 155 | DISALLOW_COPY_AND_ASSIGN(CancelRemainOnChannelMessage); |
| 156 | }; |
| 157 | |
| 158 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 159 | class ConnectMessage : public Nl80211Message { |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 160 | public: |
| 161 | static const uint8_t kCommand; |
| 162 | static const char kCommandString[]; |
| 163 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 164 | ConnectMessage() : Nl80211Message(kCommand, kCommandString) {} |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 165 | |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 166 | private: |
| 167 | DISALLOW_COPY_AND_ASSIGN(ConnectMessage); |
| 168 | }; |
| 169 | |
| 170 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 171 | class DeauthenticateMessage : public Nl80211Message { |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 172 | public: |
| 173 | static const uint8_t kCommand; |
| 174 | static const char kCommandString[]; |
| 175 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 176 | DeauthenticateMessage() : Nl80211Message(kCommand, kCommandString) {} |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 177 | |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 178 | private: |
| 179 | DISALLOW_COPY_AND_ASSIGN(DeauthenticateMessage); |
| 180 | }; |
| 181 | |
| 182 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 183 | class DeleteStationMessage : public Nl80211Message { |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 184 | public: |
| 185 | static const uint8_t kCommand; |
| 186 | static const char kCommandString[]; |
| 187 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 188 | DeleteStationMessage() : Nl80211Message(kCommand, kCommandString) {} |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 189 | |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 190 | private: |
| 191 | DISALLOW_COPY_AND_ASSIGN(DeleteStationMessage); |
| 192 | }; |
| 193 | |
| 194 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 195 | class DisassociateMessage : public Nl80211Message { |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 196 | public: |
| 197 | static const uint8_t kCommand; |
| 198 | static const char kCommandString[]; |
| 199 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 200 | DisassociateMessage() : Nl80211Message(kCommand, kCommandString) {} |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 201 | |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 202 | private: |
| 203 | DISALLOW_COPY_AND_ASSIGN(DisassociateMessage); |
| 204 | }; |
| 205 | |
| 206 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 207 | class DisconnectMessage : public Nl80211Message { |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 208 | public: |
| 209 | static const uint8_t kCommand; |
| 210 | static const char kCommandString[]; |
| 211 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 212 | DisconnectMessage() : Nl80211Message(kCommand, kCommandString) {} |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 213 | |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 214 | private: |
| 215 | DISALLOW_COPY_AND_ASSIGN(DisconnectMessage); |
| 216 | }; |
| 217 | |
| 218 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 219 | class FrameTxStatusMessage : public Nl80211Message { |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 220 | public: |
| 221 | static const uint8_t kCommand; |
| 222 | static const char kCommandString[]; |
| 223 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 224 | FrameTxStatusMessage() : Nl80211Message(kCommand, kCommandString) {} |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 225 | |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 226 | private: |
| 227 | DISALLOW_COPY_AND_ASSIGN(FrameTxStatusMessage); |
| 228 | }; |
| 229 | |
repo sync | 0efa9f0 | 2012-12-28 13:40:20 -0800 | [diff] [blame] | 230 | class GetRegMessage : public Nl80211Message { |
| 231 | public: |
| 232 | static const uint8_t kCommand; |
| 233 | static const char kCommandString[]; |
| 234 | |
| 235 | GetRegMessage() : Nl80211Message(kCommand, kCommandString) {} |
| 236 | |
| 237 | private: |
| 238 | DISALLOW_COPY_AND_ASSIGN(GetRegMessage); |
| 239 | }; |
| 240 | |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 241 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 242 | class JoinIbssMessage : public Nl80211Message { |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 243 | public: |
| 244 | static const uint8_t kCommand; |
| 245 | static const char kCommandString[]; |
| 246 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 247 | JoinIbssMessage() : Nl80211Message(kCommand, kCommandString) {} |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 248 | |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 249 | private: |
| 250 | DISALLOW_COPY_AND_ASSIGN(JoinIbssMessage); |
| 251 | }; |
| 252 | |
| 253 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 254 | class MichaelMicFailureMessage : public Nl80211Message { |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 255 | public: |
| 256 | static const uint8_t kCommand; |
| 257 | static const char kCommandString[]; |
| 258 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 259 | MichaelMicFailureMessage() : Nl80211Message(kCommand, kCommandString) {} |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 260 | |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 261 | private: |
| 262 | DISALLOW_COPY_AND_ASSIGN(MichaelMicFailureMessage); |
| 263 | }; |
| 264 | |
| 265 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 266 | class NewScanResultsMessage : public Nl80211Message { |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 267 | public: |
| 268 | static const uint8_t kCommand; |
| 269 | static const char kCommandString[]; |
| 270 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 271 | NewScanResultsMessage() : Nl80211Message(kCommand, kCommandString) {} |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 272 | |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 273 | private: |
| 274 | DISALLOW_COPY_AND_ASSIGN(NewScanResultsMessage); |
| 275 | }; |
| 276 | |
| 277 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 278 | class NewStationMessage : public Nl80211Message { |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 279 | public: |
| 280 | static const uint8_t kCommand; |
| 281 | static const char kCommandString[]; |
| 282 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 283 | NewStationMessage() : Nl80211Message(kCommand, kCommandString) {} |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 284 | |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 285 | private: |
| 286 | DISALLOW_COPY_AND_ASSIGN(NewStationMessage); |
| 287 | }; |
| 288 | |
| 289 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 290 | class NewWifiMessage : public Nl80211Message { |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 291 | public: |
| 292 | static const uint8_t kCommand; |
| 293 | static const char kCommandString[]; |
| 294 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 295 | NewWifiMessage() : Nl80211Message(kCommand, kCommandString) {} |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 296 | |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 297 | private: |
| 298 | DISALLOW_COPY_AND_ASSIGN(NewWifiMessage); |
| 299 | }; |
| 300 | |
| 301 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 302 | class NotifyCqmMessage : public Nl80211Message { |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 303 | public: |
| 304 | static const uint8_t kCommand; |
| 305 | static const char kCommandString[]; |
| 306 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 307 | NotifyCqmMessage() : Nl80211Message(kCommand, kCommandString) {} |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 308 | |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 309 | private: |
| 310 | DISALLOW_COPY_AND_ASSIGN(NotifyCqmMessage); |
| 311 | }; |
| 312 | |
| 313 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 314 | class PmksaCandidateMessage : public Nl80211Message { |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 315 | public: |
| 316 | static const uint8_t kCommand; |
| 317 | static const char kCommandString[]; |
| 318 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 319 | PmksaCandidateMessage() : Nl80211Message(kCommand, kCommandString) {} |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 320 | |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 321 | private: |
| 322 | DISALLOW_COPY_AND_ASSIGN(PmksaCandidateMessage); |
| 323 | }; |
| 324 | |
| 325 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 326 | class RegBeaconHintMessage : public Nl80211Message { |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 327 | public: |
| 328 | static const uint8_t kCommand; |
| 329 | static const char kCommandString[]; |
| 330 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 331 | RegBeaconHintMessage() : Nl80211Message(kCommand, kCommandString) {} |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 332 | |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 333 | private: |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 334 | DISALLOW_COPY_AND_ASSIGN(RegBeaconHintMessage); |
| 335 | }; |
| 336 | |
| 337 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 338 | class RegChangeMessage : public Nl80211Message { |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 339 | public: |
| 340 | static const uint8_t kCommand; |
| 341 | static const char kCommandString[]; |
| 342 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 343 | RegChangeMessage() : Nl80211Message(kCommand, kCommandString) {} |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 344 | |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 345 | private: |
| 346 | DISALLOW_COPY_AND_ASSIGN(RegChangeMessage); |
| 347 | }; |
| 348 | |
| 349 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 350 | class RemainOnChannelMessage : public Nl80211Message { |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 351 | public: |
| 352 | static const uint8_t kCommand; |
| 353 | static const char kCommandString[]; |
| 354 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 355 | RemainOnChannelMessage() : Nl80211Message(kCommand, kCommandString) {} |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 356 | |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 357 | private: |
| 358 | DISALLOW_COPY_AND_ASSIGN(RemainOnChannelMessage); |
| 359 | }; |
| 360 | |
| 361 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 362 | class RoamMessage : public Nl80211Message { |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 363 | public: |
| 364 | static const uint8_t kCommand; |
| 365 | static const char kCommandString[]; |
| 366 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 367 | RoamMessage() : Nl80211Message(kCommand, kCommandString) {} |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 368 | |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 369 | private: |
| 370 | DISALLOW_COPY_AND_ASSIGN(RoamMessage); |
| 371 | }; |
| 372 | |
| 373 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 374 | class ScanAbortedMessage : public Nl80211Message { |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 375 | public: |
| 376 | static const uint8_t kCommand; |
| 377 | static const char kCommandString[]; |
| 378 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 379 | ScanAbortedMessage() : Nl80211Message(kCommand, kCommandString) {} |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 380 | |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 381 | private: |
| 382 | DISALLOW_COPY_AND_ASSIGN(ScanAbortedMessage); |
| 383 | }; |
| 384 | |
| 385 | |
Wade Guthrie | 7187247 | 2013-03-05 10:33:38 -0800 | [diff] [blame] | 386 | class GetScanMessage : public Nl80211Message { |
| 387 | public: |
| 388 | static const uint8_t kCommand; |
| 389 | static const char kCommandString[]; |
| 390 | |
| 391 | GetScanMessage() : Nl80211Message(kCommand, kCommandString) {} |
| 392 | |
| 393 | private: |
| 394 | DISALLOW_COPY_AND_ASSIGN(GetScanMessage); |
| 395 | }; |
| 396 | |
| 397 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 398 | class TriggerScanMessage : public Nl80211Message { |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 399 | public: |
| 400 | static const uint8_t kCommand; |
| 401 | static const char kCommandString[]; |
| 402 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 403 | TriggerScanMessage() : Nl80211Message(kCommand, kCommandString) {} |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 404 | |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 405 | private: |
| 406 | DISALLOW_COPY_AND_ASSIGN(TriggerScanMessage); |
| 407 | }; |
| 408 | |
| 409 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 410 | class UnprotDeauthenticateMessage : public Nl80211Message { |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 411 | public: |
| 412 | static const uint8_t kCommand; |
| 413 | static const char kCommandString[]; |
| 414 | |
Christopher Wiley | 764538d | 2012-11-09 10:58:23 -0800 | [diff] [blame] | 415 | UnprotDeauthenticateMessage() |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 416 | : Nl80211Message(kCommand, kCommandString) {} |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 417 | |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 418 | private: |
| 419 | DISALLOW_COPY_AND_ASSIGN(UnprotDeauthenticateMessage); |
| 420 | }; |
| 421 | |
| 422 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 423 | class UnprotDisassociateMessage : public Nl80211Message { |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 424 | public: |
| 425 | static const uint8_t kCommand; |
| 426 | static const char kCommandString[]; |
| 427 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 428 | UnprotDisassociateMessage() : Nl80211Message(kCommand, kCommandString) {} |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 429 | |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 430 | private: |
| 431 | DISALLOW_COPY_AND_ASSIGN(UnprotDisassociateMessage); |
| 432 | }; |
| 433 | |
Paul Stewart | 2ddf2c6 | 2013-04-16 09:47:34 -0700 | [diff] [blame^] | 434 | |
| 435 | class GetInterfaceMessage : public Nl80211Message { |
| 436 | public: |
| 437 | static const uint8_t kCommand; |
| 438 | static const char kCommandString[]; |
| 439 | |
| 440 | GetInterfaceMessage(); |
| 441 | |
| 442 | private: |
| 443 | DISALLOW_COPY_AND_ASSIGN(GetInterfaceMessage); |
| 444 | }; |
| 445 | |
| 446 | class NewInterfaceMessage : public Nl80211Message { |
| 447 | public: |
| 448 | static const uint8_t kCommand; |
| 449 | static const char kCommandString[]; |
| 450 | |
| 451 | NewInterfaceMessage() : Nl80211Message(kCommand, kCommandString) {} |
| 452 | |
| 453 | private: |
| 454 | DISALLOW_COPY_AND_ASSIGN(NewInterfaceMessage); |
| 455 | }; |
| 456 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 457 | // Nl80211MessageDataCollector - this class is used to collect data to be |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 458 | // used for unit tests. It is only invoked in this case. |
| 459 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 460 | class Nl80211MessageDataCollector { |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 461 | public: |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 462 | static Nl80211MessageDataCollector *GetInstance(); |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 463 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 464 | void CollectDebugData(const Nl80211Message &message, nlmsghdr *msg); |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 465 | |
| 466 | protected: |
| 467 | friend struct |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 468 | base::DefaultLazyInstanceTraits<Nl80211MessageDataCollector>; |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 469 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 470 | explicit Nl80211MessageDataCollector(); |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 471 | |
| 472 | private: |
| 473 | // In order to limit the output from this class, I keep track of types I |
| 474 | // haven't yet printed. |
| 475 | std::map<uint8_t, bool> need_to_print; |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 476 | |
| 477 | DISALLOW_COPY_AND_ASSIGN(Nl80211MessageDataCollector); |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 478 | }; |
| 479 | |
| 480 | } // namespace shill |
| 481 | |
Wade Guthrie | 89e6cb3 | 2013-03-07 08:03:45 -0800 | [diff] [blame] | 482 | #endif // SHILL_NL80211_MESSAGE_H_ |