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